‎2007 Aug 02 12:23 PM
Hi Experts,
I am using this type of calculation it goes to Dump.
INT_DATA-MENGE_PC = INT_DATA-MENGE_S / ( INT_DATA-MENGE_O + INT_DATA-MENGE_R ).
Dump is
Division by 0 (type P) in program "ZM_REPT_STOCK_RECONCILIATION1"
What happened?
Error in ABAP application program.
The current ABAP program "ZM_REPT_STOCK" had to be terminated
because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
What can you do?
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
Error analysis
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_ZERODIVIDE', was neither
caught nor passed along using a RAISING clause, in the procedure "SELECTION"
"(FORM)"
.
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
In the current program "ZM_REPT_STOCK_RECONCILIATION1", an arithmetic operation
('DIVIDE',
'/', 'DIV', or 'MOD') with a type P operand attempted to divide
by 0.
Thanks & Regards,
Sreedhar.
‎2007 Aug 02 12:26 PM
Hi sreedhar,
In this code
INT_DATA-MENGE_PC = INT_DATA-MENGE_S / ( INT_DATA-MENGE_O + INT_DATA-MENGE_R ).
if the value of INT_DATA-MENGE_O + INT_DATA-MENGE_R happens to be ZERO then you get this message.
What you can do to avoid this is, Before dividing check if INT_DATA-MENGE_O + INT_DATA-MENGE_R ne 0.
in other words,
data: lv_temp type datatype.
lv_temp = INT_DATA-MENGE_O + INT_DATA-MENGE_R .
if lv_temp ne 0.
INT_DATA-MENGE_PC = INT_DATA-MENGE_S / ( INT_DATA-MENGE_O + INT_DATA-MENGE_R ).
endif.
<b>
Reward points for helpful answers.</b>
Best Regards,
Ram.
‎2007 Aug 02 12:26 PM
Hi sreedhar,
In this code
INT_DATA-MENGE_PC = INT_DATA-MENGE_S / ( INT_DATA-MENGE_O + INT_DATA-MENGE_R ).
if the value of INT_DATA-MENGE_O + INT_DATA-MENGE_R happens to be ZERO then you get this message.
What you can do to avoid this is, Before dividing check if INT_DATA-MENGE_O + INT_DATA-MENGE_R ne 0.
in other words,
data: lv_temp type datatype.
lv_temp = INT_DATA-MENGE_O + INT_DATA-MENGE_R .
if lv_temp ne 0.
INT_DATA-MENGE_PC = INT_DATA-MENGE_S / ( INT_DATA-MENGE_O + INT_DATA-MENGE_R ).
endif.
<b>
Reward points for helpful answers.</b>
Best Regards,
Ram.
‎2007 Aug 02 12:27 PM
Hi Sreedhar,
As it is clearly stated from the stack dump that some of the statement is in advertly changing the dinominator of the expression to 0 and hence it is giving t his error. So put a break point in the code and check the values of the variables that are used in the code and check the values of the variables.
Hope that this will solve ur problem.
Thanks,
Samantak.
<i><b>Rewards points for useful answers.</b></i>
‎2007 Aug 02 12:28 PM
the value of int_data-menge_o + int_data-menger is 0 here..
either both of dem r 0 or both 've same value wid opposite sign.
so u should program a check dat if int_data-menge_o + int_data-menge_r is not zero den ur statement should be executed.
‎2007 Aug 02 12:29 PM
Hi
INT_DATA-MENGE_O + INT_DATA-MENGE_R = 0.
you can't divide by zero
add condition to check and prevent this situation.
Regards
Yossi
‎2007 Aug 02 12:29 PM
Hi,.
When you adding the INT_DATA-MENGE_O and_DATA-MENGE_R, the Sum is comming as 0, so that the dump is coming, can you look at the values INT_DATA-MENGE_O and DATA-MENGE_R, anyone of these values should come more than 1.
<b>Change the code like this..</b>
Data: L_SUM type MENGE.
L_SUM = INT_DATA-MENGE_O + INT_DATA-MENGE_R.
if L_SUM = '0'.
L_SUM = 1.
endif.
INT_DATA-MENGE_PC = INT_DATA-MENGE_S / L_SUM.Regards
Sudheer
‎2007 Aug 02 12:31 PM
Hi,
Before ur calculationpart use this check.
<b>IF( INT_DATA-MENGE_O + INT_DATA-MENGE_R) IS NOT INITIAL .</b>INT_DATA-MENGE_PC = INT_DATA-MENGE_S / ( INT_DATA-MENGE_O + INT_DATA-MENGE_R ).
<b>ENDIF.</b>
<i><i><b>Regards
Debjani
Reward points for helpful answer</b></i></i>