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

How to convert one data type to another data type in ABAP programing

Former Member
0 Likes
9,722

Hi expert,

I am facing the problem while data is moving is from one data type(I, P, F) to CHAR data type then I am getting '#' and not getting proper value.

So how to get the proper value ?

either any Function module for conversion exit avilable or any other alternate avilable.

Could anyone suggest me on this.

Waiting for quick response.

Best Regards,

Bansi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,619

Hi,

To Convert Float value to char value to send in final file use following FM:

CALL FUNCTION 'FLTP_CHAR_CONVERSION'
          EXPORTING
            decim = 2
            expon = 0
            input = char_value
            ivalu = 'X'
          IMPORTING
            flstr = v_char.

In input youu can specify value with float data type

Regards

Shrila

6 REPLIES 6
Read only

Former Member
0 Likes
3,619

Check the length of your CHAR data type...................its length might be less than ur value.........

Read only

Former Member
0 Likes
3,619

Dear Bansi,

Declare Character Type Data with length as follows:

DATA M_FIELD(100) type c.

It will automatically adjust the other data type values.

regds,

Anil

Read only

Former Member
0 Likes
3,620

Hi,

To Convert Float value to char value to send in final file use following FM:

CALL FUNCTION 'FLTP_CHAR_CONVERSION'
          EXPORTING
            decim = 2
            expon = 0
            input = char_value
            ivalu = 'X'
          IMPORTING
            flstr = v_char.

In input youu can specify value with float data type

Regards

Shrila

Read only

Former Member
0 Likes
3,619

Hi,

Firstly, check the length of the character field. It should be adequate. And also use write or move statement instead of '='.

regards,

Sourav

Read only

former_member998879
Participant
0 Likes
3,619

Hi Bansidhar Padhy,

try this FM 'CONVERSION_EXIT_ALPHA_INPUT'


       call function 'CONVERSION_EXIT_ALPHA_INPUT'
          exporting
            input         = import data
          importing
            output        = export data

Regards,

Davide

Read only

Former Member
0 Likes
3,619

Hi Bansi,

you can do in the following way...

DATA: text(40) TYPE c,

data1 type i.

data1 = 43462.

text = data1.

i hope u will get some help..

Thanks & Regards

Ashu Singh