cancel
Showing results for 
Search instead for 
Did you mean: 

sort internal table descending not working

vieet
Explorer
0 Kudos

I am facing strange scenario where sort is not working.

I have tried to use stable also still no luck. 

BEFORE SORT :

vieet_0-1713776680398.png

THIS IS THE CODE

vieet_1-1713776797330.png

With the above code 22100 should be at top. but it is taking second place.

vieet_2-1713776870298.png

Please someone help me what is going on . why it is not  placing bigger number 22100 on top ?

 

 

View Entire Topic
Edrilan_Berisha
Product and Topic Expert
Product and Topic Expert

Hi,

 

SORT will basically work different, when you sort on a field which has a character data type. In your example, you have a character of length 10. Everything which is not fully used, will be added up with zeros in the end. Which will of course then put 9180 on top as it fills up the other spaces with zeros so '918000000'.

Either you enter the leading zeroes on front, or it won't work unless you change the data type of that field to numc for instance or an integer type.

 

Best,

Edrilan Berisha

SAP S/4HANA Cloud Financials Development