‎2005 Dec 23 10:45 AM
Hii
Please suggest me a way to convert float to char. Though there is a function modules for this in SAP for eg one called "CEVA_CONVERT_FLOAT_TO_CHAR" but i could not figure out how to fill up the parameters .
Please suggest a way for this conversion.
Ajitabh Pradhan
‎2005 Dec 23 10:59 AM
Hi ajitah pradhan,
You can directly convert a float to charecter by just assigning them in your report.
For eg.
program:
data: f type f.
data: c(24).
f = 20.
write : f.
c = f.
write: / c.
output:
2,0000000000000000E+01
2.0000000000000000E+01
The charecter should be of 24 in length.
Else the no. of zero reduces.
hope this helps you.
Regards,
Vivek.
‎2005 Dec 23 10:46 AM
Hello,
please try Function FLTP_CHAR_CONVERSION.
Regards
Frank Brackmann
‎2005 Dec 23 10:53 AM
Hii
I have value in the form of 1.000000000E+05 to be converted to 100 .
How can such values be converted ?
Regards
Ajitabh
‎2005 Dec 23 10:59 AM
Hi Ajitabh,
This works for me.
REPORT ZRT_TEST.
data: f type f value '1.000000000E+05'.
data: i type i.
write:/ f.
i = f.
write:/ i.
Regards,
ravi
‎2005 Dec 23 11:12 AM
Thanks Ravi,
We got into to omuch complexity for such a small solution ....
Regards
Ajitabh
‎2005 Dec 23 11:34 AM
‎2005 Dec 23 10:48 AM
Hi Ahitabh,
Why to use an FM for that?
Just assign the float value to a normal Char type variable of length = output length of the float variable.
v_char = v_float.
Regards,
Ravi
‎2005 Dec 23 10:48 AM
Hi Ajitabh,
1. i dont know whether i understood ur question properly or not.
We can use simple =
2. try this code (just copy paste)
report abc.
data : f type p decimals 5.
data : s(15) type c.
f = '41.35666'.
s = f.
write 😕 f.
write 😕 s.
regards,
amit m.
‎2005 Dec 23 10:53 AM
Hi again,
1. use like this.
REPORT abc.
DATA : f TYPE f.
DATA : s(15) TYPE c.
f = '41'.
CALL FUNCTION 'FLTP_CHAR_CONVERSION'
EXPORTING
DECIM = 2
EXPON = 0
input = f
IVALU = ' '
MASKN = ' '
IMPORTING
flstr = s
.
WRITE 😕 f.
WRITE 😕 s.
regards,
amit m.
‎2005 Dec 23 10:59 AM
Hi ajitah pradhan,
You can directly convert a float to charecter by just assigning them in your report.
For eg.
program:
data: f type f.
data: c(24).
f = 20.
write : f.
c = f.
write: / c.
output:
2,0000000000000000E+01
2.0000000000000000E+01
The charecter should be of 24 in length.
Else the no. of zero reduces.
hope this helps you.
Regards,
Vivek.