2006 Nov 27 4:19 PM
Hello,
my first post..
I'am beginner ABAP, so I'am stil learning..
I have a char that it's supose to be a number en be sorted!
data: tmp_line-tdline TYPE tline-tdline,
tmp_line-tdline = 1.079
tmp_line-tdline = 10.400
tmp_line-tdline = 7.028
tmp_line-tdline = 10.700
tmp_line-tdline = 10.800
tmp_line-tdline = 10.700
it_table-tdline = tmp_line-tdline.
enz..
when I sort my it_table by tdline:
I get this in my output:
1.000
10.400
10.700
10.700
10.800
7.028
I should be:
1.000
7.028
10.400
10.700
10.700
10.800
Can someone help me?
Adibo..
Hello,
my first post..
I'am beginner ABAP, so I'am stil learning..
I have a char that it's supose to be a number en be sorted!
data: tmp_line-tdline TYPE tline-tdline,
tmp_line-tdline = 1.079
tmp_line-tdline = 10.400
tmp_line-tdline = 7.028
tmp_line-tdline = 10.700
tmp_line-tdline = 10.800
tmp_line-tdline = 10.700
it_table-tdline = tmp_line-tdline.
enz..
when I sort my it_table by tdline:
I get this in my output:
1.000
10.400
10.700
10.700
10.800
7.028
I should be:
1.000
7.028
10.400
10.700
10.700
10.800
Can someone help me?
Adibo..
2006 Nov 27 4:22 PM
If you declare that as a CHAR that is the problem.
If you can declare it as P or F then it should be sorting fine.
Regards,
Ravi
Note - Please mark all the helpful answers
2006 Nov 27 4:22 PM
HI,
MOve the contents into a type p variable and then sort it.
data: tmp_line-tdline1(20) TYPE p decimals 3,
tmp_line-tdline1 = 1.079
tmp_line-tdline1 = 10.400
tmp_line-tdline1 = 7.028
tmp_line-tdline1 = 10.700
tmp_line-tdline1 = 10.800
tmp_line-tdline1 = 10.700
Regards,
ravi
2006 Nov 27 4:22 PM
2006 Nov 27 4:36 PM
data dictionary: tline-tdline is declared as char..
this is some text, something like this: (transaction me59n)
10.345 raised floor YES
or
3 raised floor NO
or
7.647 raised floor YES
or
1.079 raised floor YES
so they want to se only the number en to be sorted by that number..
2006 Nov 27 4:58 PM
chk out this
after sorting again u can remove leading zeroes
REPORT YCHATEST .
data : begin of itab occurs 0,
houseno(10),
end of itab.
itab-houseno = '24'.
append itab.
clear itab.
itab-houseno = '4'.
append itab.
clear itab.
itab-houseno = '454'.
append itab.
clear itab.
loop at itab.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = itab-houseno
IMPORTING
OUTPUT = itab-houseno
.
modify itab index sy-tabix.
endloop.
sort itab by houseno.
loop at itab.
write : / itab-houseno.
endloop.
loop at itab.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = itab-houseno
IMPORTING
OUTPUT = itab-houseno
.
modify itab index sy-tabix.
endloop.
loop at itab.
write : / itab-houseno.
endloop.
2006 Nov 28 9:15 AM
Doesn't work, some number have a dot (.)..
Maybe I can split on dot (.)
10.345
should be:
10
.
345
Then i put these number in an it_table and then sort by first col..?
but this doesn work:
it_output-tdline = 10.345
SEARCH '.' FOR it_output-tdline.
IF sy-subrc = 0.
SPLIT line-tdline AT '.' INTO tmp_line-tdline tmp_line-tdline1.
it_output-tdline =tmp_line-tdline
it_output-tddot = '.'
it_output-tdline1 =tmp_line-tdline1
ENDIF.
sy-subrc is always 4 ??
Adibo.
2006 Dec 13 9:38 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |