Application Development 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: 

value with upto 4 dacimal places

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

Declare the variable with addition decimals 4

eg

data: price TYPE p DECIMALS 4.

This will do it

Reward points if it does

Regards

Former Member
0 Kudos

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

pd1(10) type p decimals 4.

pd1 = pd.

write: pd, pd1.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.