05-20-2009 2:14 PM
Hi Gurus,
I have a requierement where I need to read differrent internal tables starting with GT_TXT_* and whcih tabel is going to be read will be decided at runtime only.
I tried the following code but it's giving syntax error. Any suggestions ?
DATA : l_tabname(14) TYPE c.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE any.
DATA dref TYPE REF TO ty_struc.
CONCATENATE 'GT_TXT_' belege-field INTO l_tabname.
ASSIGN (l_tabname) TO <dyn_table>.
READ TABLE <dyn_table> INTO struc_txt WITH KEY key = t_output-old_val.
IF sy-subrc = 0.
t_output-old_val = struc_txt-text.
ENDIF.
Regards,
Sandip.
05-20-2009 2:21 PM
TYPES : t_mara TYPE TABLE OF mara .
DATA : gt_txt_1 TYPE t_mara ,
gt_txt_2 TYPE t_mara .
DATA : gs_txt TYPE mara .
DATA : l_tabname(14) TYPE c.
FIELD-SYMBOLS: <dyn_table> TYPE t_mara .
CONCATENATE 'GT_TXT_' '1' INTO l_tabname.
ASSIGN (l_tabname) TO <dyn_table>.
READ TABLE <dyn_table> INTO gs_txt WITH KEY matnr = 'abc' .
IF sy-subrc = 0.
ENDIF.
05-20-2009 2:21 PM
TYPES : t_mara TYPE TABLE OF mara .
DATA : gt_txt_1 TYPE t_mara ,
gt_txt_2 TYPE t_mara .
DATA : gs_txt TYPE mara .
DATA : l_tabname(14) TYPE c.
FIELD-SYMBOLS: <dyn_table> TYPE t_mara .
CONCATENATE 'GT_TXT_' '1' INTO l_tabname.
ASSIGN (l_tabname) TO <dyn_table>.
READ TABLE <dyn_table> INTO gs_txt WITH KEY matnr = 'abc' .
IF sy-subrc = 0.
ENDIF.
05-20-2009 3:36 PM
Hi ,
You can check the my post in the thread in specified in the bellow link --
[https://forums.sdn.sap.com/click.jspa?searchID=-1&messageID=7545053]
You can check the link bellow --
[https://wiki.sdn.sap.com/wiki/display/Snippets/Howtocreateinternaltable+dynamically]
Regards
Pinaki