‎2012 Aug 23 7:48 AM
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?
‎2012 Aug 23 7:52 AM
‎2012 Aug 23 7:56 AM
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
‎2012 Aug 23 8:03 AM
‎2012 Aug 23 8:09 AM
‎2012 Aug 23 8:11 AM
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.
‎2012 Aug 23 8:20 AM
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.
‎2012 Aug 23 8:37 AM
Dear Sharan,
please use statement
AT SELECTION-SCREEN on VALUE-REQUEST FOR
just below your subscreen selection statement.
it is working i checked it.
‎2012 Aug 23 9:59 AM
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?
‎2012 Aug 23 10:10 AM
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.
‎2012 Aug 23 10:19 AM
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.
‎2012 Aug 23 8:02 AM
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.
‎2012 Aug 23 8:07 AM
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?
‎2012 Aug 23 8:13 AM
- 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
‎2012 Aug 23 8:18 AM
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..
‎2012 Aug 23 8:31 AM
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