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: 

how to convert a packed decimal field to character

Former Member
0 Kudos

hi to all experts.

i want to convert a packed decimal to character how can we do it

1 ACCEPTED SOLUTION

former_member705122
Active Contributor
0 Kudos

Check this sample code.

DATA :
w_p  TYPE p DECIMALS 2 VALUE '12.34',
w_c(5).

w_c = w_p.

WRITE:
  w_c.            " 12.34

Regards

Adil

6 REPLIES 6

Former Member
0 Kudos

Hi Mozam,

Do it like this.

Data :

w_p type p,

w_c type c.

Write w_p to w_c.

If you have something like w_p type p decimals 2 .

Take w_c of repective length.

For Ex, You have your p value as 12.34.

Your char type should have length of 4.

Much Regards,

Amuktha.

0 Kudos

Hi Amuktha,

Im using the one u have written. but the problem is im getting *000

after this WRITE: wa_data-menge TO wa_output-menge1 .

Former Member
0 Kudos

can you tell by example

0 Kudos

i have field menge i want to convert it to char type how can i change it

former_member705122
Active Contributor
0 Kudos

Check this sample code.

DATA :
w_p  TYPE p DECIMALS 2 VALUE '12.34',
w_c(5).

w_c = w_p.

WRITE:
  w_c.            " 12.34

Regards

Adil

Former Member
0 Kudos

Mozam,

if ur char field is short of length then the preceeding characters are represented by ***

so increase char length and then u can condense it.... kindly chk..

data:

w_p type p decimals 2 value '12345678912.34',

w_char(30) type c.

w_char = w_p.

condense w_char.

write:/ w_char.

Regards,

Mdi.Deeba