‎2007 May 15 5:02 AM
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
‎2007 May 15 5:05 AM
hi,
declare like this.
eg:
DATA: SPN(4) TYPE P VALUE 124.
data : f type p decimals 5.
Rgds
Reshma
‎2007 May 15 5:05 AM
hi,
declare like this.
eg:
DATA: SPN(4) TYPE P VALUE 124.
data : f type p decimals 5.
Rgds
Reshma
‎2007 May 15 5:13 AM
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.
‎2007 May 15 5:15 AM
‎2007 May 15 5:16 AM
‎2007 May 15 5:20 AM
hi bharat
u cant use type f in abap.
check hemant or reshma answers.
its useful yaar.
‎2007 May 15 5:15 AM
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
‎2007 May 15 5:33 AM
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
‎2007 May 15 5:34 AM
‎2007 May 15 5:40 AM
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
‎2007 May 15 5:45 AM
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
‎2007 May 15 12:52 PM