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 internal table descending

Former Member
0 Kudos

Hi Gurus,

I have a internal table's structure as shown below:-

ITAB

E_OBJNR

E_POSIT

S_GJAHR

S_GNJHR

E_GNJHR

E_GES

........

.......

Row E_OBJNR E_POSIT S_GJAHR S_GNJHR E_GNJHR E_GES

1 PR00108320 0 0 0 0 X

2 PR00108331 0 0 0 0 X

3 PR00108330 0 0 0 0 X

4 PR00108325 0 0 0 0 X

5 PR00108321 0 0 0 0 X

6 PR00108324 0 0 0 0 X

7 PR00108323 0 0 0 0 X

8 PR00108326 0 0 0 0 X

9 PR00108327 0 0 0 0 X

10 PR00108329 0 0 0 0 X

11 PR00108322 0 0 0 0 X

12 PR00108328 0 0 0 0 X

sort it_bpak by e_ges descending.

after sorting, i get

Row E_OBJNR E_POSIT S_GJAHR S_GNJHR E_GNJHR E_GES

1 PR00108328 0 0 0 0 X

2 PR00108322 0 0 0 0 X

3 PR00108329 0 0 0 0 X

4 PR00108327 0 0 0 0 X

5 PR00108326 0 0 0 0 X

6 PR00108323 0 0 0 0 X

7 PR00108324 0 0 0 0 X

8 PR00108321 0 0 0 0 X

9 PR00108325 0 0 0 0 X

10 PR00108330 0 0 0 0 X

11 PR00108331 0 0 0 0 X

12 PR00108320 0 0 0 0 X

all my rows in field e_ges contains value 'X'.

so how is sorting based on?

Please advice.

Best Regards,

Fung

4 REPLIES 4

Former Member
0 Kudos

hai,

if proper value r there it will sort according to that value,

otherwise it give the reverse value of the existing.

shan.

0 Kudos

Hi Shan,

thanks for your reply.

but all the e_ges contains the same value 'X'.

so how the sorting is based on?

Best Regards,

Fung

Former Member
0 Kudos

Hi, Since the values all same better use OBJNR or other fields for sorting which contains unique value in each row..

Regards,

Jey

0 Kudos

Hi Jey,

Thanks for your reply.

I couldn't use others field for sorting because this is sort in SAP Standard program code.

i need to know which is the sort field since the field 'e_ges' contains same value?

Best Regards,

Fung