Application Development and Automation 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: 
Read only

Sorting Internal Table

Former Member
0 Likes
685

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
Read only

Former Member
0 Likes
633

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

Read only

anversha_s
Active Contributor
0 Likes
633

hi,

clear ur header (work area).

then sort.

regards

anver

Read only

Former Member
0 Likes
633

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.

Read only

Former Member
0 Likes
633

Hi,

When you specify

SORT ITAB BY NUMBER.

It will sort no append statement is needed.