Skip to Content
avatar image
Former Member

pick specific record from internal table

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 20, 2017 at 01:33 PM


    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.


    Add comment
    10|10000 characters needed characters exceeded

  • Jan 20, 2017 at 01: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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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,

  • Jan 20, 2017 at 02: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  

    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.

    Add comment
    10|10000 characters needed characters exceeded