Referencing specific field in returned structure

lightReferencing specific field in returned structure

 

 


With new ABAP, we can only refer to a particular field in the return structure. The post shows how to get only a particular filed from the returned SPFLI structure.

22


CLASS lcl_flight DEFINITION.
  PUBLIC SECTION.
    METHODSget_flight IMPORTING iv_carr         TYPE s_carr_id
                        RETURNING VALUE(rs_spfliTYPE spfli.
ENDCLASS.
CLASS lcl_flight IMPLEMENTATION.
  METHOD get_flight.
    SELECT SINGLE FROM spfli INTO rs_spfli WHERE carrid iv_carr.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
DATA(lr_flightNEW lcl_flight).
DATA(ls_spflilr_flight->get_flightiv_carr ‘AA’ ).
WRITE:/ ls_spflicityfrom.
” Getting only particualr field from returning structure
DATA(lv_cityfromlr_flight->get_flightiv_carr ‘AA’ )-cityfrom.
WRITE:/ lv_cityfrom.


OUTPUT

23


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s