‎2007 Jul 19 5:00 PM
Hi Experts,
I am populating an QUAN (abap type is P) type field to itab filed, which is defined as CHAR.
But, Dump is throwing! When I saw the SAP library, it saying that , its possible??
So, How to solve it? I mean, the DB filed is QUAN and my itab filed type is C(or in worst case, i can change to N?
<i>(SAP library:
The packed field is transported right-justified to the character field, if required with a decimal point. The last position is reserved for the sign. Leading zeros appear as blanks. If the target field is too short, the sign is omitted for positive numbers. If this is still not sufficient, the field is truncated on the left. ABAP indicates the truncation with an asterisk (*). If you want the leading zeros to appear in the character field, use UNPACK instead of MOVE.)</i>
thanq.
‎2007 Jul 19 5:03 PM
i am not getting any dump, can u post ur code
REPORT ZWOP_TEST1 .
DATA : V_DEC TYPE P DECIMALS 2 VALUE '12.35',
V_CHAR(17).
WRITE : V_DEC TO V_CHAR.
WRITE : V_CHAR.
‎2007 Jul 19 5:02 PM
Hello,
use <b>Write QUAN to ITAB-CHAR</b>
Check this example also.
PARAMETERS: P_EBELN LIKE EKPO-EBELN.
DATA: LR_EKPO LIKE EKPO.
DATA: CHAR(30).
SELECT SINGLE * FROM EKPO INTO LR_EKPO WHERE EBELN = P_EBELN.
WRITE: LR_EKPO-MENGE TO CHAR.
WRITE: CHAR.
VAsanth
Message was edited by:
Vasanth M
‎2007 Jul 19 5:03 PM
Hi,
U can change a quan field to C field.
Convert all field type to C
Reward points if helpful.
Regards.
Srikanta Gope
‎2007 Jul 19 5:03 PM
i am not getting any dump, can u post ur code
REPORT ZWOP_TEST1 .
DATA : V_DEC TYPE P DECIMALS 2 VALUE '12.35',
V_CHAR(17).
WRITE : V_DEC TO V_CHAR.
WRITE : V_CHAR.
‎2007 Jul 19 5:11 PM
See the below code and tested and works great.
report ztest_xyz.
data : begin of itab occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
kwmeng like vbap-kwmeng,
end of itab.
data : begin of i_final occurs 0,
vbeln(10) type c,
posnr like vbap-posnr,
matnr(18) type c,
kwmeng(17) type c,
end of i_final.
start-of-selection.
select vbeln posnr matnr kwmeng from vbap into table itab up to 100 rows
.
loop at itab.
move : itab-vbeln to i_final-vbeln,
itab-posnr to i_final-posnr,
itab-matnr to i_final-matnr,
itab-kwmeng to i_final-kwmeng.
condense i_final-kwmeng.
append i_final.
clear : i_final,
itab.
endloop.
Thanks
Seshu
‎2007 Jul 19 6:37 PM
Hi Sheshu,
The follwing is thrwing dump (QUANT(P)---->CHAR), when I changed ur code,
pls. go thur it.
data : begin of itab occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
matnr like vbap-matnr,
<b>kwmeng(17) type c,</b>end of itab.
data : begin of i_final occurs 0,
vbeln(10) type c,
posnr like vbap-posnr,
matnr(18) type c,
kwmeng(13) type p decimals 2,
end of i_final.
start-of-selection.
*select vbeln posnr matnr kwmeng from vbap into table itab up to 100
*rows
select kwmeng from vbap into itab-kwmeng.
append itab.
if sy-tabix = 10.
exit.
endif.
endselect.
loop at itab.
move : itab-vbeln to i_final-vbeln,
itab-posnr to i_final-posnr,
itab-matnr to i_final-matnr,
itab-kwmeng to i_final-kwmeng.
<b>*condense i_final-kwmeng.</b>append i_final.
clear : i_final,
itab.
endloop.
thanq.
‎2007 Jul 19 6:59 PM
What ever you written the code is wrong..
Always while selecting the data from database to internal table,use same type of data.
within loop you can pass the qty value to char value