‎2013 Mar 05 5:33 AM
Hi Experts,
In a global class method i have a parameter cs_data type ref to data. At the run time I am getting some value in this work area.
Now my requirement is to call another method which will receive this cs_data in one internal table.
So how to make that internal table from cs_data?
Thanks and Regards,
Ajeet
‎2013 Mar 05 7:34 AM
Hi,
Try this:
DATA lt_data LIKE TABLE OF cs_data.
APPEND cs_data TO lt_data.
method_that_need_table( it_table = lt_data ). " call your method here
Regards
Adam
‎2013 Mar 05 7:34 AM
Hi,
Try this:
DATA lt_data LIKE TABLE OF cs_data.
APPEND cs_data TO lt_data.
method_that_need_table( it_table = lt_data ). " call your method here
Regards
Adam
‎2013 Mar 05 7:41 AM
Hi Adam,
I am getting below error while doing so.
The field "CS_DATA" specified under LIKE either has no type or a generic type.
In parameter list cs_data has been declared as CS_DATA Changing Type DATA.
Regards,
Ajeet
‎2013 Mar 05 1:25 PM
Hi Ajeet,
Ok I thought you are just saying about data example. In case of generic data type, solution is more complicated. Try this:
FIELD-symbols <fs_table> type standard table.
DATA l_ref TYPE REF TO data.
CREATE DATA l_ref like table of cs_data.
ASSIGN l_ref->* to <fs_table>.
APPEND cs_data TO <fs_table>.
Then your <fs_table> is a table that contains single row.
Hope it helps.
Regards
Adam
‎2013 Mar 06 3:37 AM
Thanks Adam,
It's working according to my requirement.
Thanks and Regards,
Ajeet Pratap Singh