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

float

Former Member
0 Likes
1,414

hi guys,

in my code i declared float type,

error message is coming that data type f is not allowed like that,

how can i declare the float value,

plz let me know.

thanks and regards

vijay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,375

hi,

declare like this.

eg:

DATA: SPN(4) TYPE P VALUE 124.

data : f type p decimals 5.

Rgds

Reshma

11 REPLIES 11
Read only

Former Member
0 Likes
1,376

hi,

declare like this.

eg:

DATA: SPN(4) TYPE P VALUE 124.

data : f type p decimals 5.

Rgds

Reshma

Read only

Former Member
0 Likes
1,375

HI,

u can do like this

data:avg(8) type f value '1.34'.

write:/ avg.

OR

data:avg type f value '1.34'.

write:/ avg.

rgds,

bharat.

Read only

0 Likes
1,375

hi friend,

without giving value have u checked?

regards

vijay

Read only

0 Likes
1,375

thanks for everyone,

regards

vijay

Read only

0 Likes
1,375

hi bharat

u cant use type f in abap.

check hemant or reshma answers.

its useful yaar.

Read only

Former Member
0 Likes
1,375

Hi Vijay,

Use <b>TYPE P</b> in ur code. type f is not allowed in ABAP

Data : test type p.

Reward points if helpful.

Regards,

Hemant

Read only

0 Likes
1,375

by default its taking float also.

REPORT ZFLOAT .

parameters: b(5),

c(5).

DATA: a type p.

a = b * c.

write : / a.

check this code.

regards

vijay

Read only

Former Member
0 Likes
1,375

if any comments plz tel

Read only

0 Likes
1,375

Hi vijay,

check this.it will work.

data:avg type f.

data:a(3) type n value '14'.

data:b(3) type n value '3'.

avg = a / b.

write:/ avg.

rgds,

bharat.

Message was edited by:

Bharat Kalagara

Read only

Former Member
0 Likes
1,375

if you are using type f variable then you will get the output as exponent.

data : var type f value 5.

write : / var.

5.0000000000000000E+00

i.e. like this this is the float representation.

data : var type p decimals 2 value 5.

write : / var.

you will get 5.00 like this...

so as per your requirement you can use the type p or type f.

regards

shiba dutta

Read only

Former Member
0 Likes
1,375

thanks guys