Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

selection screen packed entries

Former Member
0 Likes
1,872

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

15 REPLIES 15
Read only

Former Member
0 Likes
1,561

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.

Read only

0 Likes
1,561

Hi Joy,

i tried its throwing the following message..

The parameter name ("PACKED(3)" here) can be up to 8 characters long.

Thanks,

Vinay

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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.

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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.

Read only

0 Likes
1,561

sorry joe still the same problem

Thanks,

vinay

Read only

0 Likes
1,561

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.

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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.

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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.

Read only

0 Likes
1,561

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

Read only

0 Likes
1,561

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.