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

convert decimal to char type

Former Member
0 Likes
7,245

Hi all,

How to convert decimal type length 3(e.g:25.0) to char type.......

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,431

Try

CEVA_CONVERT_FLOAT_TO_CHAR

Cheers

UA

Hi all,

How to convert decimal type length 3(e.g:25.0) to char type.......

Thanks in advance

7 REPLIES 7
Read only

abdul_hakim
Active Contributor
0 Likes
3,431

hi

assign it to a char type field.

for eg,

data: f1 type p decimals 2 value '12.30',

f2(10) type c.

f2 = f1.

now f1 has been coverted to the datatype of the target field f2.

Cheers,

Abdul Hakim

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
3,431

You can just move it in.

data: c(17) type c.
data: p type p decimals 3 value '1234.567'.

c = p .

write:/ c.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
3,431

hi,

data : var_dec type p decimals 3,

var_char(10).

<b>move var_dec to var_char.</b>

else use FM

CALL FUNCTION <b>'CEVA_CONVERT_FLOAT_TO_CHAR'</b>

EXPORTING

FLOAT_IMP = P_ORIGEN

FORMAT_IMP = CAMPO_FLOAT

IMPORTING

CHAR_EXP = C_DESTINO.

Regards,

Santosh

Read only

Former Member
0 Likes
3,432

Try

CEVA_CONVERT_FLOAT_TO_CHAR

Cheers

UA

Read only

0 Likes
3,431

If you would like to apply the user specific formatting, then you can do this.



data: c(17) type c.
data: p type p decimals 3 value '1234.567'.

write p to c.

write:/ c.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
3,431

use the write statement

write lv_decimal to lv_char.

Read only

Former Member
0 Likes
3,431

I have the same problem but i need to convert from P to C in unicode program. Move, assign or write commands give me an error saying "not mutually convertable in a unicode program" Please Help