‎2005 Sep 04 4:56 PM
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
‎2005 Sep 04 5:06 PM
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
‎2005 Sep 04 5:06 PM
Hi,
i´m not sure if i got it right but try with:
finalaccitab[] = accitab[].
Best regards.
‎2005 Sep 04 5:06 PM
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
‎2005 Sep 04 5:29 PM
Thank you Srinivas, It really helped. I shall award the points to you.
‎2005 Sep 04 5:36 PM
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