‎2008 Apr 29 9:16 AM
Hi,
I have a structure Struc1 (Components A,B,C,D).
During my runtime, I add components to this structure and now it has (A,B,C,D, X1,X2) as follows.
DATA:
lr_struc TYPE REF TO cl_abap_structdescr,
lt_comp TYPE cl_abap_structdescr=>component_table.
ls_comp-name = 'X1'.
ls_comp-type ?= cl_abap_structdescr=>describe_by_name( 'OBJID' ).
APPEND ls_comp TO lt_comp.
ls_comp-name = 'X2'.
ls_comp-type ?= cl_abap_structdescr=>describe_by_name( 'OBJID' ).
APPEND ls_comp TO lt_comp.
Now I have the following to populate the data.
DATA: ls_struc1 type Struc1. "Defined above
Field-symbols: <Ls_data> type any.
MOVE CORRESPONDING ls_struc1 TO <ls_data>.
now the fields A,B,C,D are populated for <ls_data>.
But how do I do the same for fields X1 and X2. I see them as fields for <ls_data> in the runtime, but not sure how to populate that.
(ie., how to get <ls_data>-X1 and <ls_data>-X2. )
Can someone help me?
Regards,
Shalini.
‎2008 Apr 29 9:23 AM
hi
u can use like this
FIELD-SYMBOLS: <eval_wa> TYPE pay_eval_period.
DATA: l_eval_tab TYPE pay_t_eval_period.
LOOP AT l_eval_tab ASSIGNING <eval_wa>.
‎2008 Apr 29 9:25 AM
Hi,
Thanks for the reply.
I need to populate a structure of type ANY ie., <ls_data>.
Thanks,
Shalini.
‎2008 Apr 29 9:41 AM
Hi,
Try to use the following syntax:
Field-symbols: <fs> type any.
DO.
Assign component sy-index of structure <ls_data> to <fs>.
if sy-subrc = 0.
<fs> = 'value to be populated'.
else.
exit.
endif.
ENDDO.