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 data conversions

Former Member
0 Kudos

Hi,

I have a numeric value eg: 123456789123456.1234567

I am getting it into my program using BAPI so it is converted into float and i am getting it as 1.234567891E+14

I want to convert it to char and i want to display it as

123456789123456.1234567

Is there any FM available for this.

Regards,

Ravi

4 REPLIES 4

Former Member
0 Kudos

Hi,

Write the statemetn as below.

v_float = 1.234567891E+14.

WRITE: V_FLOAT EXPONENT 0 DECIMALS 0 TO V_FLOAT

Regards,

Ram

Reward points if helpful

Message was edited by:

Ram Mohan Naidu Thammineni

Former Member
0 Kudos

Try moving it to a TYPE P field.

For eg

data: p type p decimals 3. (Choose decimal places based upon data)

data: f type f.

p = f.

Write:/ p.

Former Member
0 Kudos

hi ,

The value range of type F numbers is 1x10*-307 to 1x10*308 for positive and negative numbers, including 0 (zero). The accuracy range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform. Since type F data is internally converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not use type F data if high accuracy is required. Instead, use type P data.

You use type F fields when you need to cope with very large value ranges and rounding errors are not critical.

hence u cannot avoid the rounding errors when you convert it to pack type.

Regards,

Aparna

Former Member
0 Kudos

use the fm

KKEK_CONVERT_FLOAT_TO_CURR

MURC_ROUND_FLOAT_TO_PACKED

or take it in type p variable.

data : v_p type p decimals 6.

v_p = <your float value>

regards

shiba dutta