SAP SUBTRACT-CORRESPONDING ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for SUBTRACT-CORRESPONDING

SUBTRACT-CORRESPONDING

Short Reference
• SUBTRACT-CORRESPONDING ABAP Statement
• FROM SUBTRACT-CORRESPONDING (obsolete)

ABAP Syntax(Obsolete)SUBTRACT-CORRESPONDING struc1 FROM struc2.

What does it do? This statement is not allowed in classes and subtracts structures by component. Structures must be specified for struc1 and struc2. For all identically named components in struc1 and struc2, the component in struc1 is subtracted in pairs from the component in struc2 and the result is assigned to the relevant component of struc2.

The names are compared, as in the statement MOVE-CORRESPONDING. For each component pair with the same name comp, the statement

SUBTRACT struc1-comp FROM struc2-comp. is executed, and the appropriate conversions are performed, if necessary.



Latest notes:This statement is error-prone because, particularly in
complex structures, it is not easy to check that components of the same name have the data type and content necessary for a numeric operation.



Runtime Exceptions

Catchable Exceptions
CX_SY_ARITHMETIC_OVERFLOW
Reason for error:
Overflow in conversion/arithmetic operation (T p)
Runtime error:
BCD_OVERFLOW
Reason for error:
Integer overflow after subtraction
Runtime error:
COMPUTE_INT_MINUS_OVERFLOW

CX_SY_CONVERSION_OVERFLOW
Reason for error:
Overflow in conversion/arithmetic operation (T p, with specified length)
Runtime error:
BCD_FIELD_OVERFLOW


Non-catchable Exceptions
Reason for error:
p field does not contain the correct BCD format
Runtime error:
BCD_BADDATA

Return to menu