03-29-2018 11:15 AM
PARAMETERS:p_ddic LIKE dd02l-tabname.
DATA gdref TYPE REF TO data.
FIELD-SYMBOLS:<itab> TYPE STANDARD TABLE,
<wa> TYPE ANY,
<wa_temp> TYPE ANY.
TRY .
CREATE DATA gdref TYPE STANDARD TABLE OF (p_ddic).
ASSIGN gdref->* TO <itab>.
CLEAR gdref.
CREATE DATA gdref TYPE (p_ddic).
ASSIGN gdref->* TO <wa>.
CATCH cx_sy_create_data_error.
ENDTRY.
SELECT * FROM (p_ddic) INTO TABLE <itab> UP TO 5 ROWS.
IF sy-subrc = 0.
LOOP AT <itab> INTO <wa>.
* IF <wa>-land1 = 'IN'.
* ENDIF.
ENDLOOP.
ENDIF.
Is there a way to access the dynamic field symbols workarea by field name ? I had searched in SCN and it seems the below are the only possible ways.
WHILE sy-subrc = 0.
ASSIGN COMPONENT sy-index OF STRUCTURE <wa> TO <comp>.
WRITE / <comp>.
ENDWHILE
or
ASSIGN COMPONENT 'MATKL' OF STRUCTURE <wa> TO <comp>.
But I want to know if the below way can be possible.
IF <wa>-land1 = 'IN'.
ENDIF
Thanks,
K.Kiran.
03-29-2018 11:33 AM
"But I want to know if the below way can be possible. IF <wa>-land1 = 'IN'. ENDIF"
Unless <wa> is statically typed, no, it's not possible.
03-29-2018 11:33 AM
"But I want to know if the below way can be possible. IF <wa>-land1 = 'IN'. ENDIF"
Unless <wa> is statically typed, no, it's not possible.