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

Same reference for 2 field symbols

tglowka
Discoverer
0 Likes
1,676

Hi,

How can I assign table record into 2 different field symbols in a loop?

I am planning to loop over table and keep reference to the 1st record of the group, so at the end of group I can change the 1st record. Something like:

LOOP AT itab ASSIGNING <fs>.
AT NEW plant.
"store reference of <fs> to <fs_ref>.
ENDAT.
ADD 1 TO lv_counter.
AT LAST.
<fs_ref>-counter = lv_counter.
ENDAT.
ENDLOOP.
1 ACCEPTED SOLUTION
Read only

sergei-u-niq
Active Contributor
1,581

using ABAP ASSIGN statement, you can assign one field symbol to “point” to the same data another field symbol is “pointing to”
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapassign.htm

Hi,

How can I assign table record into 2 different field symbols in a loop?

I am planning to loop over table and keep reference to the 1st record of the group, so at the end of group I can change the 1st record. Something like:

LOOP AT itab ASSIGNING <fs>.
AT NEW plant.
"store reference of <fs> to <fs_ref>.
ENDAT.
ADD 1 TO lv_counter.
AT LAST.
<fs_ref>-counter = lv_counter.
ENDAT.
ENDLOOP.
2 REPLIES 2
Read only

sergei-u-niq
Active Contributor
1,582

using ABAP ASSIGN statement, you can assign one field symbol to “point” to the same data another field symbol is “pointing to”
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapassign.htm

Read only

1,581
tglowka

so, something like this (to do only for the 1st record of the group):

ASSIGN <fs> TO <fs_ref>.