Select Options in Module Pool Program
We can make Select Option for input element in the module
pool program. Following are the steps.
Step-1
|
Go to SE80 and create a program (here it is
zsandip_mod).
|
Step-2
|
Create top include with naming convention.
Here the names are:
INCLUDE
zsandip_top
. " global Data
INCLUDE
zsandip_o01
. " PBO-Modules
INCLUDE
zsandip_i01
. " PAI-Modules
INCLUDE
zsandip_f01
. " FORM-Routines
|
Step-3
|
Create a screen that contains a number (here 9000).
|
Step-4
|
Inside the screen create a sub screen by using the sub
screen tool bar. There is no need to create that sub screen separately.
|
Step-5
|
In the Top Include mention the select option like
below:
TABLES mara.
DATA: ok_code
TYPE sy-ucomm.
SELECTION-SCREEN
BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECT-OPTIONS s_matnr FOR mara-matnr.
SELECTION-SCREEN
END OF SCREEN 100.
|
Step-6
|
Now write the code in the flow logic of the screen
9000. In PBO we are calling sub screen 'SEL' which is including the program name with the sub screen number '100'. After that we have to call sub screen 'SEL' at first in the PAI block. If here it is not declared then the Select Option will remain blank.
PROCESS BEFORE
OUTPUT.
MODULE status_9000.
CALL
SUBSCREEN sel INCLUDING sy-repid '100'.
PROCESS AFTER
INPUT.
CALL SUBSCREEN sel.
MODULE user_command_9000.
Here in the Element List we have to declare the
ok_code.
|
Step-7
|
After that create the GUI status and PF status in the
PBO module.
|
Step-8
|
Next in PAI module mention the code shown below:
CASE ok_code.
WHEN 'BACK'.
PERFORM leave.
WHEN 'EXIT'.
PERFORM leave.
WHEN 'CANCEL'.
PERFORM leave.
ENDCASE.
|
Step-9
|
Next declare the subroutine in INCLUDE zsandip_f01 and
mention the following code:
LEAVE TO SCREEN 0.
LEAVE LIST-PROCESSING.
|
Step-10
|
Finally create a transaction code (here zsr_mod) and
run that by separately.
|
Output is as follows (to view large click on the figure):