‎2006 Aug 22 6:30 PM
Hello All,
I am reading the dataset and tryingto put the value directly in packed decimal. It is not getting the correct value into packed decimal field. It is getting some hexa decimal value. Does anyone kkow how to handle this problem?
Here is my code snippet:
data: begin of wa_file,
plant(4),
matnr(18),
csqty(14) type p decimals 4, "$010
sign,
date(8),
end of wa_file,
open dataset f_dsn for input in text mode.
if sy-subrc <> 0.
Error when opening file
message e000(zfi).
endif.
while 1 = 1.
read dataset f_dsn into wa_file.
if sy-subrc <> 0.
End of file
exit.
endif.
I am getting the value of 30303030303030303031343.5303 into wa_file-csqty.
Can you tell mw what is the right way to get this value. This data goes to MB1A thru BDC call transaction.
Thanks,
Sobhan.
‎2006 Aug 22 6:35 PM
Hi Sobhan,
Change the data type declaration of
csqty(14) type p decimals 4,
into
<b>csqty type p decimals 4 in wa_file.</b>
data: begin of wa_file,
plant(4),
matnr(18),
<b>csqty type p decimals 4, "$010</b>
sign,
date(8),
end of wa_file,
Thanks,
Vinay
‎2006 Aug 22 6:44 PM
Hi Vinay,
Thanks for the idea. I tried with that. I have got the value 30303030303.0303 into csqty field.
Thanks,
Sobhan.
‎2006 Aug 22 6:45 PM
hi
check whether the sequence of the fields in your file and your structure wa_file are same.
Cheers,
Abdul Hakim
‎2006 Aug 22 6:50 PM
Hi Abdul,
Thanks for the response.
The sequence of the fields is perfect. If I decalre that field as csqty(14), I can see the correct value.
Thanks,
Sobhan,
‎2006 Aug 22 7:30 PM
Hi Sobhan,
Try to OPEN DATASET statement with BINARY MODE and check for results.
open dataset f_dsn for input in <b>BINARY mode</b>.
(or)
If you get the value of cqty exactly by declaring it has character field of cqty(14) then assign this character value back to packed decimal.
Thanks,
Vinay
‎2006 Aug 22 7:42 PM
hi
then go ahead with that.
once you read into cstqty(14) you can split the value easily..
Cheers,
Abdul Hakim
Close the thread if your question has been answered...