Sie sind auf Seite 1von 25

Module Pool Programming

Introduction to MPP
• A module pool is a collection of screens, flow logic, menu bars and ABAP code
that when linked together build an application.
• Through MPP there is a two way communication with the database.
• Typically the transaction code that calls the application will refer to the module
pool and the initial screen number.
• These are the type M programs in SAP.
• Also referred to as Dialog Programs as they cannot be executed in background.

Reports Vs Dialog Programs


Reports Dialog Programs
A dialog program allows you to work
A report is a program that interactively with the system and to change
typically reads and analyzes the contents of the database tables. Each
data in database tables without dialog program has a certain sequence of
changing the database. screens that are processed by the system
one after the other.
A report could run directly as
For executing dialog programs we need to
well as by creating a
create a z transaction.
transaction
Reports are type ‘E’
Dialog Programs are type ‘M’ (Module)
(Executable) SAP ABAP
SAPPrograms
Programs
The screen sequence is
We can program screens to appear in any
controlled by events, which
sequence we want
occur in a fixed order.
Screens
• Each dialog in an SAP system is controlled by one or more screens.
• You create screens using the Screen Painter in the ABAP Workbench through
transaction SE51
• Each screen belongs to an ABAP program.
• These screens consist of a “screen mask” or “layout” and its flow logic. The screen
has a layout that determines the positions of input/output fields and other graphical
elements such as checkboxes and radio buttons. A flow logic determines the
logical processing within screen.

Flow Logic
• Process Before Output After it has processed all of the modules in the PBO
processing block, the system copies the contents of the fields in the ABAP work
area to their corresponding fields in the screen work.
• Process After Input(PAI) Before it processes the first module in the PAI
processing block, the system copies the contents of the fields in the screen work
area to their corresponding fields in the ABAP work area.
• Process on help request (POH) It is processed when F1 key is pressed. It is
used to provide the documentation help to the user.
• Process on value request (POV) It is processed when F4 key is pressed. It is
used to provide the value input help to the user for entering data on screen.
GUI Status
• Each screen has a GUI status. This controls the menu bars, standard toolbar, and
application toolbar, with which the user can choose functions in the application.
Like screens, GUI statuses are independent components of an ABAP program.
You create them in the ABAP Workbench using the Menu Painter(SE41) .

SAP Standards for MPP


All MPP program names should start with SAPMZ
—Include TOP:- Include type program where all the data declaration is made.
—Include 001:- Include where all the PBO Modules are declared.
—Include I01 :- Include where all the PAI Modules are declared.
—Include F01 :- Include where all the Form routines are declared

http://learnabaponline.blogspot.com.br/2013/08/module-pool-programming.html
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


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.

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.

https://www.sapnuts.com/courses/core-abap/module-pool/first-module-pool-
program.html
Table Control using Wizard in Module
Pool Programming
Pre-requisites:
The readers must be able to create a module pool program and they should be familiar with screen
programming.

Purpose of this tutorial:


This is to demonstrate the step by step tutorial of how to make use of table control with wizard, where the
developer’s effort to write code with table control without wizard is avoided.

Introduction:
Table control with wizard is the control provided by SAP, in which the users are not needed to code
separately for table control operations. It generates automatically system generated code for the following
table control operations.
1.Insertion
2.Deletion
3.Scrolling
4.First
5.Last
6.Next
7.Previous
8.Select
9.Select all
10.Deselect
11.Deselect all
Step 1: Create an internal table
and work area, which we are going
to deploy in table control.

Step 2: Create a screen called ‘9000’.


Input the screen number as 9000.

Fill up the screen attribute values.


Step 3: Go to the layout of the screen,
where you can find the table control with
wizard.
Drag and drop the table control with wizard
to the layout of the screen.

Once you drag and drop the control a


popup will appear.
Press Continue. In the next screen
enter the table control name as
‘TBC_9000’
or your own name.

In the next screen you input the internal


table and work area which has been
created earlier.
Note: Before it is done, you must
activate the page, in which you have
declared the internal
table and work area. Then only this
table control screen will take its
properties.
The next screen will automatically
retrieve the fields available in the
internal table and show. We have to
select those fields, which and all
should be displayed in table control.
If you have declared any character
field for table control line selection,
that should not be selected in this
screen.

Select the input/output


attributes as ‘Input control’ and
give the field for selection of
table control rows. Select the
multiple line selection.
Click on Continue. The table control with auto generated code will automatically
be created
This will automatically create PBO & PAI modules for table control operations.
Step 4: For testing this tutorial, write a simple query to populate the internal
table of table control and test the input controls associated with it.

The expected output will be like

http://www.saptechnical.com/Tutorials/ABAP/TableControl/Index.htm
http://www.saptechnical.com/Tutorials/ABAP/image/screen.htm

Das könnte Ihnen auch gefallen