Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

selection option on module pool screen?

Former Member
0 Likes
1,185

Hi,

is there any to create selection option on module pool screen...if yes...please let me know the procedure ..

if any body have sample code please send me..

thanks

chanti

1 ACCEPTED SOLUTION
Read only

gopi_narendra
Active Contributor
0 Likes
1,081

You can make use of the Function Module 'COMPLEX_SELECTIONS_DIALOG' to make a field as select options and to get the extended multiple selection button as well.

Please see the sample code as below

In the user command of the button for multiple selection wirte this code wiht the specidfied fields


data: begin of RAN_TRACK occurs 0,
        SIGN   type C length 1,
        OPTION type C length 2,
        LOW    type ZTRACK_NO,
        HIGH   type ZTRACK_NO,
      end of RAN_TRACK.

form MULTIPLE_SELECTION_TRACK_NO .
  call function 'COMPLEX_SELECTIONS_DIALOG'
   exporting
     TITLE                   = 'Multiple Selection for Tracking Number'
*   TEXT                    =
*   SIGNED                  = 'X'
*   LOWER_CASE              = 'X'
*   NO_INTERVAL_CHECK       = ' '
*   JUST_DISPLAY            = ' '
*   JUST_INCL               = ' '
*   EXCLUDED_OPTIONS        =
*   DESCRIPTION             =
*   HELP_FIELD              =
*   SEARCH_HELP             =
*   TAB_AND_FIELD           =
    tables
      RANGE                   = RAN_TRACK
      exceptions
*   NO_RANGE_TAB            = 1
*   CANCELLED               = 2
*   INTERNAL_ERROR          = 3
*   INVALID_FIELDNAME       = 4
     others                  = 5
            .
  if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

endform.                    " multiple_selection_track_no

Regards

Gopi

7 REPLIES 7
Read only

Former Member
0 Likes
1,081

Hi

Its necessary that you post the complete requirement as you can put any functionality on a module pool screen whether radio button or a push button or a input/output box.

regards

swati

Read only

former_member194669
Active Contributor
0 Likes
1,081

Hi,

you can also used FM COMPLEX_SELECTIONS_DIALOG to achieve this.

If the number of parameters/select-options are more its better to go with the method .

please try the below code.

SELECTION-SCREEN BEGIN OF SCREEN 1020 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 3(5) TEXT-009.

SELECTION-SCREEN POSITION 10.

SELECT-OPTIONS : S_CORR FOR Table-field MATCHCODE OBJECT mcd.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF SCREEN 1020.

In module pool declare subscreen area and do the below.

PROCESS BEFORE OUTPUT.

MODULE STATUS_100.

CALL SUBSCREEN ANA_SCA

INCLUDING 'YHPRMAIN' '1020'.

PROCESS AFTER INPUT.

CALL SUBSCREEN ANA_SCA.

MODULE USER_COMMAND_100.

a®

Read only

Former Member
0 Likes
1,081

.

Message was edited by:

Kiran Machavarapu

Read only

Former Member
0 Likes
1,081

hi,

In module pool you cant create a select options,

i hope it is the only drawback,

expert,

Please correct me I am wrong.

regards,

Prabhu

reward if it is helpful.

Read only

Former Member
0 Likes
1,081

There is a way to have select options in module pool as said by ARS.

i.e.:

--


main program--

&----


*& Module pool Z10_SBANERJEE_MODULE_MM *

*& *

&----


*& *

*& *

&----


PROGRAM z10_sbanerjee_module_mm NO STANDARD PAGE HEADING LINE-COUNT 36

MESSAGE-ID z10sban.

    • Author :

  • Saurabh Banerjee on 16th August 2007.

    • Description:

  • Module Pool to get range of matnr and mtart

  • from select-options and print report.

----


  • T A B L E S D E C L A R A T I O N

----


TABLES: mara.

&----


  • D A T A D E C L A R A T I O N

&----


--


structure for matnr and mtart--

TYPES: BEGIN OF t_mat,

matnr TYPE matnr, "material no

mtart TYPE mtart, "material type

END OF t_mat.

DATA: it_mat TYPE STANDARD TABLE OF t_mat. "internal table

DATA: wa_mat TYPE t_mat. "work area

DATA: OK_CODE(20). "ok code

DATA: D_ANS. "user choice in exit

--


Custom Selection Subcreen 1010--

SELECTION-SCREEN BEGIN OF SCREEN 1010 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS: s_matnr FOR mara-matnr,

s_mtart FOR mara-mtart.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN END OF SCREEN 1010.

&----


*& Module STATUS_0501 OUTPUT

