12-06-2011 3:58 PM
Hi everyone,
is it possible to pass a field symbol as an import parameter to a method in a class? If yes, how do I define the data type of the import parameter? I'm trying to work with field symbols as the program doesn't know what kind of structure the program parameter p_srcdso has. Coding example would be something like this:
PARAMETERS: p_srcdso TYPE rsdodsobject DEFAULT '/BIC/AKVI0001'.
DATA: lr_srcpkg TYPE REF TO data.
FIELD-SYMBOLS: <fs_table> TYPE ANY TABLE.
CREATE DATA lr_srcpkg TYPE TABLE OF (p_srcdso).
ASSIGN lr_srcpkg->* TO <fs_table>.
SELECT *
FROM (p_srcdso)
INTO TABLE <fs_table>.
CALL METHOD cl_ref->create_somethign
EXPORTING
i_source_package = <fs_table>.
Thanks,
Alex
12-06-2011 4:15 PM
Hi,
You can use the generic type "ANY TABLE" in your case...
or pass a data reference instead and dereference it within the method.
Kr,
Manu.
Edited by: Manu D'Haeyer on Dec 6, 2011 5:16 PM
12-06-2011 4:15 PM
Hi,
You can use the generic type "ANY TABLE" in your case...
or pass a data reference instead and dereference it within the method.
Kr,
Manu.
Edited by: Manu D'Haeyer on Dec 6, 2011 5:16 PM
12-11-2011 2:55 PM
Halo Alexander,
You can use TYPE REF TO DATA( say the parameter name is i_data) as the importing parameter of the method create_somethign and inside the method you need to dereference it using data reference variable again.
data: dref type ref to data.
field-symbols: <fs_table> type table.
create data dref like i_data.
assign dref->* to <fs_table>.
Regards
Arshad