05-27-2015 3:57 PM
Hi,
I have an issue on
FIELD-SYMBOLS :
<itab> TYPE ANY TABLE ,
<wa> TYPE ANY,
I am facing assign error.
How to append values into internal table from WA using field symbols.??
05-27-2015 4:05 PM
APPEND INITIAL LINE TO <ITAB> assigning <wa>.
<wa>-field1 = value1.
<wa>-field2 = value2.
05-27-2015 4:07 PM
Hi jay,
I have declared ITAB as type ANY so the above statement will give error.
Thanks
VIjay
05-27-2015 5:52 PM
This worked for me:
FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
<wa> TYPE any.
APPEND INITIAL LINE TO <itab> ASSIGNING <wa>.
05-27-2015 6:07 PM
Hi Vijay,
Field symbols are symbolic names for existing data objects, so you must have an internal table assigned to <itab>, for example:
DATA: lt_ekko TYPE STANDARD TABLE OF ekko,
lt_ekpo TYPE STANDARD TABLE OF ekpo.
FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE.
DO 2 TIMES.
CASE SY-INDEX.
WHEN 1.
ASSIGN lt_ekko TO <itab>.
WHEN 2.
UNASSIGN <itab>.
ASSIGN lt_ekpo TO <itab>.
ENDCASE.
ENDDO.
Please, Let me know if i was helpful.
Regards,
Sandro Ramos
05-27-2015 6:39 PM
HI Vijay ,
Field symbols are nothing but pointers .
Further if you have declared it as type any table , it is important that you first assign a type to it .
and you assign the type to field symbol at design time or at run time .
e.g. For run time , below is the sample code
data : lv_type_name type char4 value 'MARA'.
data : lo_ref type data .
field-symbols : <lt_table> type any table,
<ls_data> type any .
create data lo_ref type standard table of ( lv_type ).
assign lo_ref->* to <lt_table> .""once u do this <lt_table> has type assigned
append initial line to <lt_table> assigning <ls_data>.
Hope this solves your issue.
Best Regards,
Rini