2008 Apr 15 7:39 PM
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
2008 Apr 15 9:05 PM
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
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
2008 Apr 15 8:18 PM
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?
2008 Apr 15 9:05 PM
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
2008 Apr 16 12:41 AM
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
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |