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

Problem with read dataset

Former Member
0 Likes
685

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.

6 REPLIES 6
Read only

Former Member
0 Likes
638

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

Read only

0 Likes
638

Hi Vinay,

Thanks for the idea. I tried with that. I have got the value 30303030303.0303 into csqty field.

Thanks,

Sobhan.

Read only

abdul_hakim
Active Contributor
0 Likes
638

hi

check whether the sequence of the fields in your file and your structure wa_file are same.

Cheers,

Abdul Hakim

Read only

0 Likes
638

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,

Read only

0 Likes
638

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

Read only

0 Likes
638

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...