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

COMPUTE_BCD_OVERFLOW Runtime Error in 'Z' Program

Former Member
0 Likes
3,636

Hi Gurus,

In one of my report, i am getting this error:

Run Time Error: Compute_BCD_Overflow

Exception              CX_SY_ARITHMETIC_OVERFLOW

Short text

    Overflow during the arithmetical operation (type P) in program

Error analysis

    An exception occurred that is explained in detail below.

    The exception, which is assigned to class 'CX_SY_ARITHMETIC_OVERFLOW', was not

     caught in

    procedure "OUTPUT_DATA" "(FORM)", nor was it propagated by a RAISING clause.

    Since the caller of the procedure could not have anticipated that the

    exception would occur, the current program is terminated.

    The reason for the exception is:

    An overflow was discovered in an ongoing arithmetical operation with

    operands of type P. Possible causes are:

    1. The result field of type P is too small for the result.

    2. The result or a intermediate result has more than 31 decimal places.

I searched a lot on SCN but most of the solutions are for standard SAP programs and SAP has provided notes for that.

I am pasting a part of subroutine. Below is subroutine in which error is coming:

FORM output_data .

   gt_data1_copy = gt_data1.

   SORT gt_data2 BY article site sloc.

   SORT gt_data1_copy BY article site sloc.

   LOOP AT gt_data1 INTO gwa_data1.

     READ TABLE gt_data2 INTO gwa_data2 WITH KEY article = gwa_data1-article

                                                 site = gwa_data1-site

                                                 sloc = gwa_data1-sloc BINARY SEARCH.

     IF sy-subrc = 0.

       gwa_output-soh_qty = gwa_data2-soh_qty.

       gwa_output-count_qty = gwa_data2-count_qty.

       gwa_output-var_qty = gwa_data2-var_qty.

       gwa_output-var_value = gwa_data2-var_qty * gwa_data2-map. "Error is coming at this point.

             "Here I am multiplying variance quantity to Moving average price(MAP) to get variance value.

     ENDIF.

endloop.

endform.

Request your help.

Appreciate Your Help in Advance.

Regards,

Pankaj

12 REPLIES 12
Read only

Former Member
0 Likes
1,771

This message was moderated.

Read only

Former Member
0 Likes
1,771

What is the field length of gwa_output-var_value ??


Try to increase the VAR_VALUE field length if possible..



Read only

0 Likes
1,771

Hi Rajesh,

gwa_output-var_value is of type integer(i).


Regards,

Pankaj

Read only

0 Likes
1,771

Why are you keeping it integer you..you should have with decimals..since quantity can have decimals.. keep you type as decimals with sufficient length and decimal places

Nabehet

Read only

0 Likes
1,771

Hi Nabheet,

Thanks for your reply.

ok..I ll try by keeping this as of type quantity.

data : var_value type mseg-menge.

Hope this will work fine.Actually this reports takes too much time. I ll run this in background and get back to you with result.

Regards,

Pankaj

Read only

0 Likes
1,771

Hi Nabheet,

Even keeping that of type quantity is giving the same error.

Regards,

Pankaj

Read only

0 Likes
1,771

You are multiplying a Quantity value with a Price.

Based on the Quality Unit and Price's Currency, the decimals will vary.

Anyways both are variables with decimal places, and hence the output has to be expected to be a packed variable.

Define var_value as type P.

Read only

0 Likes
1,771

Hi Vimal,

Thanks for your reply.

I am declaring var_value of type mseg-menge.

it has length of 13 with 3 decimal places. So it is also a packed variable.

Do correct me if i am wrong.

Regards,

Pankaj

Read only

Former Member
0 Likes
1,771

Are you getting the dump at the same place.. ?? when you have changed the type of the variable.

Read only

0 Likes
1,771

yes Rajesh

Read only

Former Member
0 Likes
1,771

Hi,

please check in your program's attributes, that flag Fixed point arithmetic is set.

If not, then you should multiply the result into a bigger work field  and devide it by 1000 to get the right value. At least you give the final value to your result field.

Regards,

Klaus

Read only

0 Likes
1,771

Hi Klaus,

Thanks for your reply.

Yes , In program's attributes Fixed point arithmetic is set.

Regards,

Pankaj