12-13-2011 5:46 AM
i have used a char field length 10 in my ztable as gate pass no.
also created a module pool which generates gate pass no.
commands used.
select max(gatepass no) from ztable into var.
it select 9 as max however maximum gate pass no currently present in ztable is 10.
also when i sort my ztable in ascending:
it sorts like this:
1
10
2
3
4
5
6
7
8
9.
instead if i use numeric in case of char then gate pass no generates like this 0000000009. after condense statement.
suggest some solution.
12-13-2011 8:08 AM
Hi Abhishek,
This is happening because you haven't used any conversion routines while inserting records into your table. What this means is that wherever you are Inserting/updating/modifying your table, you need to use the FM 'CONVERSION_EXIT_ALPHA_INPUT' and then insert records. What happens with this is the number 1 in character is saved as '0000000001' and 10 in character mode is saved as '0000000010'. Now, if your use your select max or sort, then, it will work as you need it.
Hope this helps. For further clarity post the issues.
Regards,
Pranav.
12-13-2011 5:54 AM
Hi,
First take data element for the field as KUNNR and try, then also you are not getting then use MAX( [DISTINCT] col )
12-13-2011 8:08 AM
Hi Abhishek,
This is happening because you haven't used any conversion routines while inserting records into your table. What this means is that wherever you are Inserting/updating/modifying your table, you need to use the FM 'CONVERSION_EXIT_ALPHA_INPUT' and then insert records. What happens with this is the number 1 in character is saved as '0000000001' and 10 in character mode is saved as '0000000010'. Now, if your use your select max or sort, then, it will work as you need it.
Hope this helps. For further clarity post the issues.
Regards,
Pranav.
12-14-2011 9:09 AM
problem still not resolved:
its converting char 10 into '0000000010'. but when i insert this into char field of my ztable. and then check entries in ztable.
it is still showing 10 instead of '0000000010'.
therefore the problem still persists as it was before.
on executing select max(gate pass no) it is still fetching max as 9 instead of 10.
suggest soem solution man!
12-14-2011 9:32 AM
Hi,
Solution has been provided: use numeric fields in your ztable...
Kr,
Manu.
12-15-2011 10:46 AM
Change the type of the field from Char to numeric, it will solve problem
12-16-2011 11:09 AM
Dear Abhishek,
You have 2 options,
1. As suggested, you can convert the data type of the field into numeric. If not feasible, then,
2. As suggested earlier about using the Conversion Routine and you still facing the error, I'll explain you by an example. If you refer the Table "VBAK" and field "VBELN", the domain "VBELN" has a conversion routine "ALPHA". If you sort data in "VBAK" or try to the get max., it works as you need.
For further queries, do post.
Regards,
Pranav.
12-13-2011 9:55 AM
Hi Abhishek,
Please keep conversion routine as ALPHA to the domain attached to the data element of gatepass no field and check once.
Regards,
Arun
12-13-2011 10:06 AM
Dear abhishek,
convert your field to numc data type.
your problem will be solved without any other alteration.
let me know the status
- avirat
12-14-2011 6:15 AM
As said use a numeric field because you will face such problem like me in future
12-15-2011 10:31 AM
Hello friend,
Just try to move the z table into a internal table and process it i think it will work bec see my example scenario which i worked and got the output.
data : x_char(10) TYPE c.
data : t_char like TABLE OF x_char.
x_char = 1.
append x_char to t_char.
x_char = 2.
append x_char to t_char.
x_char = 3.
append x_char to t_char.
x_char = 4.
append x_char to t_char.
x_char = 5.
append x_char to t_char.
x_char = 6.
append x_char to t_char.
x_char = 7.
append x_char to t_char.
x_char = 8.
append x_char to t_char.
x_char = 9.
append x_char to t_char.
x_char = 10.
append x_char to t_char.
sort t_char ASCENDING.
Its correctly displaying. Please try this.
Thanks,
Sri Hari