SAP Module Pool Help

Document Sample
SAP Module Pool Help Powered By Docstoc
					Module Pool Programming:

To create Module Pool Program you need to create Program in SE38 Type – (M)

You can not give Screen no 1000 to create screen in se51 its reserve for Selection

    •   Processing of the event blocks at PAI of the current and at PBO of the next dynpro form one
        dialog step.
    •   Specifying the screen blocks at POH and POV overrules field and input helps defined by the
        system or in the ABAP Dictionary. You must specify those only if the predefined helps are not

A four-digit number, unique within the ABAP program, that identifies the screen within the program. If your
program contains selection screens, remember that selection screens and Screen Painter screens
use the same namespace. For example, if you have a program with a standard selection screen, you may
not contain any further screens with the number 1000. Lists, on the other hand, have their own

Screen group

Four-character ID, placed in the system field SY-DYNGR while the screen is being processed. This allows
you to assign several screens to a common screen group. You can use this, for example, to modify all of
the screens in the group in a uniform way. Screen groups are stored in table TFAWT.

OK_CODE field

Every screen has a twenty-character OK_CODE field (also known as the function code field), which is not
displayed on the screen. User actions that trigger the PAI event also place the corresponding function
code into this field, from where it is passed to the ABAP program. You can also use the command field in
the standard toolbar to enter the function code. You must assign a name to the OK_CODE field to be able
to use it for a particular screen.

Screen number

  Screen number

  The screen number identifies a screen within a program (module pool,                     report).

  Screen numbers can be up to 4 characters long, all of which must be digits. Screen
numbers from 9000 are reserved for customer-specific screens.

  The use of screen numbers is namespace-dependent. For screens in
  programs in the SAP namespace, numbers less than 9000 are reserved for
  SAP screens, numbers between 9000 and 9500 are reserved for SAP
  partners, and numbers greater than 9500 are for customers.
Type of function code for pushbutton


   The function type is used for flow control purposes. When the event is
   executed, it informs the screen processor how to interpret the function
   code. The types are as follows:

   Type     Description                   Command field entry

   E     Exit command
        (module AT EXIT COMMAND executed) "/E"

   H     Help
        (module ON HELP REQUEST executed) "?"

   S      System function                 "/"

   T      Start transaction              "/n"

   P     Local GUI function.
        The function code is processed by the GUI.

Table Controls:




If you specify the type TABLEVIEW in the CONTROLS statement, a deep structure is created with the name
of the control and the type CXTAB_CONTROL of the type group CXTAB. During screen processing, the
components of the structure contain the attributes of the table control. Using this structure you can read
and edit the attributes of the relevant table control.

If you specify the type TABSTRIP in the CONTROLS statement, a deep structure is created with the name
of the control and the type CXTAB_TABSTRIP of the type group CXTAB. From this structure, only the
component ACTIVETAB is required in the program.
You must not use the CALL SUBSCREEN statement between the LOOP and ENDLOOP or the CHAIN and
ENDCHAIN statements.

process before output.
call subscreen sub including sy-repid wrk_dynnr.
process after input.
call subscreen sub.

In a table control, a maximum of 255 screen elements is summarized in a table control row

Within the loop pass, the system field sy-stepl contains the number of the current table control row,
started at the top visible row. The system field sy-loopc contains the total number of table control rows
displayed on the screen

Table Control Strcuture in sap runtime:

Screen Table Structure:

To hide the screen elements:

    IF screen-group1 = 'G1'.
      screen-input = 0.
For Hide field in Table Controls
DATA: Colvariable LIKE LINE OF Tablecontrol-cols.
  wa_cols LIKE LINE OF club_tctrl-cols.
  LOOP AT club_tctrl-cols INTO wa_cols.
   wa_cols-screen-input = 0.
   MODIFY club_tctrl-cols FROM wa_cols.

Set Screen : The controls pass to the called screen after execution of that screen is over

Leave Screen :In case of It Suspend cureent screen and directly got to next screen

Leave to screen : Suspend cureent screen and directly got to next screen

