‎2007 Sep 19 8:08 PM
Hi
I have an input field that is of type P , with decimals 3.
so if I enter 3000 , then it will take 3.000 .
I want it to be so ,, when user enters 3 , it automatically converts it to 3.000 and if the user enters 3.2 , then it converts it to 3.200 , .
How can I achieve this.
Thankyou
‎2007 Sep 19 9:04 PM
Krish,
do like this
parameters: P1(10) type P decimals 3.
but its better to go with
parameters: p1(10) type c. it will take care of everything.
‎2007 Sep 19 8:39 PM
hi Krish,
I use it at a program here like u said:
parameters: P1 type P decimals 3.
write p1.
when we enter a value, for example 3000, it automatically converts to "3.000,000", if enter a value 3 it converts to "3,000" and if enter a value "3,2" it converts to "3,200".
Can you tell me how do u are declaring this input field?
Do you need a "," or a "."?
Regards
Allan Cristian
‎2007 Sep 19 8:43 PM
Hi Allan
I am declaring the field as xyz type P decimals 3 .
It is actualyl an input field for an ALV.
I just want it to be eay for the user , so if he intends to pick 3 , then he only has to give 3 ,, hit enter and the value that automatically converted to 3,000 .
Thankyou
‎2007 Sep 19 8:44 PM
Hi,
If you have defined your input field as follows
parameters: text1 type p decimals 3.
then it should work as desired.
Thanks & Regards,
Vanita M.
‎2007 Sep 19 9:04 PM
Krish,
do like this
parameters: P1(10) type P decimals 3.
but its better to go with
parameters: p1(10) type c. it will take care of everything.
‎2007 Sep 19 9:08 PM
Hi Krish,
I understand what you need, please look this code:
DATA: lenght(2), cont(2), contv(1), teste(1), lenghtv(1).
PARAMETERS: p1(10).
lenght = strlen( p1 ).
cont = 0.
contv = 0.
DO lenght TIMES.
teste = p1+cont(1).
cont = cont + 1.
IF teste = ',' OR teste = '.'.
contv = 1.
lenghtv = lenght - cont.
IF lenghtv = '0'.
CONCATENATE p1 '000' INTO p1.
ELSEIF lenghtv = '1'.
CONCATENATE p1 '00' INTO p1.
ELSEIF lenghtv = '2'.
CONCATENATE p1 '0' INTO p1.
ENDIF.
endif.
ENDDO.
if contv = 0.
CONCATENATE p1 ',000' INTO p1.
endif.
WRITE p1.
Regads
Allan Cristian