Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

For all entries sorting problem

I have a problem  sorting data when for all entries is used

for example i got it_pernr like this

row  pernr

1      5

2      2

3       8

Then i got the selection

SELECT pernr test_column

       FROM test_table INTO CORRESPONDING FIELDS OF TABLE it_test_table

       FOR ALL ENTRIES IN it_pernr

           WHERE pernr = it_pernr-pernr

            AND begda <= sy-datum

            AND endda >= sy-datum.

After selection i got table it_test table like this :

row    pernr    test_column

1         2          test2

2         8           test8

3         5          test5

So my question is how can I sort it like this ( like in it_pernr):

row    pernr    test_column

1         5          test5

2         2          test2

3         8          test8

Thanks in advance

Former Member

1. Create one more table with same structure as it_test say it_test1

2. Loop over the table  it_pernr

  Read it_test into w_test with key  it_pernr-pernr

   If sy-subrc = 0

append w_test  to it_test1.



3. clear it_test[].

4. it_test[] = it_test1[].

1 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question