You are on page 1of 15

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

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 and the last one (_F) is for subroutines. 3. When we declare certain tables statement then an additional Dictionary Structure gets added to the left hand side, similarly with Types and data declaration other two sections (TYPES, FIELDS) gets added. 4. Now right click the object and create a screen say 9500. It will take to SE51 screen for Screen painter. 5. By default the screen flow logic has two modules. Status module in PBO and User Command Module in PAI. Uncomment both and double click each one to generate the 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 and for PF status. 7. PF status is for menu bar, application tool bar and function keys. One can give a new name for status or can provide an existing one. For new name double click on the name . It will navigate to SE41 screen for menu painter. And assign menu bar and application tool bar items for the screen. 8. To design anything on screen go to Lay out and design the screen. During design one can use fields from dictionary or fields from top include by using Dictionary/Program fields option. 9. For the fields which are supposed to do some actions we assign function code in their attribute. 10. The function code gets captured by the OK_CODE field of type Sy-Ucomm inside User command module of PAI. Now specific action items code can be written based on 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 organization value (with search help) , a table control wizard to be displayed which shows the certain details about the sales document header. Steps for Select Options: 1. Create program in se80.

By Debesh

Page 1

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

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 is as 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.

By Debesh

Page 2

Example on Module Pool Programming (Select Options, Search help, Table control in Dialog programming)
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 the modules and double click each to create them inside respective includes . Now create a sub screen area in the layout where select option is needed and give it a name . Then call the below code in the flow logic in PBO. CALL SUBSCREEN <Sub Screen Area Name> including sy-repid '100'.

By Debesh

Page 3

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

Choose the fields that are needed from standard tool bar. Give proper name and use them in application tool bar. Now only these many fields will get activated on our module pool screen.

Set Title.

By Debesh

Page 4

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

Create a sub screen area for select option .

Call it in PBO.

Handle user action in user command module.

By Debesh

Page 5

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

5. Similar to screen creation, right click on the module pool object and create a transaction.

6. Execute transaction to view selection screen.

By Debesh

Page 6

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

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 help option in the attributes section.

By Debesh

Page 7

Example on Module Pool Programming (Select Options, Search help, Table control in Dialog programming)
9. To the same thing programmatically without using standard search help we use POV event.

FIELD lv_vkorg MODULE hlp_vkorg. Double click on the module name and write the code as follows.

By Debesh

Page 8

Example on Module Pool Programming (Select Options, Search help, Table control in Dialog programming)
Now test it.

Steps for Table control : 10. Create a button for user action. And provide a FCT code for that. Now click on table control and follow the steps as follows.

By Debesh

Page 9

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)

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

By Debesh

Page 14

Example on Module Pool Programming (Select Options, Search help, Table control in Dialog programming)
WHERE vkorg GE lv_low AND vbeln LE lv_high. Result :

By Debesh

Page 15

You might also like