SAP: Selection-Screen as subscreen in dialog programming

There would be a time that you will have a certain selection-screen that is being used in more than one dynpro in your program. Instead of coding it for each dynpro, you could just create a subscreen on every dynpro and call the same selection-screen. In this way, you only have one code block for your selection-screen but able to display it on any dynpro you want within your program.

To do this, first create a subscreen area through the screen painter. As an example, let’s name this subscreen area as SUB_1. Now let say we want to call the selection-screen below into our subscreen area SUB_101.

  SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.
    SELECT-OPTIONS: p_comp FOR bseg-bukrs OBLIGATORY,
    p_cust FOR kna1-kunnr.
  SELECTION-SCREEN END OF SCREEN 101.

When calling a subscreen, we must call it in both the PBO and PAI sections of the flow logic of our main screen. The CALL SUBSCREEN statement tells the system to execute the PBO and PAI processing blocks for the subscreen as components of the PBO and PAI of the main screen. Please Refer to the code below.

  PROCESS BEFORE OUTPUT.
    MODULE STATUS_100.
    CALL SUBSCREEN SUB_101 INCLUDING sy-repid ‘101′.

  PROCESS AFTER INPUT.
    CALL SUBSCREEN SUB_1.
    MODULE USER_COMMAND_100.

0 Responses to “SAP: Selection-Screen as subscreen in dialog programming”


  1. No Comments

Leave a Reply