‎2009 Sep 18 9:17 AM
Hi,
In my internal table I have 1 field with data type NUMC - 5, it gives me a problem while sorting.
For Ex: my internal data is like this
A - Field
11
12
1
3
4
When I sort internal table by the Field A, it gives
1
11
12
3
4
But we expect
1
3
4
11
12
Pls let me know how to solve this and the feild I use is similar to EBELP field in - EKKO table
regards
Prabhu
‎2009 Sep 18 9:24 AM
Hi,
I suppose you meant EKPO-EBELP.I dint find any problem with sorting a numc type. Check this sample
data: begin of itab occurs 0,
f1 type ekpo-ebeln,
end of itab.
itab-f1 = 11.
append itab.
itab-f1 = 12.
append itab.
itab-f1 = 1.
append itab.
itab-f1 = 3.
append itab.
sort itab.
loop at itab.
write:/ itab-f1.
endloop.
Regards,
Vikranth
‎2009 Sep 18 9:33 AM
Hi,
This type of issue would arise only if the data type of the field is type C, if you use type EKPO-EBELP, then the record will be appended with 0's in the front, i.e, 11 will be 00011,1 will be 00001 and so on. If you sort the table on this field you will get the correct output. I have tried the same ans is working fine for me.
Regards,
Sachin
‎2009 Sep 18 9:36 AM
I am getting the sorted output as follows:
1
3
4
11
12
EKKO does not have EBELP. If you use datatype n and length 5 in declaration, you will get output as
00001
00003
00004
00011
00012
I see no problem in sorting. Can you give code sample of what you have written??
‎2009 Sep 18 10:00 AM
Hi,
I am using a customized structure where I have declared a customized field whose data element is standard - EBELP and I face this issue.
regards
Prabhu
‎2009 Sep 18 10:10 AM
Check this :
DATA: begin of itab occurs 0,
A TYPE EBELP,
end of itab.
itab-A = 11.
append itab.
itab-A = 12.
append itab.
itab-A = 1.
append itab.
itab-A = 3.
append itab.
sort itab.
loop at itab.
write:/ itab-A.
endloop.
‎2009 Sep 18 10:14 AM
Hi Prabhu ,
As per my understanding : It can be due to following reason :
Sort condition considering only first character of your field. You should check your code , by mistake you might have used one char somewhere.
‎2009 Sep 18 10:16 AM
Post the code you are using. There is nothing worng with the sort on the NUMC type. It must be due to some other error
‎2009 Sep 18 10:18 AM
Hi,
After filling the data in Internal table (ITAB).
use :
Sort ITAB by Field_name ascending.
‎2010 Oct 26 9:55 AM
I AM FACING THE SAME ISSUE.
SORTING FOR NUMC FIELD TYPE IS NOT WORKING.
code:-
EBELP TYPE ESSR-EBELP,
EXTROW TYPE ESLL-EXTROW,
SORT INTAB4 BY EBELP EXTROW ASCENDING.
this shows results in :-
10
100
20
30
40
50
kindly advise as to what the problem might be!
Thanks in advance!
‎2016 Apr 18 2:02 PM
Hello,
The solution is to use the funcion :
CONVERSION_EXIT_ALPHA_INPUT'
Regards,
‎2021 Aug 10 2:04 PM
Hi,
Please use INT2 data type for that field, it resolves the sorting issue 🙂
Regards,
Sai Kalyan