Skip to Content
author's profile photo Former Member
Former Member

Modify internalt table by line index

I need to implement a logic where i want to change the line index of a dataset in an internal table.

for example dataset with line index 5 should be moved up to line index 1.

is there any kind of abap statement which does such things for me or do i need to implement that by myself?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2004 at 09:07 AM

    Hi,

    Can u post ur question more clearly, if u want to delete the above four rows, u can do that using sy-tabix.

    regards,

    Bharath.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2004 at 09:31 AM

    Can u explain me the scenario, why u need to change the order of rows in a table, as for as concerned to me it does;nt make any sense changing the order of rows.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Regardless there may be times when you need to do such a thing. The way to do it is with logic as follows. There is no syntax for moving table rows.

      DATA:
        tab  TYPE STANDARD TABLE OF sometype.
        line LIKE LINE OF tab.
      
      READ TABLE tab INTO line INDEX 5.
      DELETE tab INDEX 5.
      INSERT line INTO tab INDEX 1.
      

      This logic will only with standard internal tables, not sorted or hashed.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.