12-16-2014 10:20 AM
Hi All,
I have a problem to read data from dynamic internal table.
My code is..
FIELD-SYMBOLS:<t_dyntable> TYPE STANDARD TABLE, "Dynamic internal table name
<fs_dyntable>. " work area
fld_name = 'EAN11'.
READ TABLE <t_dyntable> INTO <fs_dyntable> WITH KEY (fld_name) = ean_no.
IF sy-subrc = 0. " Perfect till now
Now i want the value of filed EAN11 and MATNR which is already assigned.
Variable1 = <fs_dyntable>-????? " have error (want EAN11 Value)
Variable2 = <fs_dyntable>-????? " have error (want MATNR Value)
endif.
Thanks & Regards,
Mital
12-16-2014 10:38 AM
12-16-2014 10:45 AM
hi mital,
I think you are missing dynamic work area
Create like this and try please:
CREATE DATA T_NEWLINE LIKE LINE OF <t_dyntable>.
ASSIGN T_NEWLINE->* TO <fs_dyntable>.
12-16-2014 10:50 AM
Hi abdul,
I don't have Fixed structure of dynamic internal table.
have have read internal table successfully but i don't know the how to get value from dynamic work area.
12-16-2014 10:44 AM
Hi, Mital!
You can try smth like that
ASSIGN COMPONENT 'EAN11' OF STRUCTURE <fs_dyntable> TO <lv_ean11>.
IF sy-subrc = 0.
Variable1 = <lv_ean11>.
ENDIF.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_dyntable> TO <lv_matnr>.
IF sy-subrc = 0.
Variable2 = <lv_matnr>.
ENDIF.
12-16-2014 10:58 AM
12-16-2014 11:02 AM
12-16-2014 10:57 AM
Hi, Please find to create the dynamic table,
FIELD-SYMBOLS: <GIT> TYPE STANDARD TABLE,
<GFL> TYPE ANY,
<VAL> type ANY.
data: GIT_FLDS TYPE LVC_T_FCAT,
GIT TYPE REF TO DATA,
CALL METHOD
CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = GIT_FLDS
IMPORTING
EP_TABLE = GIT.
IF IS ASSIGNED.
UNASSIGN .
ENDIF.
ASSIGN GIT->* TO <GIT>.
CREATE DATA GFL LIKE LINE OF .
IF IS ASSIGNED.
UNASSIGN .
ENDIF.
ASSIGN GFL->* TO <GFL>.
and to read or update the information in dynamic table,
ASSIGN COMPONENT GFL_FLDS-FIELDNAME OF STRUCTURE <GFL> TO <VAL>.
Regards.
Praveer.
12-16-2014 11:04 AM