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

Matchcode for subscreen select options

Former Member
0 Likes
3,737

Hi,

I am displaying a selection screen subscreen as a popup in my report using module pool and it has two fields say,

1. ABC

2. XYZ

I need to implement custom search help for these two fields.

The problem is where to implement this??

My report structure,

1.Main Selection screen

2.Selection screen subscreen

I am not able to write anything in AT SELECTION SCREEN events as it isnt getting triggered for the subscreen fields - ABCand XYZ. I then debugged and checked that when I click F4 on these two fields it is going to the USER COMMAND of the module pool screen with SY-UCOMM &SAV irrespective of the screen fields clicked.

Is there any way to identify which field was clicked so that I can build my custom search help?

15 REPLIES 15
Read only

bharat_rathod2
Active Participant
0 Likes
2,682

dear,

put logic on subscreen under POH.

Read only

0 Likes
2,682

But i will not be able to refer the fieldnames. Because they are declared in the selection screen stmts and the module pool screen carries just a empty subscreen area

Read only

0 Likes
2,682

so put your logic just below you selection screen .

Read only

0 Likes
2,682

I dont get you.. How to put below selection screen?

Read only

0 Likes
2,682

Dear Sharan,

If you are not able to put logic below the selection screen statement.

then create a screen field for your field and use POV.

Read only

0 Likes
2,682

Is there a way to associate the screen field to my selection screen field. My worry is I should not disturb the existing selection screen subscreen popup.

Read only

0 Likes
2,682

Dear Sharan,

please use statement

AT SELECTION-SCREEN on VALUE-REQUEST FOR

just below your subscreen selection statement.

it is working i checked it.

Read only

0 Likes
2,682

Check my code,

SELECTION-SCREEN BEGIN OF BLOCK zb1.

SELECT-OPTIONS : s_pgc   FOR zdpmotac-pl    MATCHCODE OBJECT zz_sh_prog,          "Program Code

                  s_ver   FOR zdpmotac-ver   MATCHCODE OBJECT zz_sh_prog_version,  "Version

                  s_verrk FOR zdpmotac-verrk MATCHCODE OBJECT zz_sh_prog_verrk,    "Version/Rank

                  s_msn   FOR zdpmotac-msn   MATCHCODE OBJECT zz_sh_prog_msn.      "MSN

SELECTION-SCREEN END OF BLOCK zb1.

SELECTION-SCREEN : BEGIN OF SCREEN 0500 AS SUBSCREEN.

SELECT-OPTIONS : s_msn_p  FOR zdpmotac-msn,

                                s_verk_p FOR zdpmotac-verrk.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN : BEGIN OF LINE,

                  PUSHBUTTON 2(15)  b_but1 USER-COMMAND vald,

                  PUSHBUTTON 17(30) b_but2 USER-COMMAND canc VISIBLE LENGTH 13,

                  END OF LINE.

SELECTION-SCREEN END OF SCREEN 0500.

I have to give search help for fields s_msn_p and s_verk_p. I tried giving an at selection screen as suggested by you below that,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_msn_p-low.

       lwa_field_tab-tabname = 'ZDPMOTAC'.

       lwa_field_tab-fieldname = 'MSN'.

       APPEND lwa_field_tab TO lt_field_tab.

       lw_retfield = 'MSN'.

       SELECT msn FROM zdpmotac INTO TABLE lt_msntab.

       DELETE ADJACENT DUPLICATES FROM lt_msntab.

       CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

         EXPORTING

           retfield        = lw_retfield

           dynpprog        = sy-repid

*         value_org       = 'S'

         TABLES

           value_tab       = lt_msntab

           field_tab       = lt_field_tab

           return_tab      = lt_return_tab

         EXCEPTIONS

           parameter_error = 1

           no_values_found = 2

           OTHERS          = 3.

       IF sy-subrc <> 0.

* Implement suitable error handling here

       ENDIF.

But even then it isnt working for me. Am i missing something here?

Read only

0 Likes
2,682

first ive some answer.

1) you are developing report using mudulepool meanse you create any screen?

2) In which screen you call this subscreen?

now my explanation is working under below scenario.

I create screen for some field and in that screen I call one subscreen which is same as you subscreen.

and I put search help below my sub screen statement.

Read only

0 Likes
2,682

You could try a code like

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_msn_p-low.

  PERFORM f4_msn CHANGING s_msn_p-low.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_msn_p-high.

  PERFORM f4_msn CHANGING s_msn_p-high.

*&---------------------------------------------------------------------*

*&      Form  F4_MSN

*&---------------------------------------------------------------------*

FORM f4_msn  CHANGING p_msn.

* ... definition, load of data and prepare parameters of FM identical (you could define table of value as

* ...static and execute the select only once.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      retfield        = lw_retfield

      dynpprog        = sy-repid

    TABLES

      value_tab       = lt_msntab

      field_tab       = lt_field_tab

      return_tab      = lt_return_tab

    EXCEPTIONS

      parameter_error = 1

      no_values_found = 2

      OTHERS          = 3.

  IF sy-subrc NE 0 AND sy-subrc NE 3.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ENDIF.

  READ TABLE lt_return INTO ls_return

             WITH KEY fieldname = 'MSN'.

  CHECK sy-subrc = 0.

  p_msn = ls_return-fieldval.

ENDFORM.                                                    " F4_MSN

But you could also build via SE11 a search help from your table (*), attach it to the field, no coding necessary, also it will allow multiple-selections, and you can add other selection criteria in the search help if available in the reference database table.

(Less work, easier to maintain, reusable and more user-friendly...)

Regards,

Raymond

(*) If the field is the only primary key (with client too) you could also declare the table as the value table, so search help will be automatically identified by SAP and you wont even have to create an explicit search-help.

Read only

Former Member
0 Likes
2,682

Hi,

Try to use function module "COMPLEX_SELECTIONS_DIALOG" to achieve this.

You can use the return table to populate your own internal range table with the values entered by the user. Basically here you are just simulating the work of a select-options parameter by module pool screen elements.

Read only

0 Likes
2,682

If that FM COMPLEX_SELECTIONS_DIALOG is to be used i have to change the screen again with screen elements in it. If i have to do that, i can design a custom screen myself.. Why to go for a selection screen to be displayed as a module pool screen?

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,682

- You can use the option MATCHCODE OBJECT search_help in your parameter defininion in the SELECTION-SCREEN definition

- Sorry but the AT SELECTION-SCREEN ON VALUE-REQUEST works fine in a selection-screen included in a module. (*)

- If you only have two parameters and no select-options, why did you use a selection-screen, a simple pop-up dynpro with two input fields would perform the job ?

Regards,

Raymond

(*) Look at  SELECTION-SCREEN - AS SUBSCREEN for :

User actions on selection screens defined as subscreens trigger standard selection screen processing, even if they are included in screens

Read only

0 Likes
2,682

I tried using MATCHCODE object and AT SELECTION-SCREEN ON VALUE-REQUEST. but both doesnt yield any result. And those arent parameters.. I went for this option as because i need to display the 2 fields as select options in the pop up screen..

Read only

0 Likes
2,682

If SELECT-OPTIONS, use ON VALUE-REQUEST FOR <name>-low and FOR <name>-high, not FOR <name>. And MATCHCODE OBJECT works fine for SELECT-OPTIONS too.

Could you post your first try code with AT SELECTION-SCREEN ON VALUE-REQUEST and the definition of the SELECTION-SCREEN SUBSCREEN to get better answers.

Regards,

Raymond