Application Development 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: 

Any functinal Modul to Conver Flaoting number to String

Former Member
0 Kudos

Dear all

I need help i am using C14W_NUMBER_CHAR_CONVERSION FM to convert the floating vale to Character but i am getting run time error. coz it is not converting BIG values. I need to convert 9.9999999990000000E+09 this value to 9999999999.0000 any other simple way or any other FM is available plz help me anybody to resolve this issue.

Regards

ACJ

19 REPLIES 19

Former Member
0 Kudos

Use FM FLTP_CHAR_CONVERSION

CALL FUNCTION 'FLTP_CHAR_CONVERSION'
      EXPORTING
        DECIM         = '3'
*   EXPON         = 0
        INPUT         = WA_PLMK-TOLERANZOB
*   IVALU         = ' '
*   MASKN         = ' '
      IMPORTING
        FLSTR         = V_UPPER

0 Kudos

when i am running the FM in SE37 i am not getting the result in FLSTR variable.

it is giving as 9.9999999990000000E 09.

But i want this 9999999999.0000

why it is not coming.

0 Kudos

same variable i am passing to get the result what your used in the example i am getting null value FLSTR.

Former Member
0 Kudos

hi,

Chcek this

data: val1 type ausp-atflv.

data: val2 type p decimals 2.

val1 = '1.1100000000000000E+00'.

val2 = val1 .

write val2.

Check this link..

Edited by: Avinash Kodarapu on Feb 27, 2009 3:44 PM

Former Member
0 Kudos

ACJ,

try with 'CHAR_FLTP_CONVERSION' FM

data F type F.

data C(20) type C value '9.99E-10'.

Call function 'CHAR_FLTP_CONVERSION'

exporting string = C

importing flstr = F.

Best Regards,

Syf

Edited by: syfulla shaik on Feb 27, 2009 3:49 PM

0 Kudos

i am not getting dear in which variable i need to pass the value

actually i ll pass two variable one is floating point value another is number of deceimal.

former_member705122
Active Contributor
0 Kudos

Check this sample code.

DATA:
  w_float TYPE atflv value '9.9999999990000000E+09',
  w_char(20).
WRITE:
  w_float TO w_char EXPONENT 0 DECIMALS 4.
CONDENSE w_char NO-GAPS.
WRITE:
  w_char.                   " 9999999999.0000

Regards

Adil

0 Kudos

Adil i need to convert the value from internal table i cant do HOT code for that any FM is a beter way i think so

actually i used the C14W_NUMBER_CHAR_CONVERSION FM

it is giving exact result up to 999999999.0000 only after next 9 it is giving run time eroor all other also i tried but i am not getting.

former_member705122
Active Contributor
0 Kudos

Check this sample code,

DATA:
  w_float TYPE atflv VALUE '9.9999999990000000E+09',
  w_char(20).
CALL FUNCTION 'FLTP_CHAR_CONVERSION_FROM_SI'
  EXPORTING
    char_unit        = 'EA'
    unit_is_optional = 'X'
    decimals         = 4
    exponent         = 0
    fltp_value_si    = w_float
    indicator_value  = 'X'
    masc_symbol      = '_'
  IMPORTING
    char_value       = w_char
  EXCEPTIONS
    no_unit_given    = 1
    unit_not_found   = 2
    OTHERS           = 3.

CONDENSE w_char NO-GAPS.
WRITE:
  w_char.                   " 9999999999.0000

Regards

Adil

0 Kudos

no i am not getting just run the same FM in SE37 by passing the values you will come to know.

Former Member
0 Kudos

hi,

use


 call function 'MC_FLTP_CHAR'  
          exporting
            fc_a_fld = wa_qamv-toleranzun  " ur floating variable
          importing
            fc_r_fld = l_v_low.   " ur string variable

кu03B1ятu03B9к

0 Kudos

Dear karthik

How can i get deceimal points in that.

Decimal points also required right?

0 Kudos

check in se37 if the fm provides u option of specifying decimal points i am not on sap system now to check it.

кu03B1ятu03B9к

0 Kudos

NO i tried that there is no option to pass the decimal point i think so.

0 Kudos

Dear Karthik

I am not getting exact result it is giving in program only 4 Character in FM they Declared Output variable as CHAR10.

and decimal point also required this is for Inspection PLAN QP03 Draft Print.

0 Kudos

Any other idea to get the result by using FM MC_FLTP_CHAR i am getting the value but i should get the decimal points also.

former_member705122
Active Contributor
0 Kudos

To test, copy the code in SE38 and execute it. you will see the expected result.

former_member705122
Active Contributor
0 Kudos

You can try this Function module.

Check this Function module 'QSS0_FLTP_TO_CHAR_CONVERSION' in SE37

or Run the below code in SE38

DATA:
w_float TYPE qsollwerte VALUE '9.9999999990000000E+09',
w_char TYPE qsollwertc.

CALL FUNCTION 'QSS0_FLTP_TO_CHAR_CONVERSION'
  EXPORTING
    i_number_of_digits       = 4
    i_fltp_value             = w_float
    i_value_not_initial_flag = 'X'
    i_screen_fieldlength     = 16
  IMPORTING
    e_char_field             = w_char.

WRITE:
  w_char.                   " 9999999999.0000

Regards

Adil

0 Kudos

Thanks Adil

It Is ok Itseems

I am getting correct Result.

I ll implement live and will see.

Thanks lot.

Reagrds

ACJ