2010 Nov 17 7:42 AM
Hi All
I have a problem with assign component
its working and when subrc = 0 it moves the value to the right
field but the problem is the in the second time (subrc = 0.)
its overite the field with wrong value
what i miss here ? i want to assign the right fiels value
to the suitable field in <ls_attr_structure>
LOOP AT it_mapping INTO ls_mapping.
ASSIGN COMPONENT ls_mapping-target_field OF STRUCTURE <ls_attr_structure>
TO <lv_root_attr>.
IF sy-subrc = 0.
<ls_attr_structure> = ls_mapping-field_value.
ENDIF.
ENDLOOP.
All the structure and field are type any .
Regards
Alex
Edited by: Alex Dean on Nov 17, 2010 8:43 AM
2010 Nov 17 7:48 AM
You are assigning value to whole structure
<ls_attr_structure> = ls_mapping-field_value.
and should be only to component
<lv_root_attr> = ls_mapping-field_value.
Regards
Marcin
2010 Nov 17 7:48 AM
You are assigning value to whole structure
<ls_attr_structure> = ls_mapping-field_value.
and should be only to component
<lv_root_attr> = ls_mapping-field_value.
Regards
Marcin
2010 Nov 17 7:52 AM
Hi,
First time it will work fine but second time you are using the same field symbol which is holding the Previous entry. So after you check SY-SUBRC store the value some where else (Append to an internal table) then use the field symbol.
You are using the same field symbol for eack record in the LOOP and not saving that entry to any of the global variable.
Please try to save the Field symbol values to an internal table and do the coding accordingly.
Regards,
Srinivas