ABAP SUM statement with Internal Table loop

SUM statement in ABAP programming is used for calculating the total of field values in an internal table. It can be used only inside of a LOOP .. ENDLOOP statement. It will work only with valid numbers like integers, decimals or float. SUM statement should appear inside of  AT … ENDAT control block in an internal table loop.

Its Syntax

SUM

Main run-time errors with SUM statement

  • SUM_OVERFLOW
  • SUM_NO_INTERNAL_TABLE
  • SUM_ON_FOREIGN_INTERNAL_TABLE
  • SUM_NO_ASSIGNING
  • ADDF_INT_OVERFLOW

Sample program with SUM statement

ABAP SUM statement