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

pick specific record from internal table

0 Likes
1,805

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 ?!

5 REPLIES 5
Read only

ChrisSolomon
Active Contributor
0 Likes
1,593

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.

Read only

0 Likes
1,593

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,

Read only

kiran_k8
Active Contributor
0 Likes
1,593

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.

Read only

0 Likes
1,593

I don't think that is what he is trying to do.

Read only

raghug
Active Contributor
0 Likes
1,593

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.