SAP ADD ABAP Statements

Warning: Undefined variable $saptab in /customers/b/9/9/trailsap.com/httpd.www/abap-statements/index.php on line 46

Get Example source ABAP code based on a different SAP table
  

Warning: Undefined variable $prev in /customers/b/9/9/trailsap.com/httpd.www/abap-statements/index.php on line 62
Standard SAP Help for ADD

ADD

Short Reference
• ADD ABAP Statement
• TO ADD


ABAP Syntax ADD dobj1 TO dobj2.


What does it do? This statement has the same effect as the statement 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 have to be numeric. Predefined functions or functional methods cannot be specified. The calculation type is determined like an arithmetic expression.

ABAP_PGL Using Operator Format

Latest notes:Obsolete forms of statement ADD are ADD...THEN...UNTIL and ADD-CORRESPONDING.



Example ABAP Coding
After adding, the result contains the character
string '_________1'. The calculation type is decfloat34. The content of the character-type field result is converted to decfloat34 before the operation and back to c after the operation. DATA: operand TYPE decfloat16 VALUE 1,
result TYPE c LENGTH 10.

ADD operand TO result.



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 while adding
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

Return to menu