Application Development and Automation 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: 
Read only

convert float to INT in SAP SCRIPT

Former Member
0 Likes
892

Hi Experts,

I have field in a table with float data type holding value '1.800000000000+E'.

I have to use this value in SAP SCRIPT and display in INT type '1.80'.

How can i do that? Please Suggest!!!

Rajiv Ranjan

4 REPLIES 4
Read only

Former Member
0 Likes
626

Hello,

Declare a varible as Packed with 2 decimal places.

Move this into that varible and display it in the script.

Hope this helps.

Regards

Read only

Former Member
0 Likes
626

DATA : FLOAT TYPE F VALUE ''1.800000000000+E'',

PACKED TYPE P DECIMALS 2.

PACKED = FLOAT.

Bilz.

- reward if helpful.

Read only

Former Member
0 Likes
626

Hi rajeev,

<b>'1.80' is not a integer value

so if u want u r result to contain any decimal values u cannot pass that value to a integer variable.

Better u pass it to a packed variable with 2 decimal place </b>

in u r driver program u do this

data : v_p type p decimals 2.

v_p = v_f.

if u r using a standard driver program then change in u r form text elements where u r printing that value,

for example,

&EKPO-MENGE& -> 1,234.560

&EKPO-MENGE&(.2)& -> 1,235.56

Read only

Former Member
0 Likes
626

Hi Rajiv,

You can use &var(.2)&. Then it will display only 2 decimal places.

Thanks,

Punit