SAP StackFICOHRMMSDPMPSABAPNetWeaverTablesTcodes ☰MENU

ABAP IF statement

IF statement is used for creating a conditional control structure in ABAP programming. Normally two types of control structures are there in ABAP, One with IF statement and other with CASE statement.

IF statement can have a nested control structure by using several IF, ELSEIF statements inside an IF control block. IF control structure should always end with ENDIF statement. We can use any logic expressions along with IF statement (less than, greater than, equal to, true, false etc). If the condition with IF statement is true then the inside statements in IF block will execute, otherwise it will switch to next ELSE or ELSEIF or IF statement in the ABAP program.

 

Basic Syntax

IF <Logical Expression>

 

See a sample nested IF block

IF <condition1>

……

IF <condition2>

….

ELSE

……

ENDIF

ELSIF <condition3>

……

ELSEIF <condition 4>

…..

ENDIF.

 

By using ELSEIF statement we can avoid too much complex structure with IF statements inside an ELSE statement.

See a Sample ABAP program with IF statement

Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes

SAP ALECRMSCMSRMSAP Solutions SAP ReferencesSAP BasicsPP ModuleWMSAP Partners
HomeContact & Privacy PolicyTwitter
All of the product names here are trademarks of their respective companies. The site sapstack.com is not affiliated with SAP AG.
©2024 sapstack.com