Code: Alles auswählen.
...
* Feldkatalog für die dyn. Tabelle
gs_fieldcatalog-fieldname = 'MATNR'.
gs_fieldcatalog-ref_table = 'MARA'.
gs_fieldcatalog-tabname = 'MARA'.
gs_fieldcatalog-ref_field = 'MATNR'.
APPEND gs_fieldcatalog TO itab_fieldcatalog.
CLEAR gs_fieldcatalog.
gs_fieldcatalog-fieldname = 'VBELN'.
gs_fieldcatalog-ref_table = 'BSEG'.
gs_fieldcatalog-tabname = 'BSEG'.
gs_fieldcatalog-ref_field = 'VBELN'.
APPEND gs_fieldcatalog TO itab_fieldcatalog.
CLEAR gs_fieldcatalog.
FIELD-SYMBOLS: <my_table> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <struct>.
FIELD-SYMBOLS: <feld>.
DATA: ep_table TYPE REF TO data.
ASSIGN ep_table->* TO <my_table>.
EXPORT itab_fieldcatalog FROM itab_fieldcatalog TO MEMORY ID 'test'.
SUBMIT programm02 AND RETURN.
IMPORT <my_table> TO <my_table> FROM MEMORY ID 'table'.
...
Code: Alles auswählen.
...
* Feldkatalog vom ersten Programm importieren
IMPORT itab_fieldcatalog TO itab_fieldcatalog FROM MEMORY ID 'test'.
* Tabelle erstellen
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = itab_fieldcatalog
IMPORTING
ep_table = ep_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc EQ '1'.
WRITE:/ 'SUBPOOL_FULL!!'.
ENDIF.
FIELD-SYMBOLS: <my_table> TYPE STANDARD TABLE.
* Feldsymbol auf die Referenz zeigen lassen, da man Refenzen mit
EXPORT/IMPORT nicht ubergeben/übernehmen kann
ASSIGN ep_table->* TO <my_table>.
* Die dynamische Tabelle soll wieder in das erste Programm zurückgegeben werden
EXPORT <my_table> FROM <my_table> TO MEMORY ID 'table'.
Code: Alles auswählen.
ASSIGN ep_table->* TO <my_table>.
IMPORT <my_table> TO <my_table> FROM MEMORY ID 'table'.
Code: Alles auswählen.
PERFORM test IN PROGRAM z_dev_test_gla_09 USING itab_fieldcatalog
CHANGING ep_table.
Code: Alles auswählen.
SUBMIT z_dev_test_gla_09 AND RETURN EXPORTING LIST TO MEMORY.