Call screen:It will directly go to call screen and Execution is over come back to called
Maxiam 9 stack of Call screen allows

            [STARTING AT col1 lin1
            [ENDING   AT col2 lin2]].

   •     The called dynpro should not be a selection screen. To call a selection screen, use the statement
   •     If during the processing of a modal dialog window a new dynpro sequence is called, it must be
         started in another popup level. You cannot use the statement CALL SCREEN without addition
         STARTING AT in this case.

TO remove some of Function code use “Excluding”



If this statement is specified during PBO processing, then the current dynpro is processed without
displaying the screen, while the screen of the previous dynpro remains visible. After the PBO processing,
the system triggers the event PAI in such as way, as if a user had pressed Enter. The function code
assigned to this key in the current GUI status is then transported to sy-ucomm and to the OK field.
Outside of PBO processing, this statement has no effect.


To skip automatic input checks defined in the system or in the ABAP Dictionary and independent of its
position in the event block.



FIELD dynp_field [MODULE mod [cond]] [WITH hlp].


The FIELD statement of the screen flow logic controls the data transport from the dynpro to the ABAP
program during the event PAI. It can be combined with the MODULE statement to conditionally call dialog
modules and to allow you to check any input.

FIELD can be used in the event blocks at PBO, PAI , POH and POV, but it has no effect in the event
block at PBO. For dynp_field, you must specify a screen field of the current dynpro. The statement has
the following effect:

    •    In the event block at PAI, FIELD controls the time when the data transport from screen field
         dynp_field to the global data object with the same name of the ABAP program takes place.

    •    In the event block at PAI, FIELD can be combined with a MODULE statement to call a module mod
         according to the conditions cond for screen field dynp_field and to allow input checks with
         error handling.

    •    In the event blocks at POH and POV, FIELD can either be combined with a MODULE statement
         (without cond condition) to call a module mod with self-programmed field or input helt or, with the
         addition WITH of POH, a data element additional documentation can be called.

    •    The value check in the flow logic using the additions VALUES and SELECT after FIELD is

How many menu titles you can have in a main menu?
You can have six menus in a menu bar.In addition to this system provides two more
menus ie system and help. You can have only one menu bar for a status.
You can maintain 15 entries in a menu and upto three levels.
What is the difference between the "change on-input" and "Change on request" in
the PAI of a screen?
The ABAP/4 module is called only if the field contains a value other than its initial value.
This initial value is determined by the field's data type: blanks for character fields, zeroes
for numerics.
The ABAP/4 module is called only if the user has entered a value in the field value since
the last screen display. The value counts as changed even if the user simply types in the
value that was already there.

What does CHAIN ....END CHAIN do?
Sometimes you want to check several fields as a group. To do this, include the fields in a
FIELD statement, and enclose everything in a CHAIN-ENDCHAIN block.
**** Screen flow logic: ****
When an error is found inside a chain, the screen is re-displayed, and all fields found
anywhere in the chain are input-enabled. All non-chain fields remain disabled.

Calling a PAI Module for Type E Functions
When the user chooses a function with type E, the screen flow logic jumps directly to the following


Regardless of where it occurs in the screen flow logic, this statement is executed immediately, and before
the automatic checks for the field contents on the screen. Before the module <mod> is executed, the
contents of the OK-CODE field are transported to the ABAP field with the same name. However, no other
screen fields are transported to the program at this stage.

If you have more than one MODULE statement with the AT EXIT-COMMAND addition, only the first
is executed. If there are no MODULE statements with the AT EXIT-COMMAND statement, normal
PAI processing resumes.

If the user chooses a function whose function code does not have type E, the MODULE <mod> AT EXIT-
COMMAND statement is not executed.

Controlling the Data Transfer
Data is passed from screen fields to ABAP fields with the same names once in each dialog step. If you
only use simple module calls, all of the data is transferred in the PAI event before PAI processing starts.

The FIELD statement in the screen flow logic allows you to control the moment at which data is passed
from screen fields to their corresponding ABAP fields.
To specify this point, use the following statement in the PAI flow logic:

FIELD <f>.

