Saturday, January 14, 2012

SELECT-OPTION in Module Pool Screen

My favorite 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 select-options.

No comments:

Post a Comment