Programming

What Are ABAP Statements?

The source code of an ABAP program is made up of various ABAP statements.

 

Unlike other programming languages, such as C/C++ or Java, which contain a limited set of language-specific statements and provide most functionality via libraries, ABAP contains an extensive set of built-in statements.

 

The best way to learn about the various ABAP statements available is to put them in perspective with the requirements at hand. It’s beyond the scope of this post to cover all the available ABAP statements, so we’ll briefly introduce some popular statements here:

  • Declarative statements: Declarative statements define data types or declare data objects that are used by the other statements in a program. Examples include the following: TYPE, DATA, CONSTANTS, PARAMETERS, SELECT-OPTIONS, and TABLES.
  • Modularization statements: Modularization statements define the processing blocks in an ABAP program. Processing blocks allow you to organize your code into modules. All ABAP programs are made up of processing blocks, and different processing blocks allow you to modularize your code differently. Examples include the following: LOAD-OF-A-PROGRAM, INITIALIZATION, AT SELECTION SCREEN, START-OF-SELECTION, END-OF-SELECTION, AT USER-COMMAND, AT LINE-SELECTION, GET, AT USER COMMAND, AT LINE SELECTION, FORM-ENDFORM, FUNCTION-ENDFUNCTION, MODULEENDMODULE, and METHOD-ENDMETHOD.
  • Control statements: Control statements control the flow of the program within a processing block. Examples include IF-ELSEIF-ELSE-ENDIF, CASE-WHEN-ENDCASE, CHECK, EXIT, and RETURN.
  • Call statements: Call statements are used to call processing blocks or other programs and transactions. Examples include PERFORM, CALL METHOD, CALL TRANSACTION, CALL SCREEN, SUBMIT, LEAVE TO TRANSACTION, and CALL FUNCTION.
  • Operational statements: Operational statements allow you to modify or retrieve the contents of data objects. Examples include ADD, SUBTRACT, MULTIPLY, DIVIDE, SEARCH, REPLACE, CONCATENATE, CONDENSE, READ TABLE, LOOP AT, INSERT, DELETE, MODIFY, SORT, DELETE ADJACENT DUPLICATES, APPEND, CLEAR, REFRESH, and FREE.
  • Database access statements (Open SQL): Database access statements allow you to work with the data in the database. Examples include SELECT, INSERT, UPDATE, DELETE, and MODIFY.

Editor’s note: This post has been adapted from a section of the book Complete ABAP by Kiran Bandari.

Recommendation

Complete ABAP
Complete ABAP

Get everything you need to code with ABAP, all in one place! Are you a beginner looking for a refresher on the basics? You'll get an overview of SAP architecture and learn syntax. Already an experienced programmer and looking to improve your ABAP skills? Dive right into modifications and code enhancements. Understand the programming environment and build reports, interfaces, and applications with this complete reference to coding with ABAP!

Learn More
SAP PRESS
by SAP PRESS

SAP PRESS is the world's leading SAP publisher, with books on ABAP, SAP S/4HANA, SAP CX, intelligent technologies, SAP Business Technology Platform, and more!

Comments