In the following example we are creating a module pool program where a Modal dialog box will be implemented. There is a selection screen with select option for creation date of materials. There are radio buttons of Raw materials and finished good materials. We can enter date range here and select the material type radio button and click on the display button. Now it will open a pop up screen where a table control will display the required list of materials.
1)      At first we created the module pool program. Four includes will be there as follows.
   INCLUDE zsr_top                                 .  " global Data
INCLUDE zsr_o01                                 .  " PBO-Modules
INCLUDE zsr_i01                                 .  " PAI-Modules
INCLUDE zsr_f01                                 .  " FORM-Routines
2)      Create the top include where all data & table declarations are there.
   PROGRAM sapmzsr_test.

TABLES: mara.
DATA: ok_9000 TYPE sy-ucomm,
      ok_9001 TYPE sy-ucomm,
      roh     TYPE VALUE 'X',
      fert    TYPE c.

TYPES: BEGIN OF ty_mara,
         matnr TYPE mara-matnr,
         ersda TYPE mara-ersda,
         ernam TYPE mara-ernam,
         mtart TYPE mara-mtart,
         matkl TYPE mara-matkl,
         meins TYPE mara-meins,
       END OF ty_mara.
DATA: wa_mara TYPE ty_mara,
      it_mara TYPE TABLE OF ty_mara.

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECT-OPTIONS s_date FOR mara-ersda.
SELECTION-SCREEN END OF SCREEN 100.

CONTROLS: tabc TYPE TABLEVIEW USING SCREEN 9001.
3)      Now create the screens where the modal dialog box will be selected. Since we are implementing select option, a default 100 number of screen will be created. Hence there will be three screens: sub screen for select option, calling screen 9000 and modal dialog box 9001.
      PROCESS BEFORE OUTPUT.
  MODULE status_9000.
  CALL SUBSCREEN sel INCLUDING sy-repid '100'.

PROCESS AFTER INPUT.
  CALL SUBSCREEN sel.
  MODULE user_command_9000.
__________________________________________________________________________
      PROCESS BEFORE OUTPUT.
  MODULE status_9001.

  LOOP AT it_mara INTO wa_mara WITH CONTROL tabc.
    MODULE tabc_modal.
  ENDLOOP.

PROCESS AFTER INPUT.
  LOOP AT it_mara.
    MODULE tabc_modify_modal.
  ENDLOOP.



Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Consultant
Contact : serkurumsal@yandex.com