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 prog

Former Member
0 Likes
3,405

hi,

can anybody tell me how to go about doing module pool programming ....... to start with ....... how to add 2 nos. using screen with 2 i\o fields for user to input 2 nos. and a output field for result.........

can u tell the coding and the wat plz ..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,023

hi,

MODULE POOL PROGRAMMING:

-


  • These are type M programs in SAP.

  • Screen painter is a tool used to create GUI in ABAP.

  • MPP provides screen painter to create a screen for the program.

  • These programs cannot be executed directly.

  • Customer-specified Transaction code (starting with Z or Y) should be created for each MPP program to execute.

  • We can create any number of screens for a program and we can call these screens very easily.

  • MPP programs should start with the naming convention SAPMZ or SAPMY.

  • SE80 is the Tcode to create MPP programs.

JUST TRY OUT THIS SAMPLE PROGRAM,

MODULE POOL PROGRAMMING:

-


  • This is also called as DIALOG PROGRAMMING.

  • User can make use of multiple screens in this type of programming.

  • These are type 'M' programs in SAP.

EVENTS IN DIALOG PROGRAMMING:

-


1. PROCESS BEFORE OUTPUT (PBO)

2. PROCESS AFTER INPUT (PAI)

3. PROCESS ON VALUE REQUEST (POVR)

4. PROCESS ON HELP REQUEST (POHR)

Navigations to create a simple MPP program:

-


SE80 -> Select Program from drop-down list -> Specify program name starting with SAPMZ or SAPMY -> Press Enter -> Click on Yes to create object -> Create Top Include File by clicking on Continue icon in pop-up screens -> Save under a package -> Assign a request number -> MPP program with specified name is created with Top include File.

To create screen, Right click on program name -> Select Create -> Screen -> Opens Screen Description page -> Enter short description for screen -> Select screen type as NORMAL -> Click on LAYOUT pushbutton from application toolbar -> Opens Screen Painter -> Drag and drop two input fields from toolbar -> Likewise, create two pushbuttons -> Double click on each component -> Opens Attributes box -> Specify attributes for each screen component -> For pushbutton, specify FCT code -> Save the screen -> Click on Flowlogic pushbutton from application toolbar -> Opens Flow logic editor to create event functionalities for screen components -> Decomment PAI module -> Double click on PAI module name -> Click on Yes to create PAI module object -> Opens PAI module -> Specify the following code within module-endmodule statements:

CASE SY-UCOMM.

WHEN 'DISPLAY'.

LEAVE TO LIST-PROCESSING.

WRITE 😕 IO1, IO2.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

-> Save.

Now double click on 'Includes' Folder (TOP INCLUDE FILE) -> Declare variables for input fields as follows:

DATA : IO1(10), IO2(10).

Save -> Activate.

Now To create Transaction Code, right click on Main Program Name -> Create -> Transaction -> Opens an interface -> Enter Tcode name starting with Z or Y -> Enter short description -> Continue -> Opens interface -> Enter Main program name and Screen number to be called first -> Save under a package -> Assign a request number.

Activate all the objects of MPP program by right clicking on Main program Name -> Click on Activate -> Raises 'Objects Activated' message.

To execute the MPP program, specify Tcode name in the Command Prompt area -> Press Enter.

Regards,

Arunsri

8 REPLIES 8
Read only

Former Member
0 Likes
2,023

hi,

u can go to transaction SE80 and give the program name.

then it will ask for the type of program while saving.

just give the type as 'M' for Module pool. (This is because u hav to create a transaction for executing the module pool program.)

u can create screen by rigth clicking the program name and click on create and teh screen,

create->screen give the screen number and description.

double click on the screen a layout button will apper.

then go to the latout to add the text fields and butoon etc whatever u want ot add.

Read only

Former Member
0 Likes
2,023

Hi

This component though is not attached to the screen painter, plays important role in transaction. Normally, for reports, on line executable programs are written but for transaction, Module Pool Programs are written. The module pool program contains only modules to handle various events associated with screen and data declaration statements.

System divides the module pool program into several include program. These are global field, PBO modules, and PAI modules. It is entirely user’s decision whether to use these modules or write directly into main program.

Creation of Module Pool Program

You can create module pool program either through

Object browser

System automatically creates the module pool program and for these program which are created through object browser, system creates the include modules.

Or

ABAP/4 editor

It is similar to normal program creation. Type of program should be given ‘M’ and is not created by system.

Communication between Dynpro and Module Program

For each screen, the system executes the flow logic, which contains corresponding events. The control is passed to Module Pool Program. Module Pool Program handles the code for these events and again passes back control to the flow logic and finally to screen. Unlike on line program, in this case, the control remains with flow logic. The switching of control between flow logic and module pool program and back is common process when user executes transaction.

Creation of a Complete Transaction

Steps involved to create a complete transaction

• Create module pool program.

• From screen painter create screens.

• Write flow logic for each screen.

• Write code for all the events in module pool program.

• Check for any error in screen and flow logic.

• Generate each and every component of screen i.e. flow logic and screen.

• Single screen can be tested using Screen Painter.

• Create transaction code through object browser.

• Generate the transaction code.

• User can execute the transaction by entering the transaction code in the command field.

Handling Function Code

The function code or OKCODE is the last field of Field list. Function code can be handled as follows:

During the Designing of the screen, a function code is assigned to pushbutton.

• In field list, developer needs to specify OKCODE as last field.

• In module program it is a global field and can be evaluated in the PAI event.

• A function code is treated in the same way, regardless it comes from pushbutton, menu item or any other GUI element.

When the user clicks on the Display button, you want to display details of sflight, with corresponding carrid and connid (which is entered by the user).

You can also check the transaction ABAPDOCU which gives you lot of sample programs.

Also you can see the below examples...

Go to se38 and give demodynpro and press F4.

YOu will get a list of demo module pool programs.

One more T-Code is ABAPDOCU.

YOu can find more examples there.

See the prgrams:

DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement

DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB

http://www.geocities.com/ZSAPcHAT

http://www.allsaplinks.com/files/using_table_in_screen.pdf

<REMOVED BY MODERATOR>

Cheers,

Chandra Sekhar.

Edited by: Alvaro Tejada Galindo on Feb 22, 2008 6:05 PM

Read only

Former Member
0 Likes
2,024

hi,

MODULE POOL PROGRAMMING:

-


  • These are type M programs in SAP.

  • Screen painter is a tool used to create GUI in ABAP.

  • MPP provides screen painter to create a screen for the program.

  • These programs cannot be executed directly.

  • Customer-specified Transaction code (starting with Z or Y) should be created for each MPP program to execute.

  • We can create any number of screens for a program and we can call these screens very easily.

  • MPP programs should start with the naming convention SAPMZ or SAPMY.

  • SE80 is the Tcode to create MPP programs.

JUST TRY OUT THIS SAMPLE PROGRAM,

MODULE POOL PROGRAMMING:

-


  • This is also called as DIALOG PROGRAMMING.

  • User can make use of multiple screens in this type of programming.

  • These are type 'M' programs in SAP.

EVENTS IN DIALOG PROGRAMMING:

-


1. PROCESS BEFORE OUTPUT (PBO)

2. PROCESS AFTER INPUT (PAI)

3. PROCESS ON VALUE REQUEST (POVR)

4. PROCESS ON HELP REQUEST (POHR)

Navigations to create a simple MPP program:

-


SE80 -> Select Program from drop-down list -> Specify program name starting with SAPMZ or SAPMY -> Press Enter -> Click on Yes to create object -> Create Top Include File by clicking on Continue icon in pop-up screens -> Save under a package -> Assign a request number -> MPP program with specified name is created with Top include File.

To create screen, Right click on program name -> Select Create -> Screen -> Opens Screen Description page -> Enter short description for screen -> Select screen type as NORMAL -> Click on LAYOUT pushbutton from application toolbar -> Opens Screen Painter -> Drag and drop two input fields from toolbar -> Likewise, create two pushbuttons -> Double click on each component -> Opens Attributes box -> Specify attributes for each screen component -> For pushbutton, specify FCT code -> Save the screen -> Click on Flowlogic pushbutton from application toolbar -> Opens Flow logic editor to create event functionalities for screen components -> Decomment PAI module -> Double click on PAI module name -> Click on Yes to create PAI module object -> Opens PAI module -> Specify the following code within module-endmodule statements:

CASE SY-UCOMM.

WHEN 'DISPLAY'.

LEAVE TO LIST-PROCESSING.

WRITE 😕 IO1, IO2.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

-> Save.

Now double click on 'Includes' Folder (TOP INCLUDE FILE) -> Declare variables for input fields as follows:

DATA : IO1(10), IO2(10).

Save -> Activate.

Now To create Transaction Code, right click on Main Program Name -> Create -> Transaction -> Opens an interface -> Enter Tcode name starting with Z or Y -> Enter short description -> Continue -> Opens interface -> Enter Main program name and Screen number to be called first -> Save under a package -> Assign a request number.

Activate all the objects of MPP program by right clicking on Main program Name -> Click on Activate -> Raises 'Objects Activated' message.

To execute the MPP program, specify Tcode name in the Command Prompt area -> Press Enter.

Regards,

Arunsri

Read only

Former Member
0 Likes
2,023

Hi,

initially goto se38 and create program and then activate it.

Goto T-code se51 and enter and then give the program and the screen number and then then press create

give the description.

press on the layout button and press on the text fields and drag it on the screen.

then give name to both the fields.

then click on the push buttons and drag it on the screen and double click on it one l small screen will be apperaing then give f-code to that button.

then come back to flow logic screen

there will to statements commented remove the comments and double click on it then it will take u to the program in se38.

in that modules u have to write ur PBO code and PAI code.

u need the declare the variables in the program same as the names given in the screen.

in the PAI

case sy-ucomm.

when 'add'.

w_add = w_int + w_int1.

if u have any queries post it again.

Regards,

Manjari.

Read only

0 Likes
2,023

its not working ....

i wrote the below code ...

the name of i/o field is also L1 Ll2 O1 resp.....

PROGRAM ZDBPOOL2.

DATA : L1 TYPE I , L2 TYPE I , O1 TYPE I .

DATA OK_CODE type sy-ucomm .

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

*AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'SUM'.

O1 = L1 + L2 .

*WRITE 😕 O1.

WHEN 'SUB'.

O1 = L1 - L2 .

  • WRITE : O1.

WHEN 'MUL'.

O1 = L1 * L2 .

  • WRITE : O1.

WHEN 'BACK'.

LEAVE PROGRAM.

Read only

0 Likes
2,023

DB,

The names of the screen input fields and variables in program should be same.

EX: you have declared here

L1 TYPE I , L2 TYPE I , O1 TYPE I .

But input screen fields you have given might be diff..

So declare same variable names in Program

Read only

Former Member
0 Likes
2,023

Hi,

i have one confusion. Please anybody can help i.e

i m getting one question like-

Which types of module pool / screen program your doing daily basis.?

Read only

0 Likes
2,023

And what is your confusion?  (Other than managing to re-open a thread that has been dormant since 2008.)

I'd suggest you search and read help - I'm going to lock this thread now before it progresses further...

Cheers,

G.