Code: Alles auswählen.
Perform Test in program SUBMIT_PROG
changing <l_fs_table>.
Code: Alles auswählen.
FORM test CHANGING cz_ref TYPE REF TO data.
GET REFERENCE OF gt_table INTO cz_ref.
ENDFORM.
Code: Alles auswählen.
ASSIGN lz_ref->* TO <feldsymbol>.
Ich habs auch ausprobiert und bei mir gehts:Steffi221185 hat geschrieben: danke für den Tipp, aber das hab ich auch schon ausprobiert. War ja mein erster Gedanke. Nur leider ist das Referenzobjekt bei der Rückkehr in die Methode leer.
Code: Alles auswählen.
REPORT z001.
DATA:
lz_data TYPE REF TO data.
FIELD-SYMBOLS:
<lt_data> TYPE ANY TABLE.
DO 3 TIMES.
CLEAR lz_data.
UNASSIGN <lt_data>.
PERFORM getref(z002) CHANGING lz_data.
ASSIGN lz_data->* TO <lt_data>.
ENDDO.
Code: Alles auswählen.
REPORT z002.
DATA:
gt_data TYPE TABLE OF mara.
FORM getref CHANGING cz_ref TYPE REF TO data.
DATA:
ls_mara TYPE mara.
SELECT SINGLE * FROM mara INTO ls_mara.
APPEND ls_mara TO gt_data.
GET REFERENCE OF gt_data INTO cz_ref.
ENDFORM.
Steffi221185 hat geschrieben: Hier der Aufruf des Unterprogramms:GrußCode: Alles auswählen.
Perform Test in program SUBMIT_PROG changing <l_fs_table>.
Steffi
Code: Alles auswählen.
DATA:
g_mara TYPE xfeld,
gt_data1 TYPE TABLE OF mara,
gt_data2 TYPE TABLE OF aenr.
FORM getref CHANGING cz_ref TYPE REF TO data.
IF g_mara IS INITIAL.
SELECT * FROM aenr UP TO 1 ROWS INTO TABLE gt_data2.
GET REFERENCE OF gt_data2 INTO cz_ref.
g_mara = 'X'.
ELSE.
SELECT * FROM mara UP TO 1 ROWS INTO TABLE gt_data1.
GET REFERENCE OF gt_data1 INTO cz_ref.
CLEAR g_mara.
ENDIF.
ENDFORM.
Code: Alles auswählen.
DATA:
g_mara TYPE xfeld,
gt_data1 TYPE TABLE OF mara,
gt_data2 TYPE TABLE OF aenr.
FORM getref CHANGING cz_ref TYPE REF TO data.
IF g_mara IS INITIAL.
SELECT * FROM aenr UP TO 1 ROWS INTO TABLE gt_data2.
GET REFERENCE OF gt_data2 INTO cz_ref.
g_mara = 'X'.
ELSE.
SELECT * FROM mara UP TO 1 ROWS INTO TABLE gt_data1.
GET REFERENCE OF gt_data1 INTO cz_ref.
CLEAR g_mara.
ENDIF.
ENDFORM.
Code: Alles auswählen.
Perform Test in program SUBMIT_PROG
changing l_ptr_table_help.
Code: Alles auswählen.
Report SUBMIT_PROG
TYPES: BEGIN OF STRUC_NEW_TABLE,
Test(10) type c,
End OF STRUC_NEW_TABLE.
DATA: L_IT_TABLE TYPE STANDARD table of STRUC_NEW_TABLE.
Form Test changing c_ptr_table type ref to data.
get reference of l_it_table into c_ptr_table.
endform.
Code: Alles auswählen.
DATA:
gz_tab_ptr TYPE REF TO data.
FIELD-SYMBOLS:
<gt_table> TYPE ANY TABLE.
START-OF-SELECTION.
PERFORM get_table_ptr USING 'MARA' CHANGING gz_tab_ptr.
ASSIGN gz_tab_ptr->* TO <gt_table>.
FORM get_table_ptr USING u_name TYPE string CHANGING cz_tab_ptr TYPE REF TO data.
CREATE DATA cz_tab_ptr TYPE TABLE OF (u_name).
ENDFORM. "get_table_ptr