Application Development and Automation 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: 
Read only

loop inside loop with fieldsymbols

0 Likes
1,013

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
Read only

Former Member
0 Likes
969

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

Read only

0 Likes
969

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.


Read only

RaymondGiuseppi
Active Contributor
0 Likes
969

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

Read only

0 Likes
969

no common fields  in two internal tables ?

Read only

0 Likes
969

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