cancel
Showing results for 
Search instead for 
Did you mean: 

Modify internalt table by line index

Former Member
0 Kudos

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?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

Former Member
0 Kudos

hm your last posting really helped me to think in the right direction.

what i really wanted to do is to change the order of my datasets which i need later on and which i'm allready saving in a seperate column of my internal table.

so my posting was totally nonsense. sorry for that

thanks for your help anyway

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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