2018 Jul 19 10:14 PM
Hi Gurus,
SAP enhancement has method parameter as TYPE ANY in Changing, by passing program it passed as a internal table but in that method as its TYPE ANY I am not able to use that as internal table, please suggest how we can do that??
2018 Jul 20 5:11 AM
I think you can do it this way:
DATA i_ref_tab TYPE REF TO DATA.
FIELD-SYMBOLS <itab> TYPE STANDARD TABLE.
CREATE DATA i_ref_tab LIKE input_tab[].
ASSIGN i_ref_tab->* to <itab>.
2018 Jul 20 7:13 AM
Assign it to a Field Symbol of your required data type and use that as usual.
2018 Jul 20 12:16 PM
1. If the type TY_ITAB of your table is known to you statically at compile time, just convert the parameter PARAM with a standard conversion:
DATA(itab) = CONV ty_itab( param ).
Note that if the table is large, this can have performance issues as you are potentially copying PARAM. To avoid this, you can also use a field symbol of the type instead:
FIELD-SYMBOLS <itab> TYPE ty_itab.
ASSIGN param TO <itab>.
2. If the type of the table is not known at compile time, use a generically typed field symbol
FIELD-SYMBOLS <itab> TYPE TABLE.
ASSIGN param TO <itab>.
Now, ITAB resp. <ITAB> are variables of table type accepted by LOOP AT and other table manipulation statements.