‎2009 Jul 14 12:05 PM
hello friends,
I have requirement to read the value after decimal point.. for eg: if value is 125.28, I need to convert it to 0.28.
please suggest
thanks in advance.
Bharat
‎2009 Jul 14 12:28 PM
Hi,
try this:
data: p1 type p DECIMALS 2 value '123.28'.
data: p2 type p DECIMALS 2.
*
p2 = p1 mod 1.
*
Regards, Dieter
‎2009 Jul 14 12:08 PM
HI !!
Just assign this value to any string variable and split at '.'
or
Use this code snippet
DATA lv_var1 TYPE p DECIMALS 2 VALUE '10.25'.
DATA lv_var2 TYPE p DECIMALS 2.
lv_var2 = FRAC( lv_var1 ).
WRITE: / lv_var2.Thanks
‎2009 Jul 14 12:11 PM
Hi,
125.28, I need to convert it to 0.28
data: string1 type string
string2 type string.
string1 = '125.28'.
split string1 at '.' into string1 string2.
now string2 contains .28.
Then
concatenate '0' string2 into string2.
now string2 = 0.28.
regards
sekhar.
‎2009 Jul 14 12:12 PM
‎2009 Jul 14 12:14 PM
hi,
please use SPLIT statement at decimal point like '. press F1 on isplit t and read the help documnets
then concatenate the value.
thanks
‎2009 Jul 14 12:17 PM
Hi,
This is very simple, there are 2 possibility
data: var1 type string default '125.28',
var2 type string.
split var1 at '.' into var1 var2.
concatenate '0' var2 into var2.
write:/var2 .
OR
data: var1(6) type c default '125.28',
var2(4) type c.
var2 = var1+3(3).
concatenate '0' var2 into var2.
write:/var2 .
Hope this may help you.
Pooja
‎2009 Jul 14 12:21 PM
HI Bharat,
This will solve your query.
DATA wa_int(3) TYPE p decimals 2 value '6.78'.
DATA wa_int1(3) TYPE p decimals 2.
wa_int1 = frac( wa_int ). "returns 0.78
Revert if you need more.
Thanks.
‎2009 Jul 14 12:28 PM
Hi,
try this:
data: p1 type p DECIMALS 2 value '123.28'.
data: p2 type p DECIMALS 2.
*
p2 = p1 mod 1.
*
Regards, Dieter
‎2009 Jul 14 12:34 PM
> Hi,
>
> try this:
>
>
> > data: p1 type p DECIMALS 2 value '123.28'. > data: p2 type p DECIMALS 2. > * > p2 = p1 mod 1. > * > >>
> Regards, Dieter
The beauty of simplicity!
‎2009 Jul 14 1:38 PM
Dear Dieter,
problem got solved...thanks for ur help....
thanks everyone for the reply....
thanks,
Bharat
‎2009 Jul 14 12:49 PM
‎2009 Jul 14 1:37 PM