01-20-2017 1:24 PM
I need to pick the highlighted records to get some data and append it under the highlighted records also, how it is be performed inside loop ?!
01-20-2017 1:33 PM
Could you explain a bit more about what exactly you are trying to do? Also, including some code would help as well. I think I see what you are trying to do but not assuming.
01-21-2017 12:26 AM
In t-code: VA05 sales orders are been displayed I want to create an enhancement to get new data and append it under each sales orders and its items, the image above clarify the data in the internal table that's passed to ALV to be displayed ( no problem with duplication), when tha sales ordes have to line items I want to pick the second one to fetch data with vblen and posnr and append the new lines below it,
01-20-2017 1:33 PM
Hamdy,
itab_temp[] = itab[].
Sort itab_temp by vbeln posnr.
delete adjacent duplicates from itab_temp comparing vbeln posnr.
Now use these two tables for looping append whatever the data you need to whichever the itab you need.
K.Kiran.
01-20-2017 1:35 PM
01-20-2017 2:15 PM
There seems to be a link to the third field ETENR (schedule line) too. For one delivery it is the ETENR = 1 records and the other ETENR = 2. There is definitely more to this story and having the "whys" and "whats" will definitely help the overall answer. I can write a LOOP statement that will work for this particular case, but won't for the very next piece of data that the original poster comes across.
LOOP AT itab INTO DATA(itab_line) WHERE ( vbeln = '4088' and etenr = '1' )
OR ( vbeln = '4087' and etenr = '2' ).
"Other code
APPEND...
ENDLOOP.
If you are looking to insert a record into the middle of the existing ITAB, I suggest you look at the complete help about internal tables, their types, sorting and keys. You can't quite just add a record at a random position of your choice without appending all the records in the order of your choice to a temporary table and then copy it back to the original table. If you are worried about performance at all, this would be the worst case as far as performance goes. I would suggest a sorted table with a properly declared key.