Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting Internal Table

Former Member
0 Kudos

How to sort an internal table in this format (1 2 3 4 ....) ? Dose it has to follow an append statement ?

Because when I used -


> SORT ITAB DESCENDING BY NUMBER. I'm getting this format (1 2 3 5 4 1).

please help.

4 REPLIES 4

Former Member
0 Kudos

it's finer i think last 1 show the header value just check it.

anversha_s
Active Contributor
0 Kudos

hi,

clear ur header (work area).

then sort.

regards

anver

Former Member
0 Kudos

i m not clear abt ur requiremtn..

wht u can do is u can dd a seqno field to ur itab and then sort ur itab by this field in asc or descending order--

data: begin of itab occurs 0,

seqno(1) type c,

pernr like pa0006-pernr,

data end of itab.

select pernr from pa0006 up to 10 rows into corresponding fields of itab.

loop at itab.

itab-seqno = sy-tabix.

modify itab index sy-tabix.

endloop.

sort itab descending by seqno.

loop at itab.

write:/ itab.

endloop.

Former Member
0 Kudos

Hi,

When you specify

SORT ITAB BY NUMBER.

It will sort no append statement is needed.