‎2007 Jun 25 10:19 AM
Hi all,
I have a simple Z-table for which I have created a search help, and I need to create a <b>search help exit (function module)</b> to use with this search help. In this function module I have to restrict the selection of entries from the Z-table which are to be displayed in the F4-list.
Is there a special way of creating a search help exit function module? Which <b>import parameters</b>, <b>export parameters</b>, and <b>tables</b> are available?
ALL HELPFUL ANSWERS WILL BE REWARDED!
- Mari Virik
‎2007 Jun 25 10:33 AM
‎2007 Jun 25 10:26 AM
‎2007 Jun 25 10:26 AM
You can copy the standard search help exit and make a z copy of
Function Module : F4IF_SHLP_EXIT_EXAMPLE
and include in your search help after making the necessary changes. Please checkout for the RECORD-TAB .. how it is getting poulated by the help of a debugger in the z FM.
RECORD_-TAB will contain the details that is finally output to the screen as search help
You can read documentation for FM: F4IF_SHLP_EXIT_EXAMPLE
More details :
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm
http://fuller.mit.edu/tech/search_helps.ppt#260,5,Simple
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_elementary.htm
http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_exit.htm
‎2007 Jun 25 10:33 AM
‎2007 Jun 25 10:35 AM
Hello Mari
You have to copy the sample function module
F4IF_SHLP_EXIT_EXAMPLE
and adjust it to your requirements.(1) Change the STEP SELECT in your exit function module
*"----------------------------------------------------------------------
* STEP SELECT (Select values)
*"----------------------------------------------------------------------
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
DATA: rc LIKE sy-subrc.
IF callcontrol-step = 'SELECT'.
PERFORM step_select_kostl
CHANGING
record_tab[] shlp_tab[]
shlp callcontrol rc.
IF rc = 0.
callcontrol-step = 'DISP'.
ELSE.
callcontrol-step = 'EXIT'.
ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
*"----------------------------------------------------------------------
* STEP DISP (Display values)
*"----------------------------------------------------------------------(1.a) Selection step in detail:
*&---------------------------------------------------------------------*
*& Form step_select_kostl
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_RECORD_TAB text
* -->P_SHLP_TAB text
* <--P_SHLP text
* <--P_CALLCONTROL text
* <--P_RC text
*----------------------------------------------------------------------*
FORM step_select_kostl
CHANGING
ct_record_tab TYPE ddshreslts
ct_shlp_tab TYPE shlp_desct
cs_shlp TYPE shlp_descr_t
cs_callcontrol TYPE ddshf4ctrl
cd_rc TYPE syst-subrc.
...
* If the CREATE method returned an instance then get the values
* for the F4 list
CHECK ( lo_f4kostl IS BOUND ).
CALL METHOD lo_f4kostl->get_f4_list
RECEIVING
rdo_data = ldo_data.
* NOTE: This method does not return the list directly but a
* data reference to the list.
* Next we dereference the data reference by assigning it to
* an field symbol typed as (generic) table.
ASSIGN ldo_data->* TO <lt_list>.
* NOTE: The structure of the list data is provided in the instance
* attribute MD_TABNAME. This attribute can be initial. However,
* the list data MUST have a FLAT structure, otherwise the mapping
* function module may raise an exception.
* Konvertierung in F4-Format (Trefferliste für Suchhilfe)
CALL METHOD /bvccsap/cl_im_c1_f4kostl=>map_f4ut_results
EXPORTING
id_source_structure = lo_f4kostl->md_tabname
* ID_APPLY_RESTRICTIONS = ' '
CHANGING
cs_shlp = cs_shlp
cs_callcontrol = cs_callcontrol
ct_shlp_tab = ct_shlp_tab
ct_record_tab = ct_record_tab
ct_source_tab = <lt_list>.
ENDFORM. " step_select_kostlI have created a class which returns the selected data as data reference. The data reference is de-referenced to field symbol (of TYPE table) which is then mapped to the parameters of the function module.
(2) Mapping of selected data to search help parameter:
METHOD map_f4ut_results .
CALL FUNCTION 'F4UT_RESULTS_MAP'
EXPORTING
source_structure = id_source_structure
* APPLY_RESTRICTIONS = ' '
TABLES
shlp_tab = ct_shlp_tab
record_tab = ct_record_tab
source_tab = ct_source_tab
CHANGING
shlp = cs_shlp
callcontrol = cs_callcontrol
EXCEPTIONS
illegal_structure = 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.
ENDMETHOD.Regards
Uwe
‎2007 Jun 25 11:24 AM
Hi again Uwe,
I'm trying out your solution, but I get the error message <b>The type "SHLP_DESCR_T" is unknown</b>. The type is in the system as part of type group SHLP - do I have to include this type group anywhere? How and where?
Thank you, points will be rewarded.
- Mari