Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

module pool

Former Member
0 Likes
603

Hi,

what is module pool program?

Regards

3 REPLIES 3
Read only

Former Member
0 Likes
559

Hi,

Module Pools

Module pools are directly created using the ABAP Editor and are introduced with the PROGRAM statement. With the exception of reporting event blocks and function modules, module pools can contain all processing blocks supported in ABAP and as many local classes as required. While they are executed, all events of the ABAP runtime environment may be triggered.

The most important technical attribute of a module pool is that it can only be controlled using screen flow logic. You must start them using a transaction code, which is linked to the program and one of its screens (initial screen). Another feature of these programs is that you must define your own screens in the Screen Painter (although the initial screen can be a selection screen).

When you start a program using a transaction code, the runtime environment starts a processor that calls the initial screen. This then calls a dialog module in the corresponding ABAP program. The remainder of the program flow can take any form. For example, the dialog module can:

· return control to the screen, after which the processing passes to a subsequent screen. Each screen has a following screen, set either statically or dynamically. Screens and their subsequent screens are components of freely definable screen sequences.

· call other screen sequences, selection screens or lists, from which further processing blocks in the ABAP program are started.

· call other processing blocks itself, either internally or externally.

· call other application programs using CALL TRANSACTION or SUBMIT.

It is appropriate to use module pools when you write dialog-oriented programs using a large number of screens whose flow logic largely determines the program flow of screen sequences.

Regards,

Renjith Michael.

http://www.sourceveda.com/

Read only

Former Member
Read only

Former Member
0 Likes
559

Hi,

ABAP/4 Module Pool

In the Object Browser, the module pool code belongs to one of the following categories:

Global fields: data declarations that can be used by all modules in the module pool

PBO modules: modules that are called before displaying the screen

PAI modules: modules that are called in response to the user input

Subroutines: subroutines that can be called from any position within the module pool

By default, the system divides a module pool into one or several include programs. An include program can contain several modules of the same type (only PBO modules or only PAI modules). The main program then consists of a sequence of INCLUDE statements that link the modules to the module pool:

*&----


*&

*& Module pool SAPMTZ10

*&

*&----


*&

*& Display data of Table SPFLI

*&

*&----


  • Global data

INCLUDE MTZ10TOP.

  • PAI modules

INCLUDE MTZ10I01.

  • PBO modules

INCLUDE MTZ10O01.

In the ABAP/4 editor, you can display the code hidden behind the INCLUDE statements by choosing Edit ---> More functions ---> EXPAND include. With all INCLUDE statements expanded, the module pool looks like this:

*&----


*& Module pool SAPMTZ10

*& FUNCTION: Display data from Table SPFLI

*&

*&----


*----


  • INCLUDE MTZ10TOP (This is the TOP include:

  • the TOP module contains global data declarations)

*----


PROGRAM SAPMTZ10.

TABLES: SPFLI.

DATA OK_CODE(4).

*----


  • INCLUDE MTZ10I01 (This is a PAI include.)

*----


*&----


*& Module USER_COMMAND_0100 INPUT

*&----


  • Retrieve data from SPFLI or leave transaction

*----


MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.

WHEN 'SHOW'.

CLEAR OK_CODE.

SELECT SINGLE * FROM SPFLI WHERE CARRID = SPFLI-CARRID

AND CONNID = SPFLI-CONNID.

WHEN SPACE.

WHEN OTHERS.

CLEAR OK_CODE.

SET SCREEN 0.

LEAVE SCREEN.

ENDCASE.

ENDMODULE.

*----


  • INCLUDE MTZ10O01 (This is a PBO include.)

*----


*&----


*& Module STATUS_0100

*&----


  • Specify GUI status and title for screen 100

*----


MODULE STATUS_0100.

SET PF-STATUS 'TZ0100'.

SET TITLEBAR '100'.

ENDMODULE.

You use the ABAP/4 Dictionary to store frequently used data declarations centrally. Objects defined in the Dictionary are known throughout the system. Active Dictionary definitions can be accessed by any application. Data defined in the Dictionary can be included in a screen or used by an ABAP/4 program. You declare global data in the TOP module of the transaction, using the TABLES, STRUCTURE, LIKE statements and others. Transaction TZ10 accesses the Dictionary definition of Table SPFLI to provide the desired flight data display. If the TOP include contains the TABLES: SPFLI declaration, all modules in the module pool can access the table fields of Table SPFLI.

The PAI module USER_COMMAND_0100 checks which pushbutton the user activated (CASE OK_CODE). The Display pushbutton in Transaction TZ10 has the function code 'SHOW'. The program then tries to select those records in the SPFLI database that correspond to the data the user entered. The WHERE condition determines matching records by comparing the fields SPFLI-CARRID and SPFLI-CONNID with the database key fields CARRID and CONNID. As soon as a matching record is found, the database transfers all accompanying SPFLI fields to the program table.

When the screen is displayed again, the complete information appears in the output fields of the screen. The system automatically displays these fields, since the ABAP/4 field names SPFLI-CARRID and SPFLI-CONNID are the same as the screen field names.

In the PBO module STATUS_0100 of Transaction TZ10, the screen 100 receives a GUI status (using SET PF-STATUS) and a GUI title (using SET TITLEBAR):

SET PF-STATUS 'TZ0100'.

SET TITLEBAR '100'.

A GUI status is a subset of the interface elements used for a certain screen. The status comprises those elements that are currently needed by the transaction. The GUI status for a transaction may be composed of several elements.

The GUI title is the screen title displayed in the title bar of the window. In contrast to the GUI status that can be used for several screens, a GUI title belongs to one screen.

To create and edit GUI status and GUI title, you use the Menu Painter. To start the Menu Painter, create a GUI status or GUI title in an object list in the Object Browser (or double-click on an existing status or title).

with regards.

sowjanya.gosala.