05-18-2006 3:34 PM
Hi,
I am using 'Assign Component' to pass values between 2 dynamically created tables. However it seems the subroutine where this is occuring is taking long to run.
Is ASSIGN COMPONENT abc of STRUCTURE .... statement Performance intensive ?
Thanks
05-18-2006 4:16 PM
05-18-2006 4:16 PM
05-18-2006 4:19 PM
Thanks. The component to assign is inside a Loop.
Loop at itab
Assign Component itab-comp of structure struc..
Endloop.
itab has the name of the components (fields) of the structure.
05-18-2006 4:23 PM
05-18-2006 4:27 PM
if you can give the complete code between LOOP and ENDLOOP we could see if optimization is possible...
05-18-2006 7:20 PM
Hi Francois... Here is the code
Loop at <it_select_tab> assigning <ls_select_tab>.
INSERT INITIAL LINE INTO <it_select_global> index cnt assigning
<ls_select_global>.
Loop at ifc_local into xfc.
assign component xfc-fieldname of structure <ls_select_tab> to
<ls_select_field>.
read table itg_map into itl_map with key
zsyst = lv_syst
zmapfield = xfc-fieldname
binary search.
if sy-subrc = 0.
assign component itl_map-fieldname of structure
<ls_select_global> to
<ls_select_global_field>.
<ls_select_global_field> = <ls_select_field>.
endif.
Endloop.
Unassign: <ls_select_field>,
<ls_select_global_field>.
Endloop.
05-24-2006 1:34 PM
OK in this case you cannot do it else, but you should try to remove nested loops. For example, why don't you do the loop directly on itg_map in place of xfc ?
but anyway beware your UNASSIGN statements are not placed well, they should be placed like this:
Loop at ifc_local into xfc.
assign component xfc-fieldname of structure <ls_select_tab> to
<ls_select_field>.
read table itg_map into itl_map with key
zsyst = lv_syst
zmapfield = xfc-fieldname
binary search.
if sy-subrc = 0.
assign component itl_map-fieldname of structure
<ls_select_global> to
<ls_select_global_field>.
<ls_select_global_field> = <ls_select_field>.
UNASSIGN <ls_select_global_field>.
endif.
UNASSIGN <ls_select_field>.
Endloop.
Endloop.
05-30-2006 8:37 PM