ABAP short dumpObjectCOMPUTE_BCD_ZERODIVIDEModuleABAP

COMPUTE_BCD_ZERODIVIDE — Division by Zero on Packed Decimal Fields

COMPUTE_BCD_ZERODIVIDE is raised when ABAP code divides a packed decimal (BCD) value by a divisor that evaluates to zero at runtime, either through the division operator or the MOD operation. Unlike integer division by zero, this specifically involves DEC, CURR, QUAN or P-type fields, and almost always traces back to unguarded arithmetic on a configuration or master data value that was assumed to always be populated.

This page covers the COMPUTE_BCD_ZERODIVIDE runtime error, which fires when a packed decimal division or modulo operation encounters a zero divisor. It walks through the recurring causes in customer code and standard exits, what to read in the ST22 dump to pin down the offending statement, and how to fix the root cause rather than papering over the symptom.

Published 16 Sept 2026· 1,263 words

What the dump means

The dump means an ABAP statement attempted to divide a packed decimal number by zero, or ran a MOD operation with a zero right-hand side, and the kernel could not represent the result. Packed decimal arithmetic in ABAP does not silently return a sentinel value the way some floating point implementations do; it terminates the program with an uncaught runtime exception of class CX_SY_ZERODIVIDE. This is a catchable exception, which is exactly why the dump usually indicates a coding gap rather than a kernel defect: somewhere between the point the divisor was read and the point it was used in a division, nobody checked whether it was zero, and nobody wrapped the operation in a TRY block.

Root causes that actually produce it

  • Zero quantity or zero denominator in a per-unit calculation. Price-per-unit, cost-per-piece, or yield calculations that divide a total by a quantity field blow up the moment that quantity is zero, which happens routinely on newly created materials, cancelled deliveries, or lines where the quantity was cleared during a partial reversal.
  • Missing or incomplete master data. A conversion factor, exchange rate, or base unit of measure field in a custom table or a Z-structure defaults to zero when the record was never fully maintained, and downstream code divides by it without validation.
  • Custom code copied from a standard exit or BAdI implementation without adapting the boundary checks that existed in the original. The original had an IF divisor NE 0 guard; the copy dropped it during a quick modification.
  • Percentage or ratio calculations where the base value is derived from a sum that can legitimately be zero, such as dividing an amount by the total of a group of line items when that group is empty or all lines net to zero.
  • Pricing routines and condition formula exits (custom routines behind condition types) where a base value, scale quantity, or reference condition amount is zero on a specific document type or combination that was never tested.
  • Batch or interface programs processing incomplete source data, where a field expected to always carry a nonzero value from the sending system arrives blank or zero because of a mapping error, and the receiving program never validates it before using it in arithmetic.
  • Configuration tables driving conversions (unit of measure tables, currency conversion factor tables) that were only partially maintained after a rollout, so the calculation works for the tested unit or currency and fails for every other one.

What to inspect in ST22

  • Error analysis / exception class: confirms this is CX_SY_ZERODIVIDE, distinguishing it from COMPUTE_INT_ZERODIVIDE which is the integer variant and points to different field types.
  • Source code position and 'Information on where terminated': gives the exact program, include, and line number of the division or MOD statement, plus the variable names involved.
  • Active calls / events (call stack): shows which function module, method, or form the failing statement sits inside, which is critical when the divide happens inside a standard SAP routine called from custom exit code.
  • Contents of system fields / variable values at termination: many dumps show the current values of the operands, letting you confirm which one is actually zero.
  • Trigger location, in ABAP debugger with a breakpoint set one line before the failing statement, or by re-running the same document/transaction in SE80/SE38 with 'Debugging' active, to see what upstream logic produced the zero value.
  • Document or object key visible in the dump header (sales order, material, cost center) to reproduce the scenario functionally and check the master data or transaction data behind it in the relevant maintenance transaction.
  • SE16N or the relevant table display on the configuration or master table suspected of holding the zero divisor, to confirm whether the record is missing, blank, or genuinely zero by design.

Resolution path

If the divisor is a legitimate business value that can be zero (empty quantity, cancelled line, zero-based group), the fix is functional: the calculation logic needs a business rule for what to do when the divisor is zero, typically skip the calculation, default the result to zero, or exclude the record, and this normally requires a change request through custom code review since it changes program behavior. If the divisor is missing or incomplete master data (unmaintained conversion factor, blank exchange rate), the immediate fix is a data correction in the source table, no code change needed, followed by a data quality check across the object type to find other incomplete records before they cause the same dump elsewhere. If the divisor comes from a copied exit or routine where a guard was dropped, the fix is a code correction restoring the check, released through the normal transport process. In all cases, wrap the division in a TRY/CATCH on CX_SY_ZERODIVIDE only as a safety net after the business rule is decided; catching without deciding what value to substitute just moves the failure downstream.

The fix people try first (and why it fails)

The reflex fix is to wrap the division in TRY ... CATCH cx_sy_zerodivide ... ENDTRY and let the program continue with whatever value the field held before the failed statement, usually zero or the previous loop iteration's result. This stops the dump but produces silently wrong output: a zero price, a zero cost, a skipped allocation, that nobody notices until finance or the business questions a number weeks later. It also removes the diagnostic signal, so the next time the same missing master data record causes a problem elsewhere, there is no dump to point at it.

Prevention

Any division on a field sourced from configuration, master data, or an interface should be preceded by an explicit zero check with a defined fallback, not a blanket exception handler. Code review checklists for custom pricing routines, exits, and interface mapping programs should flag unguarded division operators as a mandatory finding. Where the divisor is a master data field, a data consistency report run periodically against the relevant table catches zero or blank conversion factors before they reach a live transaction.

Whose problem this is

This is an ABAP development problem when the code lacks a zero check, and a functional or master data problem when the underlying record is genuinely incomplete. Basis has no role beyond running ST22. The handover note should carry the program, include, and line number from the dump, the document or master data key that triggered it, and whether the zero divisor is expected business data or a data entry gap, since that determines whether development or the functional team owns the fix.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-abap-dumps/compute-bcd-zerodivideERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.