2014 Nov 13 10:22 AM
Hi,
I have created a method with 2 parameters:
i_struc type any (import)
ct_table type any table. (changing)
in my method call I have the types for the parameters defined already, so e.g.
data: ls_struc type my_struc,
lt_table type standard table of my_struc.
call method xyz
exporting
i_struct = ls_struc
changing
ct_table = lt_table.
Now in my method I need to refer to the types in the method call, so e.g.
ls_struc-field1 = 'ABC'.
ls_struc-field2 = 'DEF'.
append ls_struc to ct_table.
But of course the ls_struc inside the method has no structure, so I am missing the part where the type from the method call can be used inside the method. The method logic should be generic because I will have different method calls with different types for structure and table. Do I need to use ASSIGN COMPONENT.....?
Any help is appreciated.
Thanks,
Tim
2014 Nov 13 10:46 AM
Hi Tim,
Since you have not given the (static) structure type in the method declaration, I guess Assign component and dynamic programming is the only option left for you. You can get some help from the following post. Best of luck.
Dynamic Internal table - ABAP Development - SCN Wiki
Regards,
Saurabh
2014 Nov 13 10:46 AM
Hi Tim,
Since you have not given the (static) structure type in the method declaration, I guess Assign component and dynamic programming is the only option left for you. You can get some help from the following post. Best of luck.
Dynamic Internal table - ABAP Development - SCN Wiki
Regards,
Saurabh
2014 Nov 13 10:49 AM
Tim,
check some of the standard methods are function modules from SAP like Function module GUI_DOWNLOAD with DATA_TAB parameter
Thanks
Venkat