Skip to Content
-2

pick specific record from internal table

Jan 20, 2017 at 01:24 PM

147

avatar image

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

va05-ink-li.jpg (893.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Kiran K Jan 20, 2017 at 01:33 PM
-1

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Christopher Solomon
Jan 20, 2017 at 01:33 PM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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,

0
Raghu Govindarajan Jan 20, 2017 at 02:15 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded