Google Search - Blog...........

Branching with CASE statement in sap abap

Branching with CASE statement

To execute different statement blocks depending on the contents of particular data fields, you can either use IF statement or the CASE statement as follows:

Syntax
CASE .
WHEN .

WHEN .

WHEN .

WHEN OTHERS.

ENDCASE.

The system executes the statement block after the WHEN statement if the contents of equals the contents of , and continues processing after the ENDCASE statement. The statement block after the optional WHEN OTHERS statement is executed if the contents of do not equal any of the contents. The last statement block must be concluded with ENDCASE.

The conditional branching using CASE is a shorter and simpler form of similar processing with IF. When you have many conditions IF becomes more complicated in such cases CASE is used.

No comments:

Post a Comment