Saturday, 4 January 2014

Case Statement in SAP ABAP

Case Statement in SAP ABAP


In ABAP When logical expressions are created and also linked together, it is always important to make the code as readable as possible. Generating many logical expressions on one line can of-ten be confusing. While the code will still work without problems, it is preferable to struc-ture your code across multiple lines and make use of other control structures if possible.
This is where the CASE statement can help. This does similar work to the IF statement but with the flexibility to make the code much more readable, but is at the same time limited to one logical expression. Here is an example code block for the CASE statement.

Case Statement in SAP ABAP


Like the IF statement, here the contents of the surname field are searched by the CASE statement, checking its contents and performing an action. The WHEN addition is used to check the field for different values, and WHEN OTHERS accounts for all values which are not specified elsewhere. The ENDCASE statement closes this control structure. This is in many ways much easier to read than a large amount of nested IFs and ELSEIFs.
You also have the facility to nest multiple CASE statements

Case Statement in SAP ABAP




9 comments:

  1. CASE statement is used for creating a control structure which contains various conditional execution of a statement depending upon search conditions. CASE statement will be ended with END CASE statement. Its faster method than using several IF .. ELSE conditions. SAP Online Training

    ReplyDelete
  2. Your information is really useful and interesting.Thanks for sharing this great article.If you are looking for best Oracle financials online course.
    Oracle fusion financials training

    ReplyDelete