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: 

Sort Sequence

Former Member
0 Kudos

Hi,

I have defined an internal table for Production order operation sequence as :

DATA : BEGIN OF SORT_SEQ OCCURS 0,

APLFL TYPE AFVGD-APLFL,

VORNR TYPE AFVC-VORNR,

COUNTER(10) TYPE C, APLZL TYPE AFVGD-APLZL,

END OF SORT_SEQ.

I am getting data populated as

SEQ. OPERATION Sort 1 Sort 2

0 0010 100000001 00000001

0 0020 100000002 00000002

1 0020 100000004 00000006

1 0030 100000004 00000007

0 0030 100000003 00000003

0 0040 100000004 00000004

0 0050 100000005 00000005

I want sort sequenceas :

SEQ. OPERATION Sort 1 Sort 2

0 0010 100000001 00000001

0 0020 100000002 00000002

0 0030 100000003 00000003

0 0040 100000004 00000004

1 0020 100000004 00000006

1 0030 100000004 00000007

0 0050 100000005 00000005

any help in this regard will be highly appreciated.

Regards,

Lanka

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Sort your table like so.

sort sort_seq ascending by COUNTER APLZL.

Regards,

RIch Heilman

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Sort your table like so.

sort sort_seq ascending by COUNTER APLZL.

Regards,

RIch Heilman

former_member188685
Active Contributor
0 Kudos

Hi,

sort sort_seq by sort1 sort2.

Regards

vijay

FredericGirod
Active Contributor
0 Kudos

Hi,

Just make a sort table sort_seq by counter vornr ...

Rgd

Frédéric

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

duplicate

Regards,

RIch Heilman

Former Member
0 Kudos

Hi,

Use sort as

Sort SORT_SEQ by Sort1 Sort2 operation SEQ

Regards,

GSR.

0 Kudos

Hi All,

Thanks for yor responses. I have tried all type of sort sequences . No luck . I have changed my program logic with a different approach.

Regards,

Lanka

Former Member
0 Kudos

Hi,

Can you have the first 2 fields in your internal table as Sort1 & Sort2 heading,so that the SORT statement would work.

Former Member
0 Kudos

In order to have it sorted in your format, both the last fields should be declared as first fields in other temporary int. table and sort. Then move it to the main int. table back.