Skip to Content

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

How to sort an Internal table Based on a One Char Trans type in the rec?

Meaning, ascending descending will not work, lets say itab_A has the order O-H-W-G-I-A, and I want it to write it to itab_B to the correct order, G-H-O-I-A-W.

I know I can do loop at itab_A where for each one and write it, but is their a better way?

Thank-You

Tags:
Former Member
Former Member replied

if you know the correct order play with index in the itab_A and append to itab_B

loop at itab_A index X.
blah.. blah..
endloop.

or

itab_temp [] =  itab_A[].
delete itab_temp where index <> 'X'.
append itab_temp to itab_B.
refresh itab_temp[].

itab_temp [] =  itab_A[].
delete itab_temp where index <> 'Y'.
append lines of  itab_temp to itab_B.
refresh itab_temp[].

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