&----


  • text

----


MODULE status_0501 OUTPUT.

SET PF-STATUS 'SBMENU'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0501 OUTPUT

&----


*& Module USER_COMMAND_0501 INPUT

&----


  • text

----


MODULE user_command_0501 INPUT.

CASE OK_CODE.

WHEN 'SBM1'. "submit values for matnr and mtart

--


leaving to list processing--

LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 501.

--


normal list printing using write--

sort it_mat by matnr.

ULINE.

WRITE:/ 'FUJITSU INDIA LTD MATERIAL INFORMATION'

, sy-datum.

ULINE.

WRITE:/10 'Material Number' COLOR 3,40 'Material Type' COLOR 5.

ULINE.

SKIP 2.

--


looping at it_mat to print values--

loop at it_mat into wa_mat.

WRITE:/10 wa_mat-matnr COLOR 3 ,40 wa_mat-mtart COLOR 5.

endloop.

WHEN OTHERS.

ENDCASE.

endmodule. " USER_COMMAND_0501 INPUT

&----


*& Module EXIT_PROGRAM INPUT

&----


  • text

----


module EXIT_PROGRAM input.

-----calling function to confirm before exit--


CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

text_question = 'Do You Really want to Exit?'

text_button_1 = 'Yes'

text_button_2 = 'No'

IMPORTING

answer = d_ans

EXCEPTIONS

text_not_found = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF d_ans = '1'. "yes

CLEAR wa_mat.

LEAVE PROGRAM.

endif.

endmodule. " EXIT_PROGRAM INPUT

&----


*& Module FILL_VAL INPUT

&----


  • text

----


module FILL_VAL input.

GET PARAMETER ID 'MAT' FIELD S_MATNR-LOW.

GET PARAMETER ID 'MAT' FIELD S_MATNR-HIGH.

-----selecting records for corresponding matnr and mtart--


SELECT matnr

mtart

INTO TABLE IT_MAT

FROM MARA

WHERE MATNR IN S_MATNR AND

MTART IN S_MTART.

--


validating matnr and mtart--

IF SY-SUBRC <> 0.

MESSAGE E004.

ENDIF.

endmodule. " FILL_VAL INPUT

--


screen 501 flow logic--

PROCESS BEFORE OUTPUT.

MODULE STATUS_0501.

call subscreen : SUBSCREEN_1010 including sy-repid '1010'.

PROCESS AFTER INPUT.

MODULE FILL_VAL.

MODULE EXIT_PROGRAM AT EXIT-COMMAND.

MODULE USER_COMMAND_0501.

call subscreen : SUBSCREEN_1010.

But there is another problem...i.e. when i put values in the select options

input box and click 'SBM1',the table s_matnr doesnt have the values initially.

so initially all records are displayed.Then when executed the next time,the

table s_matnr contains the values which were entered initially.

What is happening is that when we put values in the fields ,they get inserted into

the internal table only after we click the button.

Read only

gopi_narendra
Active Contributor
0 Likes
1,082

You can make use of the Function Module 'COMPLEX_SELECTIONS_DIALOG' to make a field as select options and to get the extended multiple selection button as well.

Please see the sample code as below

In the user command of the button for multiple selection wirte this code wiht the specidfied fields


data: begin of RAN_TRACK occurs 0,
        SIGN   type C length 1,
        OPTION type C length 2,
        LOW    type ZTRACK_NO,
        HIGH   type ZTRACK_NO,
      end of RAN_TRACK.

form MULTIPLE_SELECTION_TRACK_NO .
  call function 'COMPLEX_SELECTIONS_DIALOG'
   exporting
     TITLE                   = 'Multiple Selection for Tracking Number'
*   TEXT                    =
*   SIGNED                  = 'X'
*   LOWER_CASE              = 'X'
*   NO_INTERVAL_CHECK       = ' '
*   JUST_DISPLAY            = ' '
*   JUST_INCL               = ' '
*   EXCLUDED_OPTIONS        =
*   DESCRIPTION             =
*   HELP_FIELD              =
*   SEARCH_HELP             =
*   TAB_AND_FIELD           =
    tables
      RANGE                   = RAN_TRACK
      exceptions
*   NO_RANGE_TAB            = 1
*   CANCELLED               = 2
*   INTERNAL_ERROR          = 3
*   INVALID_FIELDNAME       = 4
     others                  = 5
            .
  if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

endform.                    " multiple_selection_track_no

Regards

Gopi

Read only

Former Member
0 Likes
1,081

check the standard program <b>demo_sel_screen_as_subscreen</b>