0% found this document useful (0 votes)
4 views79 pages

10. Module Pool Programming

Module Pool Programming, also known as dialog programming, involves creating a pool of screens, transactions, and includes in SAP. Key components include screen attributes, flow logic, and various events like PBO and PAI that manage screen interactions. The document provides detailed steps for creating screens, managing GUI status, and implementing logic for user commands and data handling.

Uploaded by

Laksh Mhr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views79 pages

10. Module Pool Programming

Module Pool Programming, also known as dialog programming, involves creating a pool of screens, transactions, and includes in SAP. Key components include screen attributes, flow logic, and various events like PBO and PAI that manage screen interactions. The document provides detailed steps for creating screens, managing GUI status, and implementing logic for user commands and data handling.

Uploaded by

Laksh Mhr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 79

Module Pool Programming

It is also called as dialog Programming. It is a pool of modules Screens, Includes, Transactions etc).

A Module Pool is mainly a pool of screens.

1) Tabs of a Screen :

Attributes -> It gives the generic information of that screen.


Element List -› It provids the list of elements available on that screen.
Flow Logic -> It's purpose is to write the logic.

2) Module Pool Events


a) PBO (Process Before output) - This event called before displaying a particular screen.
b) PAI (Process after Input) - This event called after performing some action on a particular screen.
d) POV (Process on Value Request) - This event called when we click F4 on a field of a screen.
c) POH Process on Help Request) - This event called when we click F1 ( Technical information) on a field
of a screen

F4 Help -> It tells us what are the various possible values for any Input field.
F1 Help -> It gives us the technical information of any field/column.

3) Parts of GUI Status :


PF-STATUS ->( Personal Functions)
Tcode: SE80

Select program from dropdown button.

Give name and press enter.

Select save.

Select ‘Create with TOP include.


Enter.

Select local objects.

Create screen.
Give number 100 and press enter.

Save it

Follow same steps and create screen 200.


Double click on screen 100.

Select flow logic

Uncomment module.

Double click on status_0100.

Select yes.

Enter.
Uncomment SET PF-STATUS (Ctl+.)

Give name HEADER and double click on it.


Give item name(HEADER) And double click on it. Continue

Enter select shortcut Shift+F1.

Give icon text and enter.


Save it. Back

Uncomment (Shift+.) SET TITLEBAR

Double click on HDR.

Select yes.

Give Title and press enter


Active (Ctl+F3).

Now uncomment MODULE USER COMMAND.

Double click on it.

Select yes.

Follow same step for screen 200.

Select existing PBO Module and enter.


Create transaction code:
We will use following tables

Table 1.

Table 2.
Select Layout.

2
3
1

4 5. Click on
this box
6. Give table name and
field name

7. Select yes

10. Give name

11. Give text

9. Draw button
8. Select Pushbutton

Double click on button or field to see property.

12. Click here


2.Click on get from
1.Give table name dictionary

Select field and press enter.

Place field on required position, select Do not transform.


3. Double click on field

4. Select program and


uncheck input field

Define structure
Save and activate.

Double click on screen 100 then again double click on PAI Module.
Execute in new window.

Give number and press enter.


Sy-UCOM ( User Command)

Sub screen
Create normal Screen and subscreen
Make all this field as output fields only.
Create Tcode and execute in new window.
Double Click on user_command_0100.
Save it.
Modal Dialog Box Screen.

Requirement –Normal Screen 100—input field.

Modal Dialog Box -200.

Create program and screens


Create Transaction Code.
Tab Strip:

For every tab SAP Generate sub screen

1. Create module pool program


2. Create Screen
3. Add PO number field and submit button.
Select edit –wizard for creating element.

Continue
Continue
Continue
Continue

You can change display length of tab.


SAP will generate all this logic automatic.

Create internal table and work area for header and item table.

TYPES: BEGIN OF lty_data,


ono type zordh_28-ono, "Order Number
od type zordh_28-od, "Order Date
paym type zordh_28-paym, "Payment Mode
tamt type zordh_28-tamt, "Total Amount
curr type zordh_28-curr, "Currency
END OF lty_data.

data: lt_data TYPE TABLE of lty_data,


ls_data TYPE lty_data.

TYPES: BEGIN OF lty_data1,


ono type zordi_28-ono, "Order Number
ioin type zordi_28-ioin, "Item Number
iod type zordi_28-iod, "Item Description
ic type zordi_28-ic, "Item Cost
END OF lty_data1.

data: lt_data1 TYPE TABLE of lty_data1,


ls_data1 TYPE lty_data1.
Create table control on 102 screen.

Continue
Continue
Continue
Continue
Continue –Complete

Create Tcode:
Double click on 100

Uncomment PAI and write a below logic.


*----------------------------------------------------------------------*
***INCLUDE ZTAB_STRIP_USER_COMMAND_010I01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
SELECT ono od paym tamt curr from zordh_28
into TABLE lt_data where ono = zordh_28-ono.

IF lt_data is NOT INITIAL.


select ono ioin iod ic from zordi_28
INTO TABLE lt_data1 FOR ALL ENTRIES IN
lt_data where ono = lt_data-ono.

READ TABLE lt_data into ls_data INDEX 1.


IF sy-subrc = 0.
zordh_28-od = ls_data-od.
zordh_28-paym = ls_data-paym.
zordh_28-tamt = ls_data-tamt.
zordh_28-curr = ls_data-curr.
ENDIF.

ENDIF.
ENDMODULE.

Save main program.

Execute in new window.


Purchase Order Screen

Double click on 100.


Select flow logic.

Uncomment PBO and PAI Module.


Double click on STATUS_0100.

Uncomment and double click on PF-Status.

Double on EXIT
Give function type and save it.
Double click on EXIT.

Save it.

Back
Double click on user_command_0100.

Back.

Click on layout.
Save it.

Uncomment Save.

Double click on it.


Save and Activate.

Source Code:
*&---------------------------------------------------------------------*
*& Report ZPO_HEADER
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPO_HEADER.
tables: zpoheader.

data: it_data TYPE zpoheader,


is_flag type flag.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.


PARAMETERS: ord_num type zpoheader-ORDER_N OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

select SINGLE * from zpoheader into CORRESPONDING FIELDS OF it_data where orde
r_n = ord_num.

it_data-order_n = ord_num.
call SCREEN 0100.
end-of-selection.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'PFS'.
SET TITLEBAR 'TTL'.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit INPUT.
set SCREEN 0.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
SET SCREEN 0.
WHEN 'SAVE'.
PERFORM SAVE.
ENDCASE.

CLEAR: SY-UCOMM.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Form SAVE
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM save .
IF it_data-odate IS INITIAL.
it_data-odate = sy-datum.

ENDIF.
modify zpoheader from it_data.
MESSAGE 'Date saved succefully' TYPE 'S'.
SET SCREEN 0.
ENDFORM.
Create Tcode

Create table control

Select screen 200 and click on layout.

1.Select table
controller with wizard
Drag and drop table.

Select Continue.
Give table name and continue.
Select internal program table.

Continue.
Select all fields.
Continue.
Select Scroll.
Continue.
Write a logic for item details

Execute program in new window.


Give order number and select Submit button.

You can see order item details.


How to call sub screen in the normal screen.

Tcode:SE38

Click on create.
Activate Program.
Select Display Object List

Select program-Right click

Now select create – Screen


Give screen number press enter.

Give Description

Save it.
Follow same steps and create Subscreen 200

Select screen 100 and open screen painter.

a) Create sub screen area in normal screen.


Select subscreen area

Drag and drop sub screen and give name.

Save it.
1.Select dictionary/program field
Double click on screen 200.
2. Give table name 3. Click here

Drag and drop fields and select do not transform

Save it.
b) Call the subscreen into sub screen area of main screen.

Syntax: CALL SUBSCREEN SUB INCLUDING SY-REPID ‘0200’.

Sy-repid – system variable for report id.

Save and activate.

Create Tcode:

Select transaction code.


Give transaction code and press enter.
Save it.

Save and Activate.


Uncomment PAI Module.

Double click on it.

You might also like