‎2007 Dec 07 10:19 AM
Hi experts
I need a logic to findout how many decimals places in a value.
for example , V_temp = 567.00
v_temp = 1234
v_temp contains 2 decimal places and next one is zero
Thanks in advance
saikar
‎2007 Dec 07 10:22 AM
Hi Karthik,
Move it to a char variable and seperate text at . into 2 variables, then find the length of the second variable using strlen().
Regards,
Satish
‎2007 Dec 07 10:22 AM
Hi Karthik,
Move it to a char variable and seperate text at . into 2 variables, then find the length of the second variable using strlen().
Regards,
Satish
‎2007 Dec 07 10:27 AM
Hi..
write w_value decimals 2.
Example: DATA pack TYPE p VALUE '123.456'
DECIMALS 3.
WRITE pack DECIMALS 2.
WRITE: / pack ROUND -2,
/ pack ROUND -1,
/ pack ROUND 1,
/ pack ROUND 2.
or......
w_pack type p decimals 2.
w_pack = w_value.
write w_pack.
Award points if found helpful.....
Cheers,
Chandra Sekhar.
‎2007 Dec 07 10:35 AM
data: moff,len type i.
len = strlen (v_temp).
find '.' in v_temp MATCH OFFSET moff.
moff will have the position of decimal.
subtract dat from actual length of v_temp.
Hope dis helps.
Reward all helpful answers