You are on page 1of 21

Dialog Module Pool Programming

Designing SAP screens using dialog or module pool


programming in SAP ABAP programming

Introduction to module pool


programming
Introduction to module pool programming and screen, flow login in module
pool programs
It is a special type of programming which is used to create custom SAP screens.
Transaction code for creating module pool programs is SE80.
Every module pool program must be executed with a transaction (T-code).

Events in Module pool programming


There are four events available in module pool programming.
PBO (Process Before Output):Triggered before MPP screen is displayed.
PAI (Process After Input): Triggered after MPP screen is displayed whenever user raises an
action. Also,Now PBO is also triggered.
POV (Process On Value Request): Triggered when User Clicks on search help or F4 Button.
POH (Process On Help Request): Triggered when User Clicks on search help or F4 Button.

Modularization techniques in Module Pool


Basically there are four include programs which are created automatically for an MPP program.
<MPP name>_TOP "top include program ,All data declarations.
<MPP name>_O01 "PBO include program , All logic related to PBO event
<MPP name>_I01 "PAI include program , All logic related to PAI event
<MPP name>_F01 "Forms include program , All logic related to subroutines

SCREEN
It is a visible layout which is displayed in the output. The components of the Screen are
Components of Screen:

Attributes : Properties of screen

Element List : List of UI/Library elements

Flow-Logic : Abap logic related to MPP

Layout : Screen Designing Area

Flow Logic in module pool


It will contain the logic related to screen in the form of modules By default, 2 events will be
available with their corresponding modules as below: Just uncomment the modules and create
them and write the abap logic.
PROCESS BEFORE OUTPUT.
*MODULE STATUS_0100.
PROCESS AFTER INPUT.
*MODULE USER_COMMAND_0100.

MODULE:

It is an sub-program which contains the ABAP code for a screen .

Flow-Logic cannot understand ABAP statements. So the entire ABAP code is written in
the form of modules.

Since the entire abap logic is divided in the form of modules, that is why it is called
MODULE POOL PROGRAMMING

First Module Pool Program in


SAP
In the below example we will create a simple Module Pool Program to display hello world.
Go to SE80, select program from drop down, provide name as ZSAPN_HELLO_WORLD and
press enter.

A pop up will open click Yes.

Provide a program name ZSAPN_HELLO_WORLD (same name as given above), select create
with top include check box and enter.

Provide a top include name, enter.

Click Save on the pop up window.

Save it in a local object.

Go to change mode, double click on program name, uncomment all include programs, double
click on each include and create (TIP- Just double click on each include enter, enter, save in local
object, save, back(F3)) .Now to double click on program name, right click , activate.

Right click on program name, create, screen.

Provide Screen number as (0100), enter.

Provide short description and click on flow logic tab.

Uncomment the available MODULES, double click to create them.

Double click on MODULE STATUS_0100,yes, select main include and enter.

Save, click back (F3) and create another module.


Click on Layout ( toolbar button), it will open Module Pool layout designer (If you are using it first
time it might take some time...If you failed to open layout it might be due to some missing
configuration, at that time contact basis/admin).

The layout will be like below, drag and drop Text Field element on to screen area.

Provide name and text.

Save, close windows, go to flow logic, double click on each module and add below code.

Double click on menu name and title to create GUI status for the program...checkout creating a
custom menu in SAP to create menu.
Double click on program name, right click, activate.
To execute a module pool program we need to create a t-code, to create a t-code right click on
program name, create, transaction.

Provide a T-code name, short text and enter.

Provide program name, screen number, save.

Now T-code is created, execute the T-code and test.

Module Pool Program to Display


Material Details
Example module pool program to display material details, module pool
program using form and button
Requirement: Display material details for a material input by designing a module pool screen.
Go to SE80, select program from drop down, provide name and press enter.

A popup will come just click yes.

Check 'Create with TOP module' and enter.

Provide a top include name and enter.

Select module pool and save.

Expand program, double click on top include and add below code.

Right click on program name, create -> screen.

Provide a screen number and enter.

Provide short description and click on layout.

Module Pool layout designer will open, click on 'Dictionary/Program fields icon' (see below
image), a popup will open, provide name as WA_MARA, click on 'Get from program', select all
rows and enter.

Move mouse cursor on layout and place the form in suitable position.

Now click on text icon, put it before any input field and enter text.

Similarly create labels for all fields.

Insert button, provide text as 'Get Data', double click, provide a name , fct code, enter and close.
Save and Activate.

Close the layout and go to program and click on flow logic.


uncomment modules.

Double click on each module and create them in main program.

After creating two modules, go to PAI and add below code.


IF SY-UCOMM = 'GETM' .

SELECT SINGLE * FROM MARA INTO CORRESPONDING FIELDS OF WA_MARA


WHERE MATNR = WA_MARA-MATNR.
ENDIF.

Right click on program, create -> transaction.

Provide transaction code as ZSAPN_MAT_MPP, provide short text and enter.

Provide program name as ZSAPN_MPP_MATERIAL, screen no as 100 and save in a local


object.

Now go to t-code ZSAPN_MAT_MPP, provide a material no and click on get data button, it will
get output.

You might also like