Skip to Content
avatar image
Former Member

Select Options in Module pool

Hi,

I want to display 2 fields as select options in a custom module pool screen.

This screen will get trigger through a custom button in the ALV toolbar.

Also this screen has two push buttons which needs to be handled in the PAI.

The main problem here is to display the fields as select options. Declaring a selection screen as a subscreen and calling it here also wont help as this must trigger in the user command of the ALV screen.

I have attached the screenshot of the necessary screen which needs to be designed.

Scrshot.jpg (9.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 09, 2012 at 02:22 PM

    Hi

    At first create a selection screen in your module as following

    SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE TEXT-T01.
    SELECT-OPTIONS : S_BUKRS FOR T001-BUKRS,
    S_LAND1 FOR T001-LAND1.
    SELECTION-SCREEN END OF SCREEN 500.

    At next in the user command form call the selection screen as the example

    FORM USER_COMMAND USING IV_UCOMM TYPE SY-UCOMM
    IS_SELFIELD TYPE SLIS_SELFIELD.
    CASE IV_UCOMM.
    WHEN 'UCOM1. "YOUR COMMAND CODE
    CALL SELECTION-SCREEN '0500' STARTING AT 10 10.
    WHEN OTHERS.

    ENDCASE.

    END FORM.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Try something like that.

      PROGRAM Z_TEST.
      TABLES : T001.
      DATA ITAB TYPE TABLE OF T001.
      DATA: GT_EXCLUDE TYPE TABLE OF RSEXFCODE,
      GS_EXCLUDE TYPE RSEXFCODE.

      INCLUDE <ICONS>.
      *****1000
      SELECT-OPTIONS S_BUK1 FOR T001-BUKRS.
      *****0500
      SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE TEXT-T01.
      SELECT-OPTIONS : S_BUKRS FOR T001-BUKRS,
      S_LAND1 FOR T001-LAND1.
      SELECTION-SCREEN BEGIN OF LINE.

      SELECTION-SCREEN PUSHBUTTON 02(15) BUT1 USER-COMMAND BT01.
      SELECTION-SCREEN PUSHBUTTON 30(15) BUT2 USER-COMMAND BT02.
      SELECTION-SCREEN END OF LINE.

      SELECTION-SCREEN END OF SCREEN 500.

      INITIALIZATION.
      GS_EXCLUDE-FCODE = 'ONLI'.
      APPEND GS_EXCLUDE TO GT_EXCLUDE.
      CALL FUNCTION 'ICON_CREATE'
      EXPORTING
      NAME = ICON_OKAY
      TEXT = ''
      INFO = 'Continue'
      IMPORTING
      RESULT = BUT1
      EXCEPTIONS
      OTHERS = 0.
      CALL FUNCTION 'ICON_CREATE'
      EXPORTING
      NAME = ICON_CANCEL
      TEXT = ''
      INFO = 'Cancel'
      IMPORTING
      RESULT = BUT2
      EXCEPTIONS
      OTHERS = 0.

      AT SELECTION-SCREEN OUTPUT.
      IF SY-DYNNR = '0500'.
      CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
      EXPORTING
      P_STATUS = '%_00'
      P_PROGRAM = 'RSSYSTDB'
      TABLES
      P_EXCLUDE = GT_EXCLUDE.
      ENDIF.

      AT SELECTION-SCREEN.
      IF SY-DYNNR = '0500'.
      CASE SY-UCOMM.
      WHEN 'BT01'.

      WHEN 'BT02'.
      LEAVE TO SCREEN 0.
      ENDCASE.

      ENDIF.

      START-OF-SELECTION.

      SELECT * FROM T001 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE BUKRS IN S_BUK1.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
      I_CALLBACK_PROGRAM = 'Z_GTREN_TEST'
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      I_STRUCTURE_NAME = 'T001'
      TABLES
      T_OUTTAB = ITAB
      EXCEPTIONS
      PROGRAM_ERROR = 1
      OTHERS = 2.
      IF SY-SUBRC <> 0.
      * Implement suitable error handling here
      ENDIF.
      *&---------------------------------------------------------------------*
      *& Form USER_COMMAND
      *&---------------------------------------------------------------------*
      * text
      *----------------------------------------------------------------------*
      * -->IV_UCOMM text
      * -->IS_SELFIELD text
      *----------------------------------------------------------------------*
      FORM USER_COMMAND USING IV_UCOMM TYPE SY-UCOMM
      IS_SELFIELD TYPE SLIS_SELFIELD.
      CASE IV_UCOMM.
      WHEN '&IC1'. "YOUR COMMAND CODE
      CALL SELECTION-SCREEN '0500' STARTING AT 10 10.

      WHEN OTHERS.
      ENDCASE.
      ENDFORM. "USER_COMMAND

  • Aug 09, 2012 at 02:29 PM

    Hi,

    Can u try like this,

    TABLES : vbrk , vbrp .

    SELECTION-SCREEN BEGIN OF SCREEN 400 AS SUBSCREEN.
    PARAMETERS : p_vkorg TYPE vbrk-vkorg OBLIGATORY DEFAULT '1000'.
    SELECT-OPTIONS : s_vbeln FOR vbrk-vbeln,
    s_posnr FOR vbrp-posnr.
    SELECTION-SCREEN END OF SCREEN 400 .

    START-OF-SELECTION .

    CALL SCREEN 100 .

    >

    Now double click on cal screen 100 and follow this 4 steps
    *&---------------------------------------------------------------------*
    *& Module STATUS_0100 OUTPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    MODULE STATUS_0100 OUTPUT.
    * SET PF-STATUS 'xxxxxxxx'.
    * SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_0100 OUTPUT
    *&---------------------------------------------------------------------*
    *& Module USER_COMMAND_0100 INPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    MODULE USER_COMMAND_0100 INPUT.
    ENDMODULE. " USER_COMMAND_0100 INPUT

    >>

    1)Then define screen 100 with subscreen area ,

    2)Do not forget to define pf status,

    3)Put code in PBO and PAI of screen as shown in below screen shot.

    after this double click on all module & write logic in corresponding block.

    4)At last carefully activate all objects and run it.

    Regards

    Kumar Gourav.


    Index.2.jpg (11.8 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 09, 2012 at 08:37 PM

    The 'call subscreen' can be easily handled in the PBO and PAI of the screen you call and that has the pushbuttons. They can also be handled in the PAI of this screen.

    - define screen with subscreen and pushbuttons

    - define subscreen are in this screen

    - call your selection screen defined before as subscreen in PBO and PAI (yes both!) of the button screen

    - define PAI logic for the button screen

    - call altogether from ALV user_command.

    I don't see the big problem. Get involved with subscreens, there's good SAP help.

    Regards

    Clemens

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 05, 2012 at 11:12 AM

    Hi Sharan, I guess you are looking for way to create select-option in module pool program.. for this you can use FM - RS_COMPLEX_SELECTION.

    Regards,

    Rajesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 05, 2012 at 11:50 AM

    HI,

    TABLES: MARA.
    SELECTION-SCREEN: BEGIN OF SCREEN 0021 AS SUBSCREEN.
    SELECT-OPTIONS: S_MAT FOR MARA-MATNR.
    SELECTION-SCREEN: END OF SCREEN 0021.
    create a subscreen area(layout) in your normal screen using 'layout' button.

    this is normal screen flow-logic.

    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0001.
    call SUBSCREEN SUB INCLUDING SY-REPID '0021'.
    *
    PROCESS AFTER INPUT.
    call SUBSCREEN SUB .
    * FIELD S_MAT
    MODULE USER_COMMAND_0001.

    hope it will work.

    regards

    Sabyasachi Karforma

    Add comment
    10|10000 characters needed characters exceeded