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

SORT statement is not working!

vinod_vemuru2
Active Contributor
0 Likes
6,494

Hi frdz,

Below SORT statement is not working. Can any one explain me why this is happening.

SORT i_bseg ASCENDING BY belnr bukrs

DESCENDING kunnr.

I have table content as below.

BELNR BUKRS KUNNR

0016000000|CROP |

0016000000|CROP |0008910168

Before and after the sort content order is same.

I want to sort the content like below.

0016000000|CROP |0008910168

0016000000|CROP |

Is there any thing wrong with the sort statement???

i_bseg is defined as TYPE STANDARD TABLE OF

Sort criteria must not change i. e ascending by belnr and bukrs and descending by kunnr.

Thanks,

Vinod.

1 ACCEPTED SOLUTION
Read only

valter_oliveira
Active Contributor
2,518

Hello.

Try:


SORT i_bseg BY belnr bukrs kunnr DESCENDING.

Default is ASCENDING. What I worte is similar to SORT i_bseg BY belnr ASCENDING bukrs ASCENDING kunnr DESCENDING.

Regards,

Valter Oliveira.

2 REPLIES 2
Read only

valter_oliveira
Active Contributor
2,519

Hello.

Try:


SORT i_bseg BY belnr bukrs kunnr DESCENDING.

Default is ASCENDING. What I worte is similar to SORT i_bseg BY belnr ASCENDING bukrs ASCENDING kunnr DESCENDING.

Regards,

Valter Oliveira.

Read only

peter_ruiz2
Active Contributor
0 Likes
2,518

hi vinod,

this is because on your statement, you are sorting BUKRS in descending order and KUNNR in ASCENDING order.

please take note that the sort order should come after the sorted field. if no order is given, the default which is ASCENDING will be used.

do your sorting like this

SORT i_bseg BY belnr bukrs kunnr DESCENDING.

regards,

Peter