‎2014 Apr 03 8:44 AM
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
‎2014 Apr 03 8:56 AM
‎2014 Apr 03 3:06 PM
What is the field length of gwa_output-var_value ??
Try to increase the VAR_VALUE field length if possible..
‎2014 Apr 04 5:43 AM
Hi Rajesh,
gwa_output-var_value is of type integer(i).
Regards,
Pankaj
‎2014 Apr 04 7:09 AM
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
‎2014 Apr 04 9:42 AM
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
‎2014 Apr 05 10:53 AM
Hi Nabheet,
Even keeping that of type quantity is giving the same error.
Regards,
Pankaj
‎2014 Apr 07 11:50 AM
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.
‎2014 Apr 07 12:35 PM
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
‎2014 Apr 07 11:28 AM
Are you getting the dump at the same place.. ?? when you have changed the type of the variable.
‎2014 Apr 07 12:31 PM
‎2014 Apr 07 12:13 PM
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
‎2014 Apr 07 12:38 PM
Hi Klaus,
Thanks for your reply.
Yes , In program's attributes Fixed point arithmetic is set.
Regards,
Pankaj