Data is not transported from the screen field <f> into the ABAP field <f> until the FIELD statement is
processed. If a field occurs in more than one FIELD statement, its value is passed to the program when
the first of the statements is reached.


        Calls the input help of the ABAP Dictionary dynamically. You can pass the component names of a
        structure or database table of the ABAP Dictionary to the function module in the import
        parameters TABNAME and FIELDNAME. The function module starts the ABAP Dictionary
        input help for this component. All of the relevant screen fields are read. If you specify the import
        parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the user’s selection is returned to the
        corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
        selection is returned into the table instead.


        This function module displays a value list that you created in an ABAP program. The value list is
        passed to the function module as the table parameter VALUE_TAB. If you specify the import
        parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the user’s selection is returned to the
        corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
        selection is returned into the table instead.

Why do we need to code a LOOP statement in both the PBO and PAI events for
each table in the screen ?
We need to code a LOOP statement in both PBO and PAI events for each table in
the screen. This is because the LOOP statement causes the screen fields to be
copied back and forth between the ABAP/4 program and the screen field. For this
reason, at least an empty LOOP......ENDLOOP must be there.

The field SY-STEPL refers to ___________________ .
The index of the screen table row that is currently being processed. The system
variable SY-STEPL only has a meaning within the confines of LOOP...ENDLOOP
processing. Outside the loop, it has no valid value.

What is the use of the statement Leave to list-processing ?
Leave to list-processing statement is used to produce a list from a module pool.
Leave to list-processing statement allows to switch from dialog-mode to list-mode
within a dialog program.

When will the current screen processing terminates ?
A current screen processing terminates when control reaches either a Leave-screen
or the end of PAI.

How is the command Suppress-Dialog useful ?
Suppressing entire screens is possible using this command. This command allows
us to perform screen processing “in the background”. The system carries out all
PBO and PAI logic, but does not display the screen to the user. Suppressing
screens is useful when we are branching to list-mode from a transaction dialog step.

What happens if we use Leave to list-processing without using Suppress-Dialog ?
If we don't use Supress-Dialog the next screen will be displayed but as empty.
when the user presses ENTER, the standard list output is displayed.

Subscreens cannot have their own OK_CODE field. Function codes linked to user actions on subscreens
are placed in the OK_CODE field of the main screen. This also applies to subscreen screens defined in a
different program to the main screen.

The flow logic of a subscreen screen may not contain a MODULE ... AT EXIT-COMMAND statement.
Type E functions may only be handled in the main screen.

The flow logic of a subscreen screen may not contain any dialog modules containing the statements SET
statements causes a runtime error. You cannot change the GUI status of a main screen in a subscreen

While a subscreen screen is being processed, the system field SY-DYNNR contains its screen number.
Its contents therefore change when the CALL SUBSCREEN statement occurs and when you return to the
main screen.

When you use subscreen screens, remember that the data from their input/output fields is transported to
and from the programs in which they are defined. The function codes of user actions on the screen, on
the other hand, are always placed in the OK_CODE field of the main screen, and transported into the
program in which it is defined. You should therefore name the function codes of your subscreen screens
differently from those of the main screen.

Assigning a Subscreen Area to a Tab Title
You must assign a subscreen area to each tab title. There are two ways of doing this:

Paging in the SAPgui

You need to assign a separate subscreen area to each tab title, and define the function codes of the tab
titles with type P (local GUI function). In the screen flow logic, you call all the subscreens in the PBO
event. This means that all of the tab pages reside locally on the SAPgui.

When the user chooses a tab title, paging takes place within the SAPgui. In this respect, the tabstrip
control behaves like a single screen. In particular, the PAI event is not triggered when the user chooses a
tab title, and no data is transported. While this improves the performance of your tabstrip control, it also
has the negative effect that when the user does trigger the PAI event, all of the input checks for all of
the subscreens are performed. This means that when the user is working on one tab page, the input
checks may jump to an unfilled mandatory field on another page.

Local paging at the SAPgui is therefore most appropriate for screens that display data rather than
for input screens.
Paging on the Application Server

One subscreen area is shared by all tab titles and called in the PBO event. You define the function codes
of the individual tab titles without a special function type. When the user chooses a tab page, the PAI
event is triggered, and you must include a module in your flow logic that activates the appropriate tab
page and assigns the correct subscreen to the subscreen area.

