Former Member

# value with upto 4 dacimal places

Hi gurus,

i want to pick a value upto 4 dacilam places. how can i do it.

or examp.

say value 4.7456660000000000000

i want only 4.7456 from above value.

plz help

10|10000 characters needed characters exceeded

### Related questions

• Former Member
Posted on Oct 18, 2007 at 09:27 AM

Declare the variable with addition decimals 4

eg

data: price TYPE p DECIMALS 4.

This will do it

Reward points if it does

Regards

10|10000 characters needed characters exceeded
• Former Member
Posted on Oct 18, 2007 at 09:27 AM

data: pd(10) type p decimals 6 value '100.123030',

pd1(10) type p decimals 4.

pd1 = pd.

write: pd, pd1.

10|10000 characters needed characters exceeded
• Former Member
Posted on Oct 18, 2007 at 09:33 AM

hi! Rajesh

Declare the variable by specifying the Decimals

data: total type P decimals 4.

this will eliminate the excess decimal value than you specify

Regards,

Nagulan

10|10000 characters needed characters exceeded
• Former Member
Posted on Oct 18, 2007 at 09:34 AM

You can also use the function module C147_STRING_TRUNCATE for this . you have input the length yu want to get.

Hope this helps.

Amit

10|10000 characters needed characters exceeded
• Former Member
Posted on Oct 18, 2007 at 09:44 AM

Hi,

Use the below logic

data: val1 type p decimals 14 value '4.7456660000000000000'.

data val1_text(30).

data: val2(20).

DATA: val3(30).

val1_text = val1.

split val1_text at '.' into val1_text val2.

condense: val1_text, val2.

concatenate val1_text val2+0(4) into val3 separated by '.'.

write: val3.

10|10000 characters needed characters exceeded
• Former Member
Posted on Oct 18, 2007 at 09:48 AM

hi,

declare as.........

data: num type p decimals 4 value '4.7456660000000000000'.

write: / num.

it works....

<b>reward with points if useful.</b>

regards,

Vinod Samuel.

10|10000 characters needed characters exceeded