Tuesday, 7 January 2014

Nested If Statements in SAP ABAP

Nested If Statements in SAP ABAP

Nested IF statements allow one to include IF statements inside other IF statements, for example
Nested If Statements in SAP ABAP

                                    
Here, the first IF statement will discount records where the Surname field value does not equal ‘SMITH’. For all records with a Surname = ‘SMITH’, the second IF statement checks to see if the record being processed has a Forename = ‘JOHN’. If it does the message “Youve won a car!” will be output to the screen. If not, a consolatory message will be out-put instead.
You are not limited to just one nested IF statement. Nesting can continue down as many levels / branches as is required by the program being written, for example:
Also,
                                 
Nested If Statements in SAP ABAP

Also, you do not simply have to nest statements one after another, but can put any other statements you need between, as long as the control structures are terminated correctly with, in this case, the ENDIF statement


2 comments: