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 Packed Values

Former Member
0 Likes
668

Hi All

I have a file on application server. One of fields in the file has packed values. I have to transfer the data into an internal table how can unpack the field values?

Thanks In advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
605

hi Raj,

The range of the packed data type is 1 to 16 bytes.By default packed size is 8 bytes,

If u didn't specify any thing in the declaration. it occupies 8 bytes ... Ex. data num type p.

data num type p decimals 4. ... That means after integer it prints 3 decimals. Ex ouptut 1234.4567

data num(2) type p. Here It occupies only two bytes..

so when u take the field in ur internal table sturcture take according to the value u got in internal table from application server. or other wise take one variable and pass the value to a dummy variable var(15) type c, and loop ur internal table and append the var value to ur internal table field.

may hope this wil helpful

thanks and regards

dilip

3 REPLIES 3
Read only

Former Member
0 Likes
605

I am downloading data from a file in the application server into an internal table to display it as a report. The file contains packed values. I have to unpack them to show the actual values. How can it be done?

Read only

Former Member
0 Likes
606

hi Raj,

The range of the packed data type is 1 to 16 bytes.By default packed size is 8 bytes,

If u didn't specify any thing in the declaration. it occupies 8 bytes ... Ex. data num type p.

data num type p decimals 4. ... That means after integer it prints 3 decimals. Ex ouptut 1234.4567

data num(2) type p. Here It occupies only two bytes..

so when u take the field in ur internal table sturcture take according to the value u got in internal table from application server. or other wise take one variable and pass the value to a dummy variable var(15) type c, and loop ur internal table and append the var value to ur internal table field.

may hope this wil helpful

thanks and regards

dilip

Read only

Former Member
0 Likes
605

Hi,

Check this out

Pack

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/pack.htm

code

DATA C_FIELD(4) TYPE C VALUE '0103',

P_FIELD(2) TYPE P.

PACK C_FIELD TO P_FIELD.[/code]

Unpack

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/unpack.htm

codeDATA: P_FIELD(2) TYPE P VALUE 103,

C_FIELD(4) TYPE C.

UNPACK P_FIELD TO C_FIELD.[/code]

Regards,

KK