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

CEVA_CONVERT_FLOAT_TO_CHAR

Former Member
0 Likes
3,166

i am using FM "CEVA_CONVERT_FLOAT_TO_CHAR" to convert 3.0000000000000000E+02 to 300 in my report. I am using this FM as below

<b>DATA: l_var TYPE p DECIMALS 2.

DATA: l_char(25).

LOOP AT i_cdpos .

IF i_cdpos-fname = 'ATFLV'.

CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'

EXPORTING

float_imp = i_cdpos-value_old

format_imp = l_var

  • LEFT_IMP = ' '

round_imp = ' '

IMPORTING

char_exp = l_char

  • OVERFLOW_EXP =

.

ENDIF.

MOVE l_char TO i_cdpos-value_old.</b>

But it is not able to take i_cdpos-value_old (3.0000000000000000E+02 ) as a float as the value_old is a char field. Kindly help me

i am using FM "CEVA_CONVERT_FLOAT_TO_CHAR" to convert 3.0000000000000000E+02 to 300 in my report. I am using this FM as below

<b>DATA: l_var TYPE p DECIMALS 2.

DATA: l_char(25).

LOOP AT i_cdpos .

IF i_cdpos-fname = 'ATFLV'.

CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'

EXPORTING

float_imp = i_cdpos-value_old

format_imp = l_var

  • LEFT_IMP = ' '

round_imp = ' '

IMPORTING

char_exp = l_char

  • OVERFLOW_EXP =

.

ENDIF.

MOVE l_char TO i_cdpos-value_old.</b>

But it is not able to take i_cdpos-value_old (3.0000000000000000E+02 ) as a float as the value_old is a char field. Kindly help me

5 REPLIES 5
Read only

Former Member
0 Likes
1,575

Hi,

Please try this.


DATA: EXP      TYPE ANZ_TAGE,
      CHAR(16) TYPE P.
                                                                        
EXP = '3.0000000000000000E+02 '.
MOVE EXP TO CHAR.
WRITE: CHAR.

Regards,

Ferry Lianto

Read only

0 Likes
1,575

Thanks for ur quick reply . But i didn't understand one thing. Do i need to use the FM followed by ur code?...or no need of using FM now?

Read only

0 Likes
1,575

Hello,

Try like this.


 DATA: CHAR1(30).
          WRITE: FLOAT_VALUE TO CHAR1 EXPONENT 0 DECIMALS 3.
          CONDENSE CHAR1 NO-GAPS.

Regards,

Vasanth

Read only

Former Member
0 Likes
1,575

Hi,

No need FM, if you want to convert 3.0000000000000000E+02 to 300.

You just need to move to type p field without decimal.

Regards,

Ferry Lianto

Read only

0 Likes
1,575

It's not working