‎2007 Dec 27 10:33 AM
hi
could u help me out.
i am trying to display sum of cdiff column from table imrg.
but it display something like this 3.600000000000000E+06. i guess its bcoz of float data type. could u tell me how can i convert it to char.
i heard that thier is function module to convert this kind of data. could u tell me which is tht.
thnks in advance
‎2007 Dec 27 10:36 AM
you can't convert float data. better use packed data. TYPE P.
that can be changed to string easily bys using uppack statement.
refer F1 help for UNPACK statement.
Reward if useful
Regards
ANUPAM
‎2007 Dec 27 10:38 AM
Hi,
Use THis FM
&----
*& Form sub_fltp_to_char *
&----
This form converts cycle from floating to character format *
----
FORM sub_fltp_to_char .
*--Local constants
CONSTANTS: lc_dec TYPE i VALUE 0.
*--Clear Variable
CLEAR v_cycle.
IF NOT v_unit IS INITIAL.
*--Call function module to convert cycle & offset from floating to
character
CALL FUNCTION 'FLTP_CHAR_CONVERSION_FROM_SI'
EXPORTING
char_unit = v_unit
decimals = lc_dec
fltp_value_si = v_offset
indicator_value = c_check
IMPORTING
char_value = v_cycle
EXCEPTIONS
no_unit_given = 1
unit_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF. "IF NOT v_offset IS INITIAL.
ENDFORM. "sub_fltp_to_char
Regards,
Prashant
‎2007 Dec 27 10:41 AM
data: a(20) type c.
a = '14,23,680'.
*Replace ',' in a with space.
replace all OCCURRENCES of ',' in a with space.
condense a.
write:/ a.
If usefull reward points helpfull.....
‎2008 Feb 04 5:05 AM
to convert float data to int their is no need use any function module just assign float type to int type in your program for e.g if you have float column in table then assing that column to int column in internal table in your program.
Thanks,
SUDHIR MANJAREKAR
‎2008 Mar 07 12:34 PM
Try to use next FM 'CEVA_CONVERT_FLOAT_TO_CHAR'.
You can try this code:
DATA:
lv_measure TYPE imrc_recdv,
lv_format(16) TYPE p DECIMALS 1,
lv_value(16) TYPE c.
CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
float_imp = lv_measure
format_imp = lv_format
IMPORTING
char_exp = lv_value.