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

calculation problem

Former Member
0 Likes
1,090

Hi

I'm getting a dump BCD_BADDATA. I am using a curr type field which is also used for adding another curr field.

ex A = A+B (both are curr fields)

But the values getting added is like

A = 3021.60- + 20202.02

Here it throws a dump "Packed field contains incorrect BCD format".

I'm not using packed numbers anywhere in the program though.

the field refers to a data element which is of curr type.

A LIKE BSIK-DMBTR,

B LIKE BSIK-DMBTR.

A = A + B

<REMOVED BY MODERATOR>

Varun mathur

Edited by: Varun Mathur on Feb 18, 2008 2:38 PM

Edited by: Alvaro Tejada Galindo on Feb 18, 2008 12:43 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,024

At some point you are probably saying something like:

B = space.

Change this to :

Clear B.

If B is in a structure, make sure you are not saying:

structure = space.

Rob

8 REPLIES 8
Read only

Former Member
0 Likes
1,024

hi,


 data : a type p decimals 2,
          b type p decimals 2.
   

Read only

Former Member
0 Likes
1,024

hi

good

check your declaration type is to F rather than I and see the difference, other wise try to change it to hexa decimal and see the changes.

thanks

mrutyun^

Read only

Former Member
0 Likes
1,025

At some point you are probably saying something like:

B = space.

Change this to :

Clear B.

If B is in a structure, make sure you are not saying:

structure = space.

Rob

Read only

0 Likes
1,024

well you did'nt get me . what i was saying was something like this.

V_AMOUNT LIKE BSIK-DMBTR

V_TOTAL LIKE BSIK-DMBTR.

Both are currency fields.

Now i am adding like

V_TOTAL = V_TOTAL + V_AMOUNT.

iteration 1 : V_TOTAL contains 1000-

iteration 2: V_TOTAL = 1000- + 20202.06

Can this result in a dump ,( negative + positive value ). Only thats my question.

Read only

0 Likes
1,024

V_AMOUNT type p decimasl 2,

V_TOTAL type p decimasl 2.

V_TOTAL = ( V_TOTAL ) + ( V_AMOUNT ).

Try this....

Read only

0 Likes
1,024

Well, you picked a type without a sign. Try:

DATA: v_amount TYPE kwert  VALUE '-1000.00',
      v_total  TYPE kwert  VALUE '2020.20'.

v_total = v_total + v_amount.

WRITE : /001 v_total.

Rob

Read only

Former Member
0 Likes
1,024

the problem is solved. it was not a calculation problem after all.

Read only

0 Likes
1,024

Same problem (old post) and again no answer given by the sender that solved himself...

Can someone post the answer pease?