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

packed number to character conversion issue

Former Member
0 Likes
2,365

Hi,

I am trying to assign a value with data type 'P' decimal 5 to a character type variable. But the character type variable is not taking the value.

I tried using MOVE and WRITE, but no success.

Please help. Its urgent.

regards,

Gaurav.

Hi,

I am trying to assign a value with data type 'P' decimal 5 to a character type variable. But the character type variable is not taking the value.

I tried using MOVE and WRITE, but no success.

Please help. Its urgent.

regards,

Gaurav.

6 REPLIES 6
Read only

Former Member
0 Likes
1,333

Try with,

C14DG_LB04                      
C14DG_CHAR_NUMBER_CONVERSION    
                                
C14W                            
C14W_CHAR_NUMBER_CONVERSION

Amit.

Read only

Former Member
0 Likes
1,333

Hi Gaurav,

U better use the field symbol for converting the data .

regards

Naresh

Read only

Former Member
0 Likes
1,333

Hi

It's strange, all these samples work fine:

PARAMETERS: P1 TYPE P DECIMALS 5.

DATA N(20) TYPE C.

START-OF-SELECTION.

  MOVE P1 TO N.

  WRITE: 'MOVE:', N.

  WRITE P1 TO N.

  WRITE: / 'WRITE', N.

  UNPACK P1 TO N.

  WRITE: / 'UNPACK', N.

Max

Read only

Former Member
0 Likes
1,333

Hi Gaurav,

I tried a small program and found no problem in moving the data. Just check the length of char field..or try this program


DATA: pack TYPE p DECIMALS 5,
      char(10) TYPE c.

pack = '5.00345'.
MOVE pack TO char.

WRITE char.

//Kothand

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,333

Hi,

what is the issue. Make sure that ur char variable is having sufficient length.

Check this code.


DATA: charec(20)  TYPE c ,
      typep  TYPE p DECIMALS 5 VALUE '12345.02545'.

charec =  typep.
CONDENSE charec.
WRITE: /1 charec,
       /1 typep.

Thanks,

Vinod.

Read only

Former Member
0 Likes
1,333

Thanks