Intro to ABAP - Chapter 06_V1

Embed Size (px)

Citation preview

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    1/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    Basic Flow Control in ABAP

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    2/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    The IF Statement

    IF X =5.

      WI!" #$ %!&e 'alue o( X is

    5).

    "*S"IF X =6.

      WI!" #$ %!&e 'alue o( X is6).

    "*S" .

      WI!" #$ %X is neit&er 5 nor

    6)."+,IF.

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    3/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    Logical Expressions

    *ogial "/ressions use #

    "*A!I+A* "A!S

    *ICA* "A!S

    S!I+ CAIS+ "A!S

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    4/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    Comparison Syntax

    Is Equal to =, EQ

    Is not equal to < >, >, GT

    Greater than or equal to > =, = >, GE

    Less than

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    5/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    Logical Operators

    AN!"N!T

    !&e &ierar& o( t&e logial

    o/erators is#

     +! A+, and t&en .

    7ie di((erent (rom reating 'ie8s9

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    6/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    Good Programming Practice with

    Logical Operators

    I# not $ % = & '

    or not $ ( = )an*

    + = % or % =

    an* $ + = - '

    .a*

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    7/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    String Comparison Operators

    Comparison Syntax

    Contains only

    Contains any

    Contains strin/

    Contains pattern

    Contains not only

    Contains not any

    Contains no strin/

    Contains no pattern

    C!

    CA

    CS

    C0

    CN

    NA

    NS

    N0

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    8/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    The CASE Statement

    CASE

    S(12C!334

    on5t #or/et

    those

    perio*s6

        h e n

      !  S A  "  E

      # $

    7hen

    8S"T54

      h e n ! P I C %  # $

     h e n ! G E T & # $

       h e n

     ! S R  TA #$

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    9/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    The &O Loop

    ,.

    WI!" #$ %ello

    8orld>).

    "+,,. 

    ? =4.

    , ? !I"S.

    WI!" #$ %ello

    8orld>)."+,,.

     

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    10/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    The 'ILE Loop

    I( e/ression e'aluates to

    !@" ode in loo/ is

    eeuted.

    I( e/ression e'aluates to

    FA*S" ode in loo/ is

     +! eeuted and

    ontrol mo'es to a(ter"+,WI*".

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    11/15

    -

    IBM Global Services

    © Copyright IBM Corporation 2003

    (ested Loops and Control Str)ct)res

    , 2 !I"S.

      WI!" #$ S-I+,"X.

      , 3 !I"S.

      WI!" # $ % % S-I+,"X.  "+,,.

    "+,,.

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    12/15-

    IBM Global Services

    © Copyright IBM Corporation 2003

    The O( C'A(GE OF Statement

    S"*"C! B F C@S!".+ CA+" F C@S!"-

    C@+! C@S!"-

    S!A!".

      D.E

      "+,+.

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    13/15-

    IBM Global Services

    © Copyright IBM Corporation 2003

    The C'EC% Statement

    , 10 !I"S.

      C"C S-I+,"X G=

    4.

    WI!" #$ S-I+,"X.

    "+,,.

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    14/15-

    IBM Global Services

    © Copyright IBM Corporation 2003

    The E*IT Statement

    IF S-S@HC G0.

      "XI!.

    "+,IF.

     

  • 8/17/2019 Intro to ABAP - Chapter 06_V1

    15/15

    IBM Global Services

    © Copyright IBM Corporation 2003

    The CO(TI(+E Statement

    , 10 !I"S.

      IF S-I+,"X 4.

      C+!I+@" .

      "+,IF.

      WI!" #$ S-I+,"X."+,,.