Você está na página 1de 53

Example on Module Pool Programming (Select Options, Search help,Table control in

Dialog programming)
By Debesh Page 1
Preliminary Knowledge on Module pool coding:
1.

Create a module pool program. Use SE80 , it would be easier there.2.

By default you will get 4 includes.Out of which one is a Top Include


(_TOP) which is for global data declaration.Next one (_O) is for
PBO. Third one (_I) is for handling user interaction for PAI andthe last one
(_F) is for subroutines.3.

When we declare certain tables statement then an additional


Dictionary Structuregets added to the left hand side, similarly with
Types and data declaration other twosections (TYPES, FIELDS) gets
added.4.

Now right click the object and create a screen say ‘9500’.
It will take to SE51 screenfor Screen painter.5.

By default the screen flow logic has two modules. Status module in
PBO and UserCommand Module in PAI. Uncomment both and double click
each one to generatethe module in respective includes (PBO module in _O
and PAI module in _I include).The Status module has two specific
statements to create PF status and Title.6.

Uncomment the two statements from Status module. Give a name for the
title andfor PF status.7.

PF status is for menu bar, application tool bar and function keys. One can
give a newname for status or can provide an existing one. For new name
double click on thename . It will navigate to SE41 screen for menu
painter. And assign menu bar andapplication tool bar items for the
screen.8.

To design anything on screen go to Lay out and design the screen. During
designone can use fields from dictionary or fields from top include by
usingDictionary/Program fields option.9.

For the fields which are supposed to do some actions we assign function
code in theirattribute.10.

The function code gets captured by the OK_CODE field of type Sy-
Ucomm insideUser command module of PAI. Now specific action items
code can be written basedon the action chosen.11.
At last create a transaction and call it to execute the code.Scenario:Upon
selecting Sales document numbers in select options and choosing sales
organizationvalue (with search help) , a table control wizard to be
displayed which shows the certaindetails about the sales document
header.
Steps for Select Options:
1.

Create program in se80.

Example on Module Pool Programming (Select Options, Search help,Table control in


Dialog programming)
By Debesh Page 2
2.

Double click and create each include.3.

Inside Top Include:Here the lt_vbak is declared to hold sales order


item details .LV_VKORG is for input parameter on screen and coding for
select option for VBELN isas follows:
SELECTION-SCREEN BEGIN OF SCREEN 100 AS
SUBSCREEN.SELECT-OPTIONS vbeln FOR vbak-vbeln.SELECTION-
SCREEN END OF SCREEN 100.
Write the following code to read the select option field value.
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 3
data : lv_low type vbeln, lv_high type vbeln.at selection-
screen on vbeln.lv_low = vbeln-low.lv_high = vbeln-high.4.

Now right click the module pool object and create a screen. Uncomment
both themodules and double click each to create them inside respective
includes . Nowcreate a sub screen area in the layout where select option
is needed and give it aname . Then call the below code in the flow logic in
PBO.
CALL SUBSCREEN <Sub Screen Area Name> including sy-repid
'100'.
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 4
Choose the fields that are needed from standard tool bar. Give proper
name and usethem in application tool bar. Now only these many fields will
get activated on ourmodule pool screen.Set Title.
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 5
Create a sub screen area for select option .Call it in PBO.Handle user
action in user command module.
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 6
5.

Similar to screen creation, right click on the module pool object and
create atransaction.6.

Execute transaction to view selection screen.


Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 7
Steps for Input field with F4 help:
7.

Add a field to the screen for VKORG.8.


For Search help one can use dictionary search help name directly in the
search helpoption in the attributes section.
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 8
9.

To the same thing programmatically without using standard search help


we use POVevent.
FIELD lv_vkorg MODULE hlp_vkorg.
Double click on the module name and write the code as follows.
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 9
Now test it.
Steps for Table control :
10.

Create a button for user action. And provide a FCT code for that. Now
click on tablecontrol and follow the steps as follows.
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 10
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 11
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 12
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 13
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 14
11.

Write the following code in the User command module to populate table
.WHEN 'GET'.SELECT * FROM vbak INTO CORRESPONDING FIELDS OF
TABLE lt_vbak
Example on Module Pool Programming (Select Options, Search help,Table control in
Dialog programming)
By Debesh Page 15
WHERE vkorg GE lv_low AND vbeln LE lv_high.Result :

Você também pode gostar