sapdev logo background
sapdev logo sapdev logo

SAP ABAP Statement syntax including basic implementation code

See below for details and syntax for specific SAP ABAP statements but also note there are a few basic syntax rules which are valid for writing all ABAP code including:

•  All statements must end with period/full stop (Example: SELECT * from EKKO into it_ekko.)

•  ABAP statements and keywords are not case sensitive (Example: SELECT, Select, select).

•  String values are enclosed within single quotes (Example: ld_string = 'Hello World'.)

•  You can use * or " for commenting purposes. * must be placed at the start of the line and " can be placed any where.

Example using all of the above syntax rules

* The select statement retrieves data from the ekko table
* into an internal table called it_ekko
	Select *
	  FROM ekko              "get data for ekko table
	  into TABLE it_ekko
	 WhERe ebeln = '12345'.  "only retrieves values that match this where clause
"Note: You can use the pretty printer functionality to auto format your code

[+] Variable manipulation(TRANSLATE, CONDENSE, TAB, ROUND, MOD..)
Commands to change the contents of ABAP data fields

RANGE Statement/Command
Create a range table which is used to store a range of values, same structure as a select option

ABAP WRITE command
Display basic report output to user using WRITE

IF, CHECK and WHEN condition statements
Using the IF,CHECK and WHEN statements to add conditions to your ABAP program

Modifying data within an ABAP internal table or database table

UPDATE statement syntax
Updating data within an SAP database table

Display basic report output to user using WRITE

Used to check if a user has authroity to view/change sap data

EJECT Statement/Command to force a new page when printing
Forces new page when printing ABAP code listing

DESCRIBE SAP Statement/Command
The describe command is used to describe certain properties of and internal table

STRLEN command
Get value length of a SAP field using STRLEN command

MEMORY ID - Export and Import
Pass data between sap programs using MEMORY ID (Export/Import)

SELECT Statement/Command
Selecting data from SAP databases

SUBMIT report (Excecute rep from within a rep)
Executing a report from within another report using the SUBMIT statement

VARYING Statement/Command
Function of the DO loop which allows you to move horizontaly along a table row without actually having to specify each individual field name

Execute function module using STARTING NEW TASK statement

Execute function module using IN UPDATE TASK statement

Execute function module using IN BACKGROUND TASK statement

DELETE Statement/Command
Delete entries of an SAP internal table using the DELETE command

READ Statement/command
Get entries of an SAP internal table using the READ command

COLLECT Statement/Command
Insert entries into an SAP internal table and sum up interger values using the COLLECT command

PERFORM Statement/Command - passing internal table
Using the perform command to pass internal table

More ABAP Statements/Commands
See more SAP ABAP statements and their syntax

comments powered by Disqus