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: 

Regarding floating point value

Former Member
0 Kudos

Hi experts,

I want to convert 16 decimal place into 4 decimal place in a floating-point value. Is there any Function module to do this? or any other way?

Thanks in advance.

With regards,

Goutam.

3 REPLIES 3

Former Member
0 Kudos

Hi,

TRy this code

DATA : VAL1 TYPE F VALUE '1.12345678912345678',
       VAL2 TYPE P DECIMALS 4.

VAL2 = VAL1.

WRITE : VAL1,
        VAL2.

Regards

satsrockford
Active Participant
0 Kudos

hi,

Take another variable of TYPE P DECIMALS 1 and MOVE fltp to type p.

DATA V_FLTP TYPE F VALUE '4.650000000000000E+01'.

DATA V_PD TYPE P DECIMALS 1.

V_PD = V_FLTP

WRITE V_PD. -


> 46.5.

V_PD displays leading blanks and displays 46.5,BUT if you need with out leading blanks then take a character variable of length 16 and move the contents of V_PD.

DATA V_C(16) TYPE C.

V_C = V_PD.

CONDENSE V_C.

WRITE V_C. -


> 46.5 (W/0 leading blanks)

check the below links

regards

Satish

0 Kudos

Thanks to all.