Top Banner

of 85

ABAP Training - Module Poolnew

Jun 03, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/12/2019 ABAP Training - Module Poolnew

    1/85

    ABAP Training

    Module Pool Programming

    Dipayan Datta & Harikumar Sasidharan

  • 8/12/2019 ABAP Training - Module Poolnew

    2/85

    |

    ABAP Program Types

    Report Programs

    Conventional Report

    Interactive Report

    Online Programs

  • 8/12/2019 ABAP Training - Module Poolnew

    3/85

    |

    Screen Components

    Screen PainterScreen

    Attributes

    Screen

    Layout

    FieldAttributes

    Flow Logic

  • 8/12/2019 ABAP Training - Module Poolnew

    4/85

    |

    Screen Layout

    1 2

    3 4

    5

    6

    7

  • 8/12/2019 ABAP Training - Module Poolnew

    5/85 |

    ABAP Program Components

    Top Include

    PBO Modules

    PAI Modules

    ABAP

    Subroutines

  • 8/12/2019 ABAP Training - Module Poolnew

    6/85 |

    Online Program Processing Control

    DYNPRO PROCESSOR ABAP PROCESSOR

    ** SCREEN 9000 **

    PROCESS BEFORE OUTPUT.

    MODULE CLEAR.

    PROCESS AFTER INPUT.

    MODULE CHECK.

    MODULE SELECT.

    ** SCREEN 9001 **

    PROCESS BEFORE OUTPUT.

    PROCESS AFTER INPUT.

    MODULE UPDATE.

    ** INCLUDE MZAVGO01

    MODULE CLEAR OUTPUT.

    . . .

    ENDMODULE.

    ** INCLUDE MZAVGI01

    MODULE CHECK INPUT.

    . . .

    ENDMODULE.

    MODULE SELECT INPUT.

    . . .

    ENDMODULE.

    MODULE UPDATE INPUT.

    . . .

    ENDMODULE.

  • 8/12/2019 ABAP Training - Module Poolnew

    7/85 |

    Online Program Work Areas

    Screen Work Area Program Work Area

    PBO

    PAI

    Identical

    Names

    name

    Aaron

    phone

    215-387-3232

    city

    Philadelphia

    DATA name(10).

    Aaron

    DATA num(12).

    DATA city(20).

    Philadelphia

  • 8/12/2019 ABAP Training - Module Poolnew

    8/85

    |

    Creating an Online Program

    Program Attributes

    Title

    Type M

    Application

    Online program name

    must begin with SAPM

    and then either a Y or

    Z.

    Go back to RepositoryBrowser, not source

    code.

    With TOP INCL.

    should be checked.

  • 8/12/2019 ABAP Training - Module Poolnew

    9/85

    |

    Screen Attributes

    Screen Attributes

    Screen Painter

    ShortDescription Screen Type Next Screen

    required required optional

  • 8/12/2019 ABAP Training - Module Poolnew

    10/85

    |

    Flow Logic

    Screen Painter

    PROCESS BEFORE OUTPUT.

    MODULE INITIALIZE.

    PROCESS AFTER INPUT.

    MODULE CALCULATE.

    Flow

    Logic

    Command

    ABAP module to

    clear all fields before

    screen is displayed.

    ABAP module tocalculate average

    after user has

    entered values and

    pressed Enter.

    Screen 9000

    Flow Logic

  • 8/12/2019 ABAP Training - Module Poolnew

    11/85

    |

    ** SAPMY220_PLAYER_AVG **

    INCLUDE MY220_PLAYER_AVGTOP.

    INCLUDE MY220_PLAYER_AVGO01.

    INCLUDE MY220_PLAYER_AVGI01.

    ABAP Modules

    Main Program PBO Module** MY220_PLAYER_AVGO01 - Include

    Program **

    MODULE INITIALIZE OUTPUT.

    CLEAR: POINTS, GAMES, AVERAGE.

    ENDMODULE.

    PAI Module

    ** MY220_PLAYER_AVGI01 - Include Program **

    MODULE CALCULATE INPUT.CHECK GAMES 0.

    AVERAGE = POINTS / GAMES.

    ENDMODULE.

    The fields POINTS,

    GAMES, and

    AVERAGE needto be defined as

    global data.

  • 8/12/2019 ABAP Training - Module Poolnew

    12/85

    |

    Global Data

    Top Include** MY220_PLAYER_AVGTOP - Include Program **

    PROGRAM SAPMY220_PLAYER_AVG.

    DATA: POINTS TYPE I,

    GAMES TYPE I,

    AVERAGE TYPE P

    DECIMALS 2.

    Main Program

    ** SAPMY220_PLAYER_AVG **

    INCLUDE MY220_PLAYER_AVGTOP.

    INCLUDE MY220_PLAYER_AVGO01.

    INCLUDE MY220_PLAYER_AVGI01.

    It is important that these

    program fields are named

    the same as the screen fields

    so automatic data transport

    will occur between the

    screen work area andprogram work area.

  • 8/12/2019 ABAP Training - Module Poolnew

    13/85

    |

    Screen to Program Data Transport

    Player Average

    Total Points

    Total Games

    165

    6

    When the PAI event is triggered,

    values are transported from the

    screen work area to the program

    fields with the same names before

    any PAI modules are executed.

  • 8/12/2019 ABAP Training - Module Poolnew

    14/85

    |

    Transaction Code

    Transaction

    Text

    F8

    Program Name Initial Screen

    required required required

    SAPMY220_PLAYER_AVG 9000

    Executing an Online Program

  • 8/12/2019 ABAP Training - Module Poolnew

    15/85

    |

    Question???

    PROCESS BEFORE OUTPUT.

    MODULE CALCULATE.

    PROCESS AFTER INPUT.

    Screen 9001

    PROCESS BEFORE OUTPUT.

    MODULE INITIALISE.

    PROCESS AFTER INPUT.

    MODULE CALCULATE.

    Screen 9000

    We could have calculated the players average in the PBO of screen9001. Why is it better to do the calculation in the PAI of screen

    9000 instead of the PBO of screen 9001?

  • 8/12/2019 ABAP Training - Module Poolnew

    16/85

    |

    Graphical Elements

    1 2

    3 4

    5

    6

  • 8/12/2019 ABAP Training - Module Poolnew

    17/85

    |

    ABAP Course #3

    Description

    Instructor

    This course covers online programming techniques.

    Anthon, Dionne

    ABAP Course #3

    Description

    Instructor

    course covers online prog

    Anthon, Dionne

    scrollable field

    Scrollable fields have a visible length that is

    smaller than the defined length.

    These lengths are

    attributes of a field.

    Scrollable Fields

  • 8/12/2019 ABAP Training - Module Poolnew

    18/85

    |

    ABAP Course #3

    Description

    Instructor

    This course covers online

    Anthon, Dionne

    Anthon, Dionne

    Bacon, Patricia

    Banning, Mark

    Cooper, Angela

    Shepski, LeeSearch help is an

    attribute of a field.

    It can only be used on

    input/output

    templates.

    If you assign a search help to an

    input/output template, you will see

    a drop-down arrow to get a list of

    possible values (F4).

    Using Search Helps

  • 8/12/2019 ABAP Training - Module Poolnew

    19/85

    |

    Use Dictionary Fields

    ** MZA01O01 - PBO Modules **MODULE INITIALISE OUTPUT.

    CLEAR YMOVIE.

    ENDMODULE.

    ** MZA01TOP - Top Include **

    PROGRAM SAPMZA01.

    TABLES YMOVIE.

    PROCESS BEFORE OUTPUT.

    MODULE INITIALIZE.

    PROCESS AFTER INPUT.

    MODULE SELECT_LISTING.

    Screen 9000

    ** MZA01I01 - PAI Modules **

    MODULE SELECT_LISTING INPUT.

    * code to select record from YMOVIE

    ENDMODULE.

    When you

    paint screen fields from

    the ABAP Dictionary, you define

    the program fields with the

    TABLES statement.

  • 8/12/2019 ABAP Training - Module Poolnew

    20/85

    |

    Online Help for Dictionary Fields

    Academy Awards

    Year

    Category

    1994

    PIC

    Data elementshort text

    Data element

    documentationData element

    supplementaldocumentation

    system-wide

    automatic

    system-wideonly if maintained

    screen-specific

    only if maintained

    If a screen field is

    painted from the

    ABAP Dictionary,

    it points to a data

    element and the

    data elements

    online help.

    F1

  • 8/12/2019 ABAP Training - Module Poolnew

    21/85

    |

    ABAP Dictionary Integration

    Academy Awards

    Year

    Category

    Academy Awards

    Year

    Category

    If a change is made to an ABAP Dictionary field (e.g., category length ischanged from 3 to 6 characters) and the appropriate Dictionary objects

    are reactivated, the change will take effect throughout the system

    where this field is used.

    Execute

    transaction

    Notice change

    in Category

    field length

    Execute

    transaction

  • 8/12/2019 ABAP Training - Module Poolnew

    22/85

    |

    Automatic Checks

    Required Field Entered ?

    Proper Format ?

    Foreign Key Value ?

    Valid Value ?

    Values in all

    input/output

    templates are

    checked for

    Values in

    input/output

    templates painted

    from the ABAPDictionary are

    checked for

  • 8/12/2019 ABAP Training - Module Poolnew

    23/85

    |

    Timing of Automatic Checks

    SCREEN PROCESS BEFORE OUTPUT.

    PROCESS AFTER INPUT.

    MODULE ONE.

    MODULE TWO.

    YESNO

    Module ONE

    executed.

    Module TWO

    executed.

    Go to PBO of

    next screen

    Data transport from screen

    fields to

    program fields with the

    same names.

    Automatic

    Screen Field

    Checks OK?

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    24/85

    |

    Required Field Check

    Academy Awards

    Year

    Category

    ?

    PIC

    Fields can be marked asrequired two ways: (1) use a

    question mark ? as the first

    character of an input/output

    template or (2) check on

    the field attribute for required

    entry.

    E: Required entry not made

    Academy Awards

    Year

    Category

    ?

    PICIf a required field is not entered,

    the system will display the error

    message: Required entry not

    made.

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    25/85

    |

    Academy Awards

    Year

    Category

    19a4

    PIC

    Field Format Check

    E: Enter a numeric value

    Academy Awards

    Year

    Category

    19a4

    PIC

    The AAYEAR field in theYMOVIE table has the NUMC

    (numeric character) data

    type. The system will

    automatically check that the

    user has entered all numbers

    in this field.

    If a field format is incorrect, the

    system will display an appropriate

    error message.

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    26/85

    |

    Foreign Key Check

    Address Information

    Customer # C32

    E: Entry C32 does not exist (please check your entry)

    Address Information

    Customer # C32

    This customer number fieldpainted from the ABAP Dictionary

    has a foreign key relationship

    maintained. Because of this

    relationship, you will see a drop-

    down arrow to get a list of possible

    values (F4).

    If the value entered does not exist in the foreign key (check) table,

    the system will display the error message: Entry does not

    exist (please check your entry).

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    27/85

    |

    Valid Value Check

    Academy Awards

    Year

    Category

    1994

    PI

    E: Please enter a valid value

    Academy Awards

    Year

    Category

    1994

    PI

    The CATEGORY field in theYMOVIE table points to a domain

    with a set of valid values.

    Because of this set of valid

    values, you will see a drop-down

    arrow to get a list of possible

    values (F4).

    If a valid value is notentered, the system will

    display the error message:

    Please enter a valid value.

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    28/85

    |

    Overview

    Academy Awards

    Year

    Category

    1910

    PIC

    Academy Awards

    Year

    Category

    1910

    PIC

    Winner No record exists

    Notes

    EnterAcademy Awards

    Year

    Category

    1910

    PIC

    E: No record exists

    X Instead of informing the user onthe second screen that a record

    does not exist, we want to issue

    a message on the first screen.

  • 8/12/2019 ABAP Training - Module Poolnew

    29/85

    |

    MESSAGE Statement

    ** MZA02TOP - Top Include **

    PROGRAM SAPMZA02 MESSAGE-ID ZA.

    TABLES YMOVIE.

    ** MZA02I01 - PAI Modules **

    MODULE SELECT_LISTING INPUT.

    * code to select record from YMOVIE

    IF SY-SUBRC 0.

    YMOVIE-WINNER = No record exists.MESSAGE E001.

    ENDIF.

    ENDMODULE.

    t = message type

    nnn = message number

    --------------------------------------

    var1 = message variable 1

    var2 = message variable 2

    var3 = message variable 3var4 = message variable 4

    MESSAGE [WITH ].

    Message class (ID) must

    be specified on

    PROGRAM statement in

    Top Include.

    MESSAGE statement in PAI

    module of first screen.

  • 8/12/2019 ABAP Training - Module Poolnew

    30/85

    |

    Message Types

    The message

    type determines

    where the

    message isdisplayed and

    what action the

    user can or must

    take on the

    current screen.

    S: success

    I: information

    A: abend

    X: exit

    W: warning

    E: error

    i

    X

  • 8/12/2019 ABAP Training - Module Poolnew

    31/85

    |

    Success Message

    Academy Awards

    Year

    Category

    1910

    PIC

    Winner

    Notes

    No record exists

    Academy Awards

    Year

    Category

    1910

    PIC

    MESSAGE S001.PAI Module of 1st Screen

    The SUCCESS message

    is displayed at thebottom of the next

    screen; therefore, the

    user cannot

    make any changes to

    the values on the

    current screen.

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    32/85

    |

    MESSAGE I001.

    PAI Module of 1st ScreenAcademy Awards

    Year

    Category

    1910

    PIC

    Academy Awards

    Year

    Category

    1910

    PIC

    The INFORMATION message

    is displayed on the currentscreen in a dialog box. The

    user cannot make any

    changes to the values on the

    current screen. After

    pressing the Enter key on

    the dialog box, the user willbe taken to the

    next screen.

    i

    i No record exists

    Enter

    Information Message

  • 8/12/2019 ABAP Training - Module Poolnew

    33/85

    |

    MESSAGE A001.PAI Module of 1st ScreenAcademy Awards

    Year

    Category

    1910

    PIC

    Academy Awards

    Year

    Category

    1910

    PIC

    The ABEND message is

    displayed on the currentscreen in a dialog box. The

    user cannot make any

    changes to the values on the

    current screen.

    After pressing the Enter

    key on the dialog box,the transaction will

    be terminated.

    No record exists

    Enter

    Abend Message

  • 8/12/2019 ABAP Training - Module Poolnew

    34/85

    |

    Academy Awards

    Year

    Category

    1910

    PIC

    W: No record exists

    Warning Message

    PAI Module of 1st ScreenAcademy Awards

    Year

    Category

    1910

    PIC

    The WARNING message is

    displayed at the bottom of

    the current screen. The user

    can make changes to the

    values on the current screen,

    but does not have to make

    any changes. After pressing

    the Enter key on the currentscreen, the user will be taken

    to the next screen.

    MESSAGE W001.Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    35/85

    |

    Error Message

    MESSAGE E001.PAI Module of 1st ScreenAcademy Awards

    Year

    Category

    1910

    PIC

    Academy Awards

    Year

    Category

    1910

    PIC

    E: No record exists

    The ERROR message is

    displayed at the bottom of the

    current screen. The user must

    make changes to the values on

    the current screen. After

    pressing the Enter key on the

    current screen, the user will be

    taken to the next screen only ifthe appropriate corrections

    were made.

    X

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    36/85

    |

    Problem !!!

    When we issue a WARNING or ERROR message, the system stopson the current screen to allow the user to make corrections;

    however, these fields are not open for input.

    Academy Awards

    Year

    Category

    1910

    PIC

    W: No record exists

    Academy Awards

    Year

    Category

    1910

    PIC

    E: No record exists

  • 8/12/2019 ABAP Training - Module Poolnew

    37/85

    |

    Overview

    Academy AwardsYear

    Category

    1932

    PIC

    Academy Awards

    Year

    Category

    1932

    PIC

    E: No record exists

    Academy Awards

    Year

    Category

    1932

    PIC

    E: No record exists

    User-defined check

    without flagging fields as

    open for input

    User-defined check

    with flagging fields as

    open for input

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    38/85

  • 8/12/2019 ABAP Training - Module Poolnew

    39/85

    |

    Flow Logic FIELD Statement

    Issue error or warningmessage in PAI Module

    Issue error or warning

    message with Flow Logic

    SELECT statement

    Define valid values

    with Flow Logic

    VALUES statement

    Flow Logic FIELD statementkeeps a single screen field

    open for input on an error or

    warning message.

    PROCESS AFTER INPUT.

    FIELD

    MODULE .

    PROCESS AFTER INPUT.

    FIELD

    SELECT * FROM . . . .

    PROCESS AFTER INPUT.

    FIELD

    VALUES (, ).

    FlowLogic

    Command

  • 8/12/2019 ABAP Training - Module Poolnew

    40/85

    |

    PAI Module Check

    Academy Awards

    Year

    Category

    1932

    PIC

    Academy Awards

    Year

    Category

    1932

    PIC

    E: No record exists

    PROCESS AFTER INPUT.FIELD YMOVIE-AAYEAR

    MODULE SELECT_LISTING.

    ** MZA03I01 - PAI Modules **MODULE SELECT_LISTING INPUT.

    * code to select record from YMOVIE

    IF SY-SUBRC 0.

    MESSAGE E001.

    ENDIF.

    ENDMODULE.

    This Flow Logic FIELD statement

    will leave the YMOVIE-AAYEAR

    screen field open for input if an

    error or warning message isissued in the SELECT_LISTING

    module.

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    41/85

    |

    Flow Logic SELECT Check

    Academy Awards

    Year

    Category

    1932

    PIC

    Academy Awards

    Year

    Category

    1932

    PIC

    E: No record exists

    This Flow Logic SELECT statement will retrieve one record. If no record matches, an error

    message is issued. The Flow Logic FIELD statement will leave the

    YMOVIE-AAYEAR screen field open for input if this error message is issued.

    PROCESS AFTER INPUT.

    FIELD YMOVIE-AAYEARSELECT * FROM YMOVIE

    WHERE AAYEAR = YMOVIE-AAYEAR

    AND CATEGORY = YMOVIE-CATEGORY

    INTO YMOVIE

    WHENEVER NOT FOUND

    SEND ERRORMESSAGE 001.

    Flow

    Logic

    Command

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    42/85

    |

    Multiple Fields Open for Input

    Academy Awards

    Year

    Category

    1932

    PIC

    Academy Awards

    Year

    Category

    1932

    PIC

    E: No record exists

    This Flow Logic CHAIN and ENDCHAIN group the FIELD statements and the MODULEstatement together. The Flow Logic FIELD statements will leave both the YMOVIE-AAYEAR

    and YMOVIE-CATEGORY screen fields open for input if an error or warning message is

    issued in the SELECT_LISTING module.

    PROCESS AFTER INPUT.

    CHAIN.FIELD: YMOVIE-AAYEAR,

    YMOVIE-CATEGORY.

    MODULE SELECT_LISTING.

    ENDCHAIN.

    Flow

    Logic

    Command

    Enter

  • 8/12/2019 ABAP Training - Module Poolnew

    43/85

    |

    Enter

    PROCESS AFTER INPUT.

    MODULE ONE.

    FIELD A MODULE TWO.

    CHAIN:FIELD: B, C.

    MODULE THREE.

    ENDCHAIN.

    FIELD A MODULE FOUR.

    Data transported from screen fields D

    and E to program fields D and E. FieldsA, B, and C are not transported yet

    because these fields are in a FIELD

    statement.

    Data transport for field A.

    Module ONE executed.

    Module TWO executed.

    Data transport for fields B and C.

    Module THREE executed.

    Module FOUR executed.

    Go to PBO of next screen

    YES

    A

    B

    CD

    E

    NO

    AutomaticScreen Field

    Checks

    OK?

    Data Transport in PAI Event

  • 8/12/2019 ABAP Training - Module Poolnew

    44/85

    |

    Questions???

    PROCESS AFTER INPUT.

    FIELD A .

    FIELD B

    SELECT * FROM TABLE

    WHERE FIELD1 = A

    AND FIELD2 = B

    INTO TABLE

    WHENEVER NOT FOUND

    SEND ERRORMESSAGE 001.

    FIELD A MODULE SELECT_LISTING.

    This FIELD statement is not associated

    with a PAI module, a Flow Logic

    SELECT statement, or a Flow Logic

    VALUES statement; however, it is

    essential for the execution of this PAI

    event. WHY???

    If this error message is

    issued, will screen field A

    be open for input?

  • 8/12/2019 ABAP Training - Module Poolnew

    45/85

    |

    Overview

    Academy Awards

    Year

    Category

    1994

    PIC

    Execute

    transactionDefault

    Values

    Academy Awards

    Year

    Category

    1994

    PIC

    Winner Forrest Gump

    Notes The Shawshank Redemption should have won.

    Cursor

    Positioning

  • 8/12/2019 ABAP Training - Module Poolnew

    46/85

    |

    Using Parameter IDs

    SET/GET

    PARAMETER ID

    ABAP Statement

    SPA/GPAField Attributes

    OR

  • 8/12/2019 ABAP Training - Module Poolnew

    47/85

    |

    ** MZA04O01 - PBO Modules **

    MODULE INITIALIZE OUTPUT.

    YMOVIE-AAYEAR = 1994.

    YMOVIE-CATEGORY = PIC.

    GET PARAMETER ID YYR FIELD YMOVIE-AAYEAR.

    GET PARAMETER ID YCT FIELD YMOVIE-CATEGORY.

    ENDMODULE.

    ** MZA04I01 - PAI Modules **

    MODULE SELECT_LISTING INPUT.

    * code to select record from YMOVIE

    SET PARAMETER ID YYR FIELD YMOVIE-AAYEAR.

    SET PARAMETER ID YCT FIELD YMOVIE-CATEGORY.

    ENDMODULE.

    Academy Awards

    Year

    Category

    1994

    PIC

    Parameter ID Memory

    YYR = 1994

    YCT = PIC

    GET

    SET

    SET/GET PARAMETER ID Statement

  • 8/12/2019 ABAP Training - Module Poolnew

    48/85

    |

    SPA/GPA Field Attributes

    Notice the

    parameter

    ID name

    You can check the GPA

    field attribute instead ofcoding the GET

    PARAMETER ID

    statement in a

    PBO module.

    You can check the SPA

    field attribute instead ofcoding the SET

    PARAMETER ID statement in

    a PAI module.

  • 8/12/2019 ABAP Training - Module Poolnew

    49/85

    |

    Cursor Position

    Academy Awards

    Year

    Category

    1994

    PIC

    Winner Forrest Gump

    Notes The Shawshank Redemption should have won.

    Upon entering a screen, the cursor will

    automatically be positioned in the firstinput/output template open for input unless you

    position the cursor in a different field using the

    screen attributes or a PBO module.

  • 8/12/2019 ABAP Training - Module Poolnew

    50/85

    |

    Positioning the Cursor

    Academy Awards

    Year

    Category

    1994

    PIC

    Winner Forrest Gump

    Notes The Shawshank Redemption should have won.

    Screen AttributesShort Description

    Screen Type

    Cursor position YMOVIE-NOTES

    ** PBO Module **

    MODULE INITIALIZE OUTPUT.

    SET CURSOR FIELD

    YMOVIE-NOTES.

    ENDMODULE.

    OR

    New Cursor

    Position

    S GUI S /Ti l i PBO M d l

  • 8/12/2019 ABAP Training - Module Poolnew

    51/85

    |

    Set GUI Status/Title in PBO Module

    ** MZA05O01 - PBO Modules **MODULE INITIALIZE OUTPUT.

    IF SY-DYNNR = 9000.

    SET PF-STATUS FIRST.

    SET TITLEBAR ONE.

    ELSE.SET PF-STATUS SECOND.

    SET TITLEBAR TWO.

    ENDIF.

    ENDMODULE.

    PROCESS BEFORE OUTPUT.

    MODULE INITIALIZE.

    Screen 9000

    PROCESS BEFORE OUTPUT.

    MODULE INITIALIZE.

    Screen 9001

    SY-DYNNR =

    current

    screen

    number

    Notice that the call to moduleINITIALIZE in the PBO of each

    screen refers to the same ABAP

    module.

  • 8/12/2019 ABAP Training - Module Poolnew

    52/85

    |

    GUI Status Type

    Screen Type

    Normal

    Screen Type

    Modal Dialog Box

    GUI Status Type

    Online Status

    GUI Status Type

    Dialog Box

    Screen type defined in the

    Screen Attributes of the

    Screen Painter.

    GUI status type defined in

    the Menu Painter.

  • 8/12/2019 ABAP Training - Module Poolnew

    53/85

    |

    Checking Function Code Triggered

    ** MZA05TOP - Top Include **

    PROGRAM SAPMZA05 MESSAGE-ID ZA.

    TABLES YMOVIE.DATA OKCODE(4).

    To check the OK Code of an online

    program, you must define this field

    in both the screen (Field List) and

    the program work area (TopInclude). Remember that these

    fields must be given the same

    name.

    O CO

  • 8/12/2019 ABAP Training - Module Poolnew

    54/85

    |

    Using the OKCODE

    ** MZA05I01 - PAI Modules **

    MODULE SELECT_LISTING INPUT.

    IF OKCODE = EDIT.

    * code to select record from YMOVIE

    ENDIF.

    ENDMODULE.

    ** MZA05O01 - PBO Modules **

    MODULE INITIALIZE OUTPUT.

    * code to set GUI status/title

    CLEAR OKCODE.

    ENDMODULE.

    Academy Awards

    Year

    Category

    1994

    PIC

    Exit Edit Loop

    We only want to select a record

    from YMOVIE if the user has

    invoked the EDIT function

    code (e.g., clicked on the Editpushbutton).

    You should clear out the

    OKCODE beforea screen is

    displayed so an old value

    does not remain if the user

    presses Enter.

    F ti T

  • 8/12/2019 ABAP Training - Module Poolnew

    55/85

    |

    Function Types

    Function Code

    Type Type E Type S Type TType P

    O i

  • 8/12/2019 ABAP Training - Module Poolnew

    56/85

    |

    Overview

    Academy Awards

    Year

    Category

    1994

    PIC

    Exit Edit Loop

    Academy Awards

    Year

    Category

    1994

    PIC

    Winner Forrest Gump

    Notes The Shawshank Redemption should have won.

    Critic Dean Enter Name

    Exit Update

    Currently, the screen sequence

    of our online program is

    determined by static Next

    Screen attributes on each

    screen. We will learn how to

    dynamical lyset the screen

    sequence and add a pop-up

    dialog box to enter a critics

    name.

  • 8/12/2019 ABAP Training - Module Poolnew

    57/85

    SET SCREEN Statement

  • 8/12/2019 ABAP Training - Module Poolnew

    58/85

    |

    SET SCREEN Statement

    PROCESS AFTER INPUT.

    FIELD YMOVIE-AAYEAR

    VALUES (BETWEEN 1927 AND 1996).

    CHAIN.

    FIELD: YMOVIE-AAYEAR,

    YMOVIE-CATEGORY.MODULE SELECT_LISTING.

    ENDCHAIN.

    Screen 9000

    Next Screen

    attribute is 9000.

    ** MZA06I01 - PAI Modules **

    MODULE SELECT_LISTING INPUT.

    IF OKCODE = EDIT.

    SET SCREEN 9001.

    * code to select record from YMOVIE

    ENDIF.

    ENDMODULE.

    When SET SCREEN is encountered,

    the system temporarily ignores the

    value in the Next Screen attributeand uses the value specified instead.

    The current screens PAI processing is

    no tterminated.

    LEAVE TO SCREEN Statement

  • 8/12/2019 ABAP Training - Module Poolnew

    59/85

    |

    LEAVE TO SCREEN Statement

    PROCESS AFTER INPUT.

    FIELD YMOVIE-AAYEAR

    VALUES (BETWEEN 1927 AND 1996).

    CHAIN.

    FIELD: YMOVIE-AAYEAR,

    YMOVIE-CATEGORY.

    MODULE SELECT_LISTING.ENDCHAIN.

    Screen 9000

    Next Screen

    attribute is 9000.

    ** MZA06I01 - PAI Modules **

    MODULE SELECT_LISTING INPUT.

    IF OKCODE = EDIT.

    * code to select record from YMOVIE

    LEAVE TO SCREEN 9001.

    ENDIF.

    ENDMODULE.

    When LEAVE TO SCREEN is

    encountered, the system terminates

    the current screens PAI event andimmediately goes to the PBO event

    of the screen specified in the

    statement.

    CALL SCREEN Statement

  • 8/12/2019 ABAP Training - Module Poolnew

    60/85

    |

    CALL SCREEN Statement

    Academy Awards

    Year

    Category

    Winner

    Notes should have won.

    Critic Enter Name

    Exit Update

    Enter critics name

    Dean

    Titlebar

    Exit

    CALL SCREEN 9002 STARTING AT 30 5 ENDING AT 60 10.

    This ABAP code would be in a PAI

    module for screen 9001.

    Screen 9002 is a

    Modal dialog boxtype screen with a

    dialog box type GUI

    status.

  • 8/12/2019 ABAP Training - Module Poolnew

    61/85

    Question ???

  • 8/12/2019 ABAP Training - Module Poolnew

    62/85

    |

    Question ???

    Screen Attributes

    Short Description

    Screen Type

    Next screen 9100

    Screen 9100

    Screen Attributes

    Short Description

    Screen Type

    Next screen

    Screen 9100

    What happens after all PAI

    modules are processed and

    the next screen is itself?

    What happens after all PAI

    modules are processed and

    the next screen is blank?

    Overview

  • 8/12/2019 ABAP Training - Module Poolnew

    63/85

    |

    Overview

    ON INPUT

    ON REQUEST

    AT EXIT-

    COMMAND

    ConditionalExecution

    Flow Logic

    Additions

    AT CURSOR-

    SELECTION

    ON INPUT

  • 8/12/2019 ABAP Training - Module Poolnew

    64/85

    |

    ON INPUT

    PROCESS AFTER INPUT.

    FIELD A MODULE CHECK_DATA ON INPUT.

    Module CHECK will be executedonly if the value in

    field A is not equal to the initial value appropriate to

    its data type (e.g., blanks for character fields and

    zeroes for numeric fields).

    ON REQUEST

  • 8/12/2019 ABAP Training - Module Poolnew

    65/85

    |

    ON REQUEST

    PROCESS AFTER INPUT.

    FIELD A MODULE CHECK_DATA ON REQUEST.

    Module CHECK will be executedonly if a

    value has been entered in field A since the

    screen was displayed.

    AT EXIT COMMAND

  • 8/12/2019 ABAP Training - Module Poolnew

    66/85

    |

    PROCESS AFTER INPUT.

    MODULE END AT EXIT-COMMAND.

    Module END will be executedonly if

    the user invoked a function code with the

    E function type.

    AT EXIT-COMMAND

    Timing of AT EXIT-COMMAND

  • 8/12/2019 ABAP Training - Module Poolnew

    67/85

    |

    g

    Automatic Screen

    Field Checks

    OK?

    YES

    NO

    Go to PBO of

    next screen

    SCREEN

    Type E

    Function Code PROCESS AFTER INPUT.MODULE CHECK.

    MODULE END AT EXIT-COMMAND.

    Module END

    executed.

    Module CHECK

    executed.

    Data transport from screen

    fields to program fields with

    the same names.

    AT EXIT-COMMAND Example

  • 8/12/2019 ABAP Training - Module Poolnew

    68/85

    |

    p

    Academy Awards

    Year

    Category

    1910

    PI

    Exit Edit LoopPROCESS AFTER INPUT.

    FIELD YMOVIE-AAYEAR

    VALUES (BETWEEN 1927 AND 1996).

    CHAIN.

    FIELD: YMOVIE-AAYEAR, YMOVIE-CATEGORY.

    MODULE SELECT_LISTING.

    ENDCHAIN.

    MODULE END AT EXIT-COMMAND.

    If the user invokes the EXIT function code (e.g., clicking on

    Exit), we will terminate the transaction. Because this

    function code is type E, we can use AT EXIT-COMMAND to

    have the module END executed immediately (even before

    the automatic field checks).

  • 8/12/2019 ABAP Training - Module Poolnew

    69/85

    AT CURSOR-SELECTION -

    Catch All

  • 8/12/2019 ABAP Training - Module Poolnew

    70/85

    |

    PROCESS AFTER INPUT.

    FIELD A MODULE SEL1

    AT CURSOR-SELECTION.

    MODULE SEL2 AT CURSOR-SELECTION.

    Module SEL2 will be executedonly if the user invoked

    the function code CS with the S function type and thecursor wasnot positioned in field A.

    Catch All

    Subscreens

  • 8/12/2019 ABAP Training - Module Poolnew

    71/85

    |

    Subscreens are displayed onanother screen

    Customer 11

    Bank Information

    Address Information

    Customer 11

    Name

    Subscreen Areab

    (on Main Screen 9010)

    Address Information

    (Subscreen 9020)

    Bank Information

    (Subscreen 9030)

    Subscreens

    Tools International

    Main Screen

  • 8/12/2019 ABAP Training - Module Poolnew

    72/85

    |

    Main Screen

    Subscreen

    Area #1

    Subscreen

    Area #2

    Subscreen

    Area #3

    Screen Painter

    Main Screen

    Fullscreen Editor

    (subscreen areas)

    - Flow Logic

    Subscreen Area in Main Screen

  • 8/12/2019 ABAP Training - Module Poolnew

    73/85

    |

    Customer __________

    Name ________________

    . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . . . . . . .

    . . . . . . . . . . . . . .

    In the Fullscreen Editor,

    create a subscreen area on

    the main screen.

    Screen 9010

    This subscreen area

    must be given a name

    up to 10 characters long

    (e.g. SUB1).

    Subscreen Area in Main Screen

  • 8/12/2019 ABAP Training - Module Poolnew

    74/85

    CALL SUBSCREEN in PAI

  • 8/12/2019 ABAP Training - Module Poolnew

    75/85

    |

    PROCESS AFTER INPUT. for main screen 9010

    * CALL SUBSCREEN .

    CALL SUBSCREEN SUB1.

    To invoke the PAI event of

    the actual subscreen, the

    CALL SUBSCREEN

    statement must be used in

    the PAI event of the mainscreen.

    Customer 11

    Name

    Address Information

    (Subscreen 9020)

    CALL SUBSCREEN in PAI

    Tools International

  • 8/12/2019 ABAP Training - Module Poolnew

    76/85

    Subscreen Restrictions

  • 8/12/2019 ABAP Training - Module Poolnew

    77/85

    |

    SET PF-STATUS

    SET TITLEBAR

    SET SCREEN

    CALL SCREEN

    LEAVE TO SCREEN

    CALL SUBSCREEN

    AT EXIT-COMMANDOK Field

    Subscreen Restrictions

    Objectives: Tabstrip Controls

  • 8/12/2019 ABAP Training - Module Poolnew

    78/85

    |

    j p

    Upon completion of this section you will be able to:

    Create tabstrips in the graphical screen painter.

    Create subscreens for use with tabstrips.

    Integrate tabstrips in a module pool program . . .

    - With the application server.

    - Without the application server.

    Graphical Screen Painter

  • 8/12/2019 ABAP Training - Module Poolnew

    79/85

    |

    p

    TextI/O Template

    Radio Button

    Subscreen AreaFrames

    Table Controls

    What are Tabstrips?

  • 8/12/2019 ABAP Training - Module Poolnew

    80/85

    |

    MAL

    1991

    FEM

    Tabstrips allow users to access multiple subscreens on one normal screen.

    PIC

    YearWinner

    1991

    Nominees

    Beauty and the Beast

    Bugsy

    The Silence of the

    SAP R/3

    FEM MALPIC

    Year

    Winner

    1991

    Nominees

    Beauty and the Beast

    Bugsy

    The Silence of the

    p

    Creating Tabstrip Controls (Continued)

  • 8/12/2019 ABAP Training - Module Poolnew

    81/85

    |

    A. Define subscreen areas and subscreen attributes within each tab page.

    Subscreen Area

    SUB1

    C. Reference the subscreen in the dictionary attributes of your tab.

    B. Give your tabs a function code and specify the appropriate

    function type.

    AB

    C

    Creating Tabstrip Controls

  • 8/12/2019 ABAP Training - Module Poolnew

    82/85

    |

    I. Define your tabstrip in

    the top include.

    II. Use the Graphical

    Screen Painter to

    create the tabstrip.*

    A. Creates new

    tabs &

    pushbuttons.

    B. Creates

    tabstrips.

    * Tabstrips cannot be created in

    alphanumeric mode.

    Special Attributes for Tabstrip Controls

  • 8/12/2019 ABAP Training - Module Poolnew

    83/85

    |

    Process on Help-Request

  • 8/12/2019 ABAP Training - Module Poolnew

    84/85

    |

    PROCESS BEFORE OUTPUT.

    . . .

    PROCESS AFTER INPUT.

    . . .PROCESS ON HELP-REQUEST.

    FIELD YMOVIE-AAYEAR WITH 0001.

    Screen 9000Academy Awards

    Year

    Category

    1994

    PIC

    Trigger PROCESS ON HELP-REQUEST Flow Logic event forthe particular field. This event will display the specified

    supplemental documentation (i.e., 0001).

    F1

    Process on Value-Request

  • 8/12/2019 ABAP Training - Module Poolnew

    85/85

    |

    F4

    PROCESS BEFORE OUTPUT.

    . . .

    PROCESS AFTER INPUT.

    . . .

    PROCESS ON VALUE-REQUEST.

    FIELD YMOVIE-AAYEAR

    MODULE VALUE_LIST.

    Screen 9000Academy Awards

    Year

    Category

    1994

    PIC

    Trigger PROCESS ON VALUE-REQUEST Flow Logic event forthe particular field. This event will execute the specified module

    (i.e., VALUE_LIST).