‎2010 Nov 23 6:31 PM
HI All
I doing the following loop and the table it_mapping can be with lot of records
There is a way that i can do the loop for just the relevant field (something that similar to LOOP and Where )
since for instance table ls_mapping can be with 10000 records and in structure <ls_attributes> i have just
2 fields that are the same (the loop run dynamically since <ls_attributes> can be differnt in every run of the program )
LOOP AT it_mapping INTO ls_mapping.
ASSIGN COMPONENT ls_mapping-target_field OF STRUCTURE <ls_attributes>
TO <lo_attr>.
IF sy-subrc = 0.
<lo_attr> = ls_mapping-field_value.
ENDIF.
ENDLOOP.Regards
Alex
‎2010 Nov 23 6:58 PM
Hi
<ls_attributes> can be different, but it_mapping seems to be a normal internal table, so why don't you do:
LOOP AT it_mapping INTO ls_mapping where ......................
Max
‎2010 Nov 23 6:58 PM
Hi
<ls_attributes> can be different, but it_mapping seems to be a normal internal table, so why don't you do:
LOOP AT it_mapping INTO ls_mapping where ......................
Max
‎2010 Nov 23 7:41 PM
HI Max
Since also the table it_mapping is coming with differnt fields and differnt fields values in every run ....
Regards
Alex
Edited by: Alex Dean on Nov 24, 2010 10:45 AM
‎2010 Nov 24 9:52 AM
Hi
Yes I know it
But the structure of it_mapping is constant, probably its values can be different
Max
‎2010 Nov 24 1:02 PM
Hi friend,
here ls_mapping contains fields same fields are available to <ls_attributes> fieldsymbol
then only when pass the value to <lo_attr> then automattically value comes then u can insert into the internal table that must declare as fieldsymbol.
TYPES:BEGIN OF TY_MAPPING,
FLD1 TYPE STRING,
VAL TYPE STRING,
END OF TY_MAPPING.
DATA:LS_MAPPING TYPE TY_MAPPING,
IT_MAPPING TYPE STANDARD TABLE OF TY_MAPPING.
FIELD-SYMBOLS:<LT_ATTRIBUTES> TYPE STANDARD TYPE OF (LS_MAPPING).
ASSIGN LT_ATTRIBUTES ->* <LS_ATTRIBUTES>.
LOOP AT it_mapping INTO ls_mapping.
ASSIGN COMPONENT ls_mapping-target_field OF STRUCTURE <ls_attributes>
TO <lo_attr>.
IF sy-subrc = 0.
<lo_attr> = ls_mapping-field_value.
APPEND <LS_ATTRIBUTES> TO <LT_ATTRIBUTES>.
ENDIF.
ENDLOOP.
I think it will be excuted.
thanks®ards.
murali