Since the PAI event is triggered each time the user chooses a tab title, this method is less economical for
the application server, but the input checks that are performed only affect the current tab page.

Procedure in Either Case

You create the subscreen areas within the tabstrip area. You assign the subscreen areas to one or more
tab titles in the Screen Painter by selecting one or more titles. You can also assign a subscreen area to a
tab title in the tab title attributes by entering the name of the subscreen area in the Reference field

The procedure for the alphanumeric Screen Painter is described under Creating      Tabstrip Controls.

If you are paging at the SAPgui, create a subscreen area for each tab title. If you are paging at the
application server, select all tab titles and create a single subscreen area. The subscreen areas may not
cover the top line of the tab area. However, within a tab area, more than one subscreen area can overlap.

Programming the Flow Logic

In the flow logic, all you have to do by hand is include the correct subscreens. The screen flow and data
transport to the ABAP program is the same as for normal subscreens. There are two ways of
programming the screen flow logic, depending on how you have decided to page through the tabstrip

Paging in the SAPgui

When you page in the SAPgui, you must include a subscreen for each subscreen area:

  CALL SUBSCREEN: <area1> INCLUDING [<prog 1>] <dynp 1>,
                  <area2> INCLUDING [<prog 2>] <dynp 2>,
                  <area3> INCLUDING [<prog 3>] <dynp 3>,

  CALL SUBSCREEN: <area1>,

Paging on the Application Server
When you page on the application server, you only have to include a subscreen for the one subscreen

  CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>.


Handling in the ABAP Program
Before you can use a tabstrip control in your ABAP program, you must create a control for each control in
the declaration part of your program using the following statement:


where <ctrl> is the name of the tabstrip area on a screen in the ABAP program. The control allows the
ABAP program to work with the tabstrip control. The statement declares a structure with the name <ctrl> .
The only component of this structure that you need in your program is called ACTIVETAB.

    •   Use in the PBO event

        Before the screen is displayed, you use the control to set the tab page that is currently active. To
        do this, assign the function code of the corresponding tab title to the component ACTIVETAB:

        <ctrl>-ACTIVETAB = <fcode>.

        When you page at the SAPgui, you only need to do this once before the screen is displayed. This
        initializes the tabstrip control. The default active tab page is the first page. After this, the page
        activated when the user chooses a tab title is set within SAPgui.

        When you page on the application server, you must assign the active page both before the
        screen is displayed for the first time, and each time the user pages. At the same time, you must
        set the required subscreen screen.

        You can suppress a tab page dynamically by setting the ACTIVE field of table SCREEN
        to 0 for the corresponding tab title.

    •   Use in the PAI event

        In the PAI event, ACTIVETAB contains the function code of the last active tab title on the screen.

        When you page in the SAPgui, this allows you to find out the page that the user can currently
        see. When you page at the application server, the active tab page is controlled by the ABAP
        program anyway.

The OK_CODE field behaves differently according to the paging method:
   •   Paging in the SAPgui

       When you page in the SAPgui, the PAI event is not triggered when the user chooses a tab title,
       and the OK_CODE field is not filled. The OK_CODE field is only filled by user actions in the GUI
       status or when the user chooses a pushbutton either outside the tabstrip control or on one of the

   •   Paging on the application server

       If you are paging at the application server, the PAI event is triggered when the user chooses a tab
       title, and the OK_CODE field is filled with the corresponding function code.

       To page through the tabstrip control, you must assign the function code to the ACTIVETAB
       component of the control:

       <ctrl>-ACTIVETAB = <ok_code>.

       This statement overwrites the function code of the last active tab page with that of the new tab
       title. At the same time, you must ensure that the correct subscreen is inserted in the subscreen

Table Control

       LOOP AT <internal table> CURSOR <scroll-var>
                 [WITH CONTROL <table-control> ]
                 [FROM <line1> ] [TO <line2> ].

Shared By:
Tags: Module, Pool
Description: SAP Module Pool will help you to understand Module pool Programming