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: 

Move the field type char to type P

Former Member
0 Kudos

How to move the char type field(18) to Type p

8 REPLIES 8

kiran_k8
Active Contributor
0 Kudos

Siva,

data: temp1(40) type c,

temp2 type p.

temp1 = '123456789.0987'.

move tem1 to temp2.

write:/ temp2.

K.Kiran.

Former Member
0 Kudos

Hi

assign it straight away after defineing the variables/fields

say v_char = 100

if you move that to P type

v_pchar = v_char

become 100.00 if it is 2 decimals

Regards

anji

0 Kudos

The char field is like 1,000

i need to move it to tyoe p

this is a quan field

0 Kudos

Hi siva,

REPLACE ALL OCCURANCES OF ','.

Then use condense

and then move the field.

Regards,

Atish

Former Member
0 Kudos

Hi Siva,

How is type P field defined. It should be long enough to hold the data of 18 char.

You can direclty use

field1 = field2.

Regards,

Atish

Former Member
0 Kudos

You can directly move the character field to type P.

Data: f1(18) type c,

f2(18) type p decimals n. "Specify no. of decimal points

While moving the data make sure that it contains only numbers and decimal point. remove all the commas if there are any.

varma_narayana
Active Contributor
0 Kudos

Hi..

You can use the PACK statement.

Eg:

DATA: V_CHAR(10) VALUE '1234.56'.

DATA : V_PACK TYPE P DECIMALS 2.

PACK V_CHAR TO V_PACK.

WRITE:/ V_PACK.

reward if helpful.

Former Member
0 Kudos

Thanks for your ans