SAP ADD ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID ADD-TO
• ADD ABAP Statement
• TO ADD (obsolete)

ADD
Short Reference

ABAP_SYNTAX_OBS
ADD dobj1 TO dobj2.

What does it do?
This statement has the same effect as the statement
dobj2 += dobj1.
that is the same as
dobj2 = dobj2 + dobj1.
The content of dobj1 is added to the content of dobj2 and the result is assigned to dobj2. The data objects dobj1 and dobj2 must be numeric. Only data objects can be specified, no calls or other expressions. The calculation type is determined as for an arithmetic expression.



Latest notes:

The statement ADD has been fully replaced by the calculation assignment with the operator += in which the operands can also be specified as expressions.
NON_V5_HINTS
ABAP_HINT_END



Example ABAP Coding

The variable result_old has the value 10 after the calculation statements. The syntax for the calculation assignment with the same effect is also shown.
ABEXA 00001
ABAP_EXAMPLE_END



Runtime Exceptions



Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW
Reason for error:
Overflow in arithmetic operation (type p)
Runtime error:
BCD_OVERFLOW
Reason for error:
Integer overflow in addition
Runtime error:
COMPUTE_INT_PLUS_OVERFLOW
CX_SY_CONVERSION_OVERFLOW
Reason for error:
Overflow in arithmetic operation (type p, with specified length)
Runtime error:
BCD_FIELD_OVERFLOW

Non-catchable Exceptions

Runtime error:
ADD_FIELDS_ILLEGAL_ACCESS
Reason for error:
p field does not contain the correct <(>BCD<)> format
Runtime error:
BCD_BADDATA
ABAP_NONCAT_END

Return to menu