Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Field symbol as import parameter in class method ???

0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

Former Member
0 Kudos

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