You are on page 1of 4

SELECT-OPTION in Module Pool Screen

My favourite interview question 'Can you define select option in module pool?'... Why not? ....
How?...
The key for having select-option in module pool is loading selection-screen in module pool screen.
We know that defining a select option in selection screen is just a matter of line. But do you know
that selection screen can be defined as subscreen and that can be loaded into subscreen area
module pool program. Bingo!! You got the solution. Still confused follow below steps
Step 1: Create a report with following code.

REPORT zreport .
TABLES : ekko , ekpo .
SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
PARAMETERS : p_bukrs TYPE ekko-bukrs OBLIGATORY DEFAULT '1000'.
SELECT-OPTIONS : s_ebeln FOR ekko-ebeln ,
s_ebelp FOR ekpo-ebelp .
SELECTION-SCREEN END OF SCREEN 300 .
START-OF-SELECTION .
CALL SCREEN 100 .
*&---------------------------------------------------------------------*
*& Module status_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'ZPF01' .
SET TITLEBAR 'ZTITLE01' .
ENDMODULE. " status_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module user_command_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
IF sy-ucomm = 'BACK' OR sy-ucomm = 'EXIT' .
LEAVE TO SCREEN 0 .
ENDIF.
ENDMODULE. " user_command_0100 INPUT
Step 2 : Define screen 100 with subcreen area SUB_1 as shown in below screen shot.

Also define PF status and title bar with names 'ZPF01' and 'ZTITLE01' respectively. This is not shown
in any screen shot.
Step 3 : Put code in PBO and PA1 of screen as shown in below screen shot.

Activate all objects and execute the report you should get following module pool screen with selectoptions.

Select-Options in Module Pool Programming:


This Example will show how to Place select-Options in Module Pool Programming. STEP1:
SE80 -> Create any Program (SAPMZdemo) with TOP include-> SAVE->Create the screen
(100) and Place what ever the elements you need according to your requirement.
And Place one sub screen area also. (Mandatory) STEP 2 :
Place The following code in TOP include.
data : v_kunnr type kunnr,
v_prog type sy-repid value 'SAPMZDEMO',
V_ subdyn1 type sy-dynnr value '200'.
STEP 3:
Create the Include with the name as the user requires (MZDEMO_SUBSCREEN200)
STEP 4:
Place the following code in Include MZDEMO_SUBSCREEN200.
*&---------------------------------------------------------------------*
*& Include

MZDEMO_SUBSCREEN200

*&---------------------------------------------------------------------*
*Selection Screen 200
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME TITLE text-000.
SELECT-OPTIONS : so_kunnr FOR v_kunnr.
SELECTION-SCREEN END OF BLOCK blck1.
SELECTION-SCREEN END OF SCREEN 200.
Save the Include and Activate it.
STEP 5:
Add the Following code in flow logic editor for Screen 100.
process before output.
module status_0100.
call subscreen sub1 including v_prog v_subdyn1.
process after input.
module user_command_0100.

call subscreen sub1.


STEP 6:
Create the Transaction code for the Module Pool Program.
STEP 7:
Save and Activate the Entire Module Pool Program.
And Execute The TCODE which you created.
Now we will get select-Options in Screen.

You might also like