cancel
Showing results for 
Search instead for 
Did you mean: 

Search Help in ALV component

Former Member
0 Kudos

Hi Guys,

I would like to set a predefined value to search criteria in a Dictionary Search Help assigned to an attribute of my context that I visualize in an ALV. The main idea is when I click in this cell, it should appear a Search Help with a value assigned to a parameter in the search criteria, and getting all these values corresponding to this parameter. Is this possible? How could I do this?

Thanks,

Sergio.

Accepted Solutions (1)

Accepted Solutions (1)

former_member210266
Active Participant
0 Kudos

Hi Sergio

This is possible with the help of search help exit.

I had a similar requirement.This is what I have done.

In the callcontrol step 'PRESEL1, we can set the default search criteria.

cl_wdr_value_help_handler=>m_context_element contains the current context element reference from which the search help is triggered.

    IF callcontrol-step EQ 'PRESEL1'.

* Get the context element from which the F4 has been called.
    lo_el_supp_table = cl_wdr_value_help_handler=>m_context_element.

*   get all declared attributes
    lo_el_supp_table->get_static_attributes(
      IMPORTING
        static_attributes = ls_supp_table ).


    IF ls_supp_table-supplier IS NOT INITIAL.
      READ TABLE shlp-selopt
           TRANSPORTING NO FIELDS
           WITH KEY shlpfield = 'NAME1'.
      IF sy-subrc <> 0.
* Add selection criteria in case not added earlier.
        ls_sel_criteria-sign = 'I'.
        TRANSLATE ls_supp_table-supplier TO UPPER CASE.
        ls_sel_criteria-low = ls_supp_table-supplier.
        ls_sel_criteria-shlpfield = 'NAME1'.
        IF ls_supp_table-supplier CA '*'.
          ls_sel_criteria-option = 'CP'.
        ELSE.
          ls_sel_criteria-option = 'EQ'.
        ENDIF.
        APPEND ls_sel_criteria TO shlp-selopt.
        CLEAR ls_sel_criteria.
      ENDIF.
    ENDIF.

ENDIF.

Then in the call control step 'SELECT', I prepared my hit list.

Hope it helps.

Regards

Swati

Answers (0)