Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

loop inside loop with fieldsymbols

0 Kudos

in my logic field symnol data is not mapping correctly .

field symbols overwriting with new values.

please provide me solution .


SELECT * from  z30lo_t001w

     INTO CORRESPONDING FIELDS OF TABLE  lt_tkey.

   if lt_tkey is not INITIAL.

     LOOP at lt_tkey ASSIGNING <ls_key>.

        <ls_key>-STORE_INTERNAL_ID <ls_key>-werks.

** update  internal store id

      LOOP AT <ls_ref> ASSIGNING  <ls_ref_line>.

           <ls_key>-STORE_INTERNAL_ID = <ls_ref_line>-store_internal_id .

                ENDLOOP.

     ENDLOOP.



5 REPLIES 5

Former Member
0 Kudos

Hi Sree,

At both the place you are transferring data to <ls_key>-STORE_INTERNAL_ID , that's why it is overwriting with new values

Regards,

Ashish

0 Kudos

Hi Asish

thanks for reply

now i changed to below logic , but still updating on last record  for records in lt_key

if lt_tkey is not INITIAL.

     LOOP at lt_tkey ASSIGNING <ls_key>.

** update  internal store id

      LOOP AT <ls_ref> ASSIGNING  <ls_ref_line>.

           <ls_key>-STORE_INTERNAL_ID = <ls_ref_line>-store_internal_id .

                ENDLOOP.

     ENDLOOP.


raymond_giuseppi
Active Contributor
0 Kudos

What are you trying to do, there is no where clause in the second loop, so the last execution of loop will overwrite any previous value. it_tkey  will always contain value of last record of <ls_ref> ???

Regards,

Raymond

0 Kudos

no common fields  in two internal tables ?

0 Kudos

Hi Sree,

If there is no common field in 2 tables then there is no meaning of loop inside loop.

Please explain what is expected output.

As data is getting assigned inside loop field <ls_key>-STORE_INTERNAL_ID will be always gets updated with last value.

Regards,

Ashish