‎2008 Jul 13 1:16 PM
Hi ,
i want to add a packed number in the standard selection screen designed by me.i used the below code but i want to restrict the integer value of the packed number to 3 places.
like i should allow to enter values of format XXX.X and only 5 chars
SELECTION-SCREEN BEGIN OF line.
SELECTION-SCREEN COMMENT 1(9) text-012.
parameters: Packed TYPE p decimals 1 modif id sc1 .
SELECTION-SCREEN END OF line.
how to do this..
thanks,
Vinay
‎2008 Jul 13 1:38 PM
Most easiest way is to display the no with 2 decimal places..
SELECTION-SCREEN BEGIN OF line.
SELECTION-SCREEN COMMENT 1(9) text-012.
parameters: Packed(3) TYPE p decimals 2 modif id sc1.
SELECTION-SCREEN END OF line.
If u display 1 decimal place in that case it will display 4 digit in whole no. part.
Regards,
Joy.
‎2008 Jul 13 1:44 PM
Hi Joy,
i tried its throwing the following message..
The parameter name ("PACKED(3)" here) can be up to 8 characters long.
Thanks,
Vinay
‎2008 Jul 13 1:53 PM
Try this:
SELECTION-SCREEN BEGIN OF line.
SELECTION-SCREEN COMMENT 1(9) text-012.
parameters: Packed(3) TYPE p decimals 2 modif id sc1.
SELECTION-SCREEN END OF line.
I gave Packed(3) to make it bold but somehow the editor didnot recognize it..
Regards,
Joy.
Edited by: Joyjit Ghosh on Jul 13, 2008 2:54 PM
‎2008 Jul 13 1:55 PM
hi Joe,
i have already tried this but the length of the input field is not taking what we specify...
the length still its greater than what we specify.
Thanks,
Vinay
‎2008 Jul 13 2:06 PM
Visible length can be more but if u give for ex: 1233.50 and press F8 then it will throw u message like: Entry too long(Pl. enter in the format __~.__V). It can only accept whole no. upto 3 digit and decimal plaves upto 2 places.
Pl. check again...I have already tested it and it is working.
Regards,
Joy.
‎2008 Jul 13 2:11 PM
Hi Joe,
just try entering 1234 its taking as 1234.0 but ourcase it should take 123 if i give 1234 its not giving any message
Thanks,
vinay
‎2008 Jul 13 2:19 PM
For this code:
SELECTION-SCREEN BEGIN OF line.
SELECTION-SCREEN COMMENT 1(9) text-012.
parameters: Packed(3) TYPE p decimals 2 modif id sc1.
SELECTION-SCREEN END OF line.
If I enter 1234 then it is displaying error message....
Regards,
Joy.
‎2008 Jul 13 2:22 PM
‎2008 Jul 13 2:29 PM
Check for decimal what value u have given..as I mentioned earlier you have to change it to decimals 2 from decimals 1.
SELECTION-SCREEN BEGIN OF line.
SELECTION-SCREEN COMMENT 1(9) text-012.
parameters: Packed(3) TYPE p decimals 2 modif id sc1.
SELECTION-SCREEN END OF line.
If u r using decimals 1 only then ur case is possible..it will take..1234..but if it is decimals 2 then it will give u error message for 1234..pl. check.
Regards,
Joy.
‎2008 Jul 13 2:31 PM
Hi Joe,
for decimals 2 its giving error,
but i want to have a field for decimals 1.
for this case what i have to do... ?
Thanks
Vinay
‎2008 Jul 13 2:38 PM
I donot think ur case is possible in selection screen with type p decimals 1. In the selection screen use decimals 2 option and after the user input move this value to a variable with type p decimals 1. And in the selection screen text mention that user needs to enter value with 1 decimal places....
Regards,
Joy.
‎2008 Jul 13 2:42 PM
hi Joe,
i can do that but to the user eyes it will take as .00 only after decimals.....i think in display wont workout...
what do u say ?
Thanks,
vinay
‎2008 Jul 13 2:49 PM
Yes that is also true...but If u put decimals 2 in the selection screen..does it make any diff. than putting decimals 1? If it is then u can throw message by stating that all the calculations are done using decilmals 1.
Regards,
Joy.
‎2008 Jul 13 3:00 PM
hi Joe,
but in my programming i have to use like that only....
is there any other method to do so ?
like declaring it as char 5 and then doing some internal calculation and then doing validation that it should be between some range. and then putting as char value on screen...this is the part i am looking for...
thanks for your comments and suggestion.....i will reward you points once this query is solved......
Thanks,
vinay
‎2008 Jul 13 3:18 PM
if u use char 5 then u have to do lot of validations for ex: say user enters decimals point twice.
Here is another solution:
SELECTION-SCREEN BEGIN OF line.
SELECTION-SCREEN COMMENT 1(9) text-012.
parameters: Packed(3) TYPE p decimals 1 modif id sc1.
SELECTION-SCREEN END OF line.
at selection-screen.
data:l_val type i.
if Packed is not initial.
l_val = Packed.
if l_val > 1000.
message e303(me) with 'Wrong format, enter in this format:(___._)'.
endif.
endif.
Regards,
Joy.