Application Development 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: 

Simple question: COMPUTE_BCD_OVERFLOW - how solve?

Former Member
0 Kudos

Hi,

I have a really simple problem but in the moment I can't find the right solution, so I hope you can give me a hint...

I try to calculate a percentage-value based on 2 given amounts (of money). So my codings looks like this:

diff_amount = amount - amount_comp.

IF amount NE 0.

diff_percent = diff_amount / amount * 100.

ELSE.

diff_percent = 0.

ENDIF.

I use own data-elemnts in de DDIC for the definition of the variables. So for the amounts I use the domain of SAP WERTV8 (this is type P) and for the percentage I use an own domain with DEC (length: 5, decimals: 2).

Now if there are high values in the amount-fields( going into the millions) I get an dump because of COMPUTE_BCD_OVERFLOW. But now I don't really know which data elements to use to implement such a simple calculation?

Please help me! Thanks a lot

Merry X-Mas

Markus

3 REPLIES 3

Former Member
0 Kudos

Hi Markus Glubka,

To avoid this error.

1. Define the character type field of length shown in the data element of the screen field.

2. now use write statement like write (currency type field ) to (char field ) unit ( currency unit ).

3. pass the value in the character field to screen field.

Think this will help you.

Reward if helpful.

0 Kudos

Hi,

thanks for your answer, do you mean I should define a field based on character values and should give the value of the calc to this field? Or did I misundertand you?

Because I don't think that could be a solution?

Greets

Markus

matt
Active Contributor
0 Kudos

Either find a data element that has a bigger length, or define you variables as TYPE P LENGTH 16 DECIMALS 2.

Your basic problem is that you've not defined your variables with sufficient length.

matt