‎2009 May 04 8:28 AM
How can I retrieve a dynamic table (empty though) from a method if the structure of the dynamic table depends on the import parameters?
E.g.:
CALL METHOD zcl_aansl_util=>create_itab_connection
EXPORTING
i_name = 'FRUIT' " e.g. FRUIT or VEGETABLES and so on.
IMPORTING
e_dyn = lt_dyn_table. " dynamically built table which differs for each callSo, in case of 'FRUIT' I want a certain dynamic table structure which would be different when I pass 'VEGETABLES'. The method already creates the dynamic table without any problems, the only challenge lies in PASSING the dynamic table. The dyn table should be/is empty.
If I would be able to predict how the dynamic table would look like, there would be no problem. The point is, that the structure differs for each call. I browse at SDN and I didn't found any solution, I did find posts about how to create a dyn table and so on... but that is not the problem. One suggestion I was thinking of, is to pass a string (with table information).
‎2009 May 04 12:16 PM
Problem solved.
I left out 1 line of code within my method (the assigning part).
So:
CALL METHOD zcl_aansl_util=>create_itab_connection
EXPORTING
i_name = 'FRUIT' " Just as an example
IMPORTING
et_newtable = lt_newtable. " .... = TYPE REF TO data.
ASSIGN lt_newtable->* TO <fs_collection>. "This part I put outside the method...