Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
This is my first blog in this series.

In this blog post you will learn how to make a basic Module Pool program using screen elements.

Module pool programming is a special type of programming which is used to create custom SAP screens.

Transaction code for creating module pool program is SE80.

There are four events in Module pool programming.

Here we will be using two events.

Process Before Output: 

It is triggered before MPP screen is displayed.

Process After Input:

It is triggered after MPP screen is displayed whenever user raises an action.

First create a new report in SE80 with top include and give the type Module pool as given below.


Create Transaction

Right click on report then create transaction then enter program name and screen name and then assign to package.

Create Screen

Step 1: Create by writing Call screen command in report as given below
CALL SCREEN 100.

Step 2: Now double click on screen and then click on layout.

Now Screen Painter will open. Here you can design your screen.

Click on “Dictionary/Program Fields Window”



Step 3: Enter the name of table in and click on “Get from Dictionary” and select the fields you want to display.


Step 4: Now drag and drop it on screen painter.


Step 5: Now create a button by clicking on the “Push Button” on the left toolbox and placing it on the screen wherever you want. Now double click on the button, a pop-up will come out, enter the name of the button there and mention the function code “Fct Code” this code will be used in user command. Now save and activate the screen.



Similarly create a push button for EXIT.

Step 6: Now go to the “Flow Logic” tab and uncomment the PBO and PAI modules respectively.

Then double click on both the Modules and create them in the Main Program.

Step 7: Now write code in user command for both the push buttons using function code as given below
CASE SY-UCOMM.
WHEN 'FC_1'.
SELECT
SINGLE
MATNR
ERSDA
CREATED_AT_TIME
ERNAM
MTART
MATKL
FROM MARA INTO CORRESPONDING FIELDS OF MARA WHERE MATNR = MARA-MAT
WHEN 'FC2'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.

Refer to the code below for the whole program.
*&---------------------------------------------------------------------*
*& Module Pool Z1015035_MPP_MARA_
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*

INCLUDE ZMARATOP . " Global Data
START-OF-SELECTION.
CALL SCREEN 100.

* INCLUDE ZMARAO01 . " PBO-Modules
* INCLUDE ZMARAI01 . " PAI-Modules
* INCLUDE ZMARAF01 . " FORM-Routines
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'FC_1'.
PERFORM GET_DATA.
WHEN 'FC2'.
LEAVE PROGRAM.
WHEN OTHERS.
ENDCASE.

ENDMODULE.


---INCLUDE----

*&---------------------------------------------------------------------*
*& Include ZMARATOP - Module Pool Z1015035_MPP_MARA_
*&---------------------------------------------------------------------*
PROGRAM Z1015035_MPP_MARA_.
TABLES: MARA.
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM GET_DATA .
SELECT
SINGLE
MATNR
ERSDA
CREATED_AT_TIME
ERNAM
MTART
MATKL
FROM MARA INTO CORRESPONDING FIELDS OF MARA WHERE MATNR = MARA-MATNR.

ENDFORM.


Output



By following the steps you will be able to create basic Module Pool Program. I hope this blog post helped you as beginner.

As we continue to learn more in this series about MPP, I will use this blog post to link all the parts of this series.

Follow my account  sinelanwar22 to be notified of the next blog post. Please feel free to ask any questions you have in the comments section below.

Join the conversation about the ABAP programming by following the tag  ABAP Development

Post questions and answer related to tag by following the tag Questions & Answers

Read other blog post on topic ABAP Development
5 Comments
Labels in this area