Application Development 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: 

modulepool programming

Former Member
0 Kudos

ABAP GURU"S

1- How we create module pool programing?

2- How we create a screen and a subscreen area under the screen give the example and screen shots ?.. Its urgent..

3- where we can find the real discription of ok-code in sap ?...

all three Q? are importand for me plz send immediately.

Thanks

4 REPLIES 4

Former Member
0 Kudos

HI,

On the following link you wioll find some interesting info

And if you execute transaction ABAPDOCU under ABAP Users Dialog you will find differents example that will answerd your question.

Hope that its will help you

Edited by: Jürgen Degraeve on Apr 15, 2008 8:22 AM

Former Member
0 Kudos

hi,

refer the links:

[http://sap.mis.cmich.edu/sap-abap/abap09/sld001.htm]

[http://abaplovers.blogspot.com/2008/03/sap-abap-module-pool-programming.html]

reward if helpfull.

Former Member
0 Kudos

Hi,

Module Pool Programming

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.

Subscreens

A subscreen is a screen within screen.

Step to create a subscreen are as follows:

• Create a subscreen area on MAIN screen and name it.

• Create a separate screen of subscreen type.

• Arrange the fields on this screen so that they fit in subscreen area exactly. Only when it is larger, the part of the screen that fits in the main area will be visible.

• Write code for calling subscreen in flow logic.

To call subscreen, from your flow logic, you need to include the statement both in PAI and PBO.

Syntax

PBO.

Call subscreen <area> including <prg name> <’screen no’>.

PAI.

Call subscreen <area>.

Area - is the name of the area on main screen.

Prg. Name - is the name of the module pool program.

Screen number - is subscreen screen number.

Some of the don’ts with subscreen are:

GUI status cannot be set to the subscreen

• OKCODE is not applicable to the subscreen.

• Subscreen cannot call another screen.

• It cannot contain AT EXIT-COMMAND.

You can call multiple subscreen in the same area (at any given point of time, only one subscreen can be called in the subscreen area) and is done dynamically during runtime by using variable screen number.

OKCODE:

ok_code is generally used in screen as of I have used. You will define the function in the screen. and you can use it in the main program.

ok_code acts just as a temporary variable that stores the value of sy-ucomm.

When user interacts with the screen elements, the function code that you have assigned is filled in the sy-ucomm field which is turn gets reflected in OK_CODE.

In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:

In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.

For more information and examples check the following link:

http://sapmaterial.com/dialog_programming.html

Regards,

Bhaskar

Former Member
0 Kudos

Hi Sachin,

Goto T.code SE51 screen painter.

u can understand it.

or

Goto T.code ABAPDOCU then find module pool pgm. u can learn it...

Module pool pgmming are applied for screen.

Its PBO and PAI and POV and POH.

Reward if useful,

Regards,

S.Suresh