Search This Blog

Thursday, February 18, 2010

Relational, Logical and Conditional Operators in SAP ABAP


Relational Operators:
The following are the relational operators in ABAP.
  • EQ à =
  • NE à <>
  • GT à >
  • LT à <
  • GE à >=
  • LE à <=

We can use both the symbolic representation as well as the character representation.


Logical Operators: 
  • Checking relation between multiple conditions are processed using logical operators.
          OR:     If any one of the conditions satisfies, then only it returns true.
         AND:     If all conditions are satisfied, then only it returns true.

Conditional Operators:

  • Controlling execution of a block of statements is processed using conditional statements.

    Single IF statement: IF <condition>.
                                       ----Block of stmts---
                                       ENDIF.

    IF – Else statement: IF <condition>.
                                       ----Block of stmts---
                                       ELSE.
                                       ----Block of stmts---
                                       ENDIF.

    Multiple IF statement: IF <condition1>.
                                           ----Block of stmts---
                                           ELSEIF <condition2>.
                                           ----Block of stmts---
                                           ELSE.
                                           ----Block of stmts---
                                           ENDIF.
The CASE Control Structure:
  • This control structure is introduced with the CASE statement. The CASE control structure allows you to control which statement blocks are processed based on the contents of a data object.
            CASE <v>.      
                WHEN <v11> [OR <v12> OR ...].
        <Statement block>
    WHEN <v21>.[OR <v22> OR ...]
        <Statement block>
    WHEN <v31> [OR <v32> OR ...].
        <statement block>
    WHEN ...
    ......
    WHEN OTHERS.
        <statement block>
ENDCASE.
  • The statement block following a WHEN statement is executed if the contents of <v> are the same as those of one of the fields <vij>.
  • Afterwards, the program carries on processing after the ENDCASE statement.
  • The statement block after the optional WHEN OTHERS statement is executed if the contents of <v> does not equal any of the <vij> contents.
  • The last statement block must be concluded with ENDCASE.

3 comments:

  1. Goyang Casino Hotel - Las Vegas
    Goyang Casino Hotel gri-go.com is the official name of the property for herzamanindir its gaming goyangfc.com facilities in the resort Las Vegas. The resort's gaming floor, 토토 사이트 casino, and spa https://septcasino.com/review/merit-casino/ are

    ReplyDelete