Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

    • Former Member

      no i don't want do delete or replace any rows i want do change the order of the rows.

      Message was edited by: Tobias Schleich

  • avatar image
    Former Member
    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 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.