IF my_variable IS NOT INITIAL.And, here is a sample CASE statement:
ELSEIF NOT (my_variable > 0).
CASE my_variable.For looping, ABAP supports four different types. The first type is the DO/ENDDO, which has two variations. Notice that I use the sys-index variable in the IF condition, this is a system variable that counts how many times this loop has run.
(actions) WHEN OTHERS.
DOABAP also supports conditional loops:
IF sy-index > 100. EXIT. ENDIF.
DO n TIMES
WHILE sy-index <>ENDWHILEFinally, ABAP supports looping against database or internal tables:
SELECT (conditions)Along with sy-index, SAP has 170 other system fields (171 total). Some important or frequently used ones include: sy-mandt, sy-uname, sy-langu, sy-datum, sy-uzeit (time), and sy-subrc.
Another common task is producing dialog messages, in ABAP the followign syntax is used:
MESSAGE tnnn(message_class) WITH variable_one variable_two variable_nThe with statement is for including variables from you program into the message, and is optional. The 't' that proceeds the message number ('nnn') is the type of message to be displayed, below are the options.
- i - An informative message that appears as a modal dialog, the program is continued after it is displayed.
- s - A status bar message on the next screen.
- w - A warning message that appears in the status bar
- e - An error message that appears in the status bar
- a - An abort message that appears as a modal dialog box, the program terminates after it is displayed (and the users confirms).
- x - A short dump is generated as a runtime error, you probably don't want the user seeing these.