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

adding data into itable -urgent

Former Member
0 Likes
675

hi folks,

Need help here...

I have an itab 'accitab' and has a field 'zsortgroup' that has no value in the current table for a given set of records.

I am inserting these data records from accitab into an internaltable 'final_accitab'(structure same as 'accitab') and as I am inserting each record I need to populate the 'zsortgroup' field in this table too with a certain value.

while looping through 'accitab' is there a way I can insert the records at once into 'final_accitab' and poplating the field simultaneously instead of inserting one record at a time.

Thanks

Vinu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
649

If you are filling the same value on all the records then you can do the following:

clear accitab-zsortgroup.

move 'MYCONSTVAL' to accitab-zsortgroup.

modify accitab transporting zsortgroup where zsortgroup is initial.

final_accitab[] = accitab[].

If you are moving different values into this field for different records, then there is no choice but to loop. Alternatively, you can use different 'where' clauses in the 'modify' statement above to set different values for this field based on conditions.

Srinivas

4 REPLIES 4
Read only

former_member182371
Active Contributor
0 Likes
649

Hi,

i´m not sure if i got it right but try with:

finalaccitab[] = accitab[].

Best regards.

Read only

Former Member
0 Likes
650

If you are filling the same value on all the records then you can do the following:

clear accitab-zsortgroup.

move 'MYCONSTVAL' to accitab-zsortgroup.

modify accitab transporting zsortgroup where zsortgroup is initial.

final_accitab[] = accitab[].

If you are moving different values into this field for different records, then there is no choice but to loop. Alternatively, you can use different 'where' clauses in the 'modify' statement above to set different values for this field based on conditions.

Srinivas

Read only

0 Likes
649

Thank you Srinivas, It really helped. I shall award the points to you.

Read only

Former Member
0 Likes
649

Hi Vinu,

There is no keyword in ABAP to copy the internal table as well as change the content at the same time.

Cheers,

Sanjeev