04-16-2008 11:28 AM
Hi,
can anybody tell me the sample Module Pool code from scratch till end.
04-16-2008 11:55 AM
these are some links they will surely help u
dialog programming
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
Other useful links:
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
Other links:
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2d40358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/10/e7dbde82ba11d295a40000e8353423/content.htm
For Screens
http://help.sap.com/saphelp_47x200/helpdata/en/e4/2adbef449911d1949c0000e8353423/content.htm
Screen elements
http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f5f2b9911d2954f0000e8353423/content.htm
Processing Screens
http://help.sap.com/saphelp_47x200/helpdata/en/47/e07f682b9911d2954f0000e8353423/content.htm
Complex Screen elements
http://help.sap.com/saphelp_47x200/helpdata/en/fd/02da2a61d811d295750000e8353423/content.htm
Also
From Menu Environment->Examples->ABAP examples
or Using the Tcode ABAPDOCU you can learn Module pool programs.
Check the below link:
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
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
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 users 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
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.
cheers
sharad.
Edited by: sharad narayan on Apr 16, 2008 12:57 PM
Edited by: sharad narayan on Apr 16, 2008 1:00 PM
04-16-2008 12:16 PM
04-16-2008 3:03 PM