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

Search help exit

tarangini_katta
Active Contributor
0 Likes
1,020

Hi All,

I have search help for field.I assigned search help in screen attributes.

Now i want to restrict the values based on some condition while displaying the f4 help.

Where can i restrict the values.

If i write search help exit is this work.If yes how should i write. Can i write the logic in pbo screen

please gi ve me an idea to solve the problem.

Thanks,

I am using a standard search help to display all existing ALV variants for a report. However I only want the user to be able to see variants created by him, therefore I need to restrict the selection displayed in the search help. Since I do not want to modify the search help by adding a search help exit, I manipulate the search help interface before I call it:


*&---------------------------------------------------------------------*
*&      Form  GET_VARIANT_LIST
*&---------------------------------------------------------------------*
FORM get_variant_list CHANGING xy_vari TYPE slis_vari.

  DATA: lt_return TYPE TABLE OF ddshretval,
        ls_return TYPE ddshretval,
        ls_shlp   TYPE shlp_descr,
        ls_if     TYPE ddshiface.

* we need to call the F4 help and make sure that we pass in the
* report name and the current user name => get search help attributes
  CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
    EXPORTING
      shlpname = gc_search_help
    IMPORTING
      shlp     = ls_shlp.

* now we have to set the input values
  READ TABLE ls_shlp-interface
       INTO ls_if
       WITH KEY shlpfield = gc_field_report.
  IF sy-subrc EQ 0.
    ls_if-value = sy-repid.
    MODIFY ls_shlp-interface
           FROM ls_if
           INDEX sy-tabix
           TRANSPORTING value.
  ENDIF.
  READ TABLE ls_shlp-interface
       INTO ls_if
       WITH KEY shlpfield = gc_field_user.
  IF sy-subrc EQ 0.
    ls_if-value    = sy-uname.
    MODIFY ls_shlp-interface
           FROM ls_if
           INDEX sy-tabix
           TRANSPORTING value.
  ENDIF.
* set the field for the return value
  READ TABLE ls_shlp-interface
       INTO ls_if
       WITH KEY shlpfield = gc_field_variant.
  IF sy-subrc EQ 0.
    ls_if-valfield = gc_field_variant.
    MODIFY ls_shlp-interface
           FROM ls_if
           INDEX sy-tabix
           TRANSPORTING valfield.
  ENDIF.

* Now call the search help
  CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
    EXPORTING
      shlp          = ls_shlp
    TABLES
      return_values = lt_return.

* get the value the user selected and pass it back
  READ TABLE lt_return INTO ls_return INDEX 1.
  IF sy-subrc EQ 0.
    xy_vari = ls_return-fieldval.
  ENDIF.

ENDFORM.                    " GET_VARIANT_LIST

That way you can restrict any input parameter that is passed into the search help.

Hope that helps,

Michael

7 REPLIES 7
Read only

Sm1tje
Active Contributor
0 Likes
958

'Example' of search help exit:

F4IF_SHLP_EXIT_EXAMPLE

For some real live examples search for F4IF_SHLP_EXIT* in SE37

Read only

Former Member
0 Likes
958

I am using a standard search help to display all existing ALV variants for a report. However I only want the user to be able to see variants created by him, therefore I need to restrict the selection displayed in the search help. Since I do not want to modify the search help by adding a search help exit, I manipulate the search help interface before I call it:


*&---------------------------------------------------------------------*
*&      Form  GET_VARIANT_LIST
*&---------------------------------------------------------------------*
FORM get_variant_list CHANGING xy_vari TYPE slis_vari.

  DATA: lt_return TYPE TABLE OF ddshretval,
        ls_return TYPE ddshretval,
        ls_shlp   TYPE shlp_descr,
        ls_if     TYPE ddshiface.

* we need to call the F4 help and make sure that we pass in the
* report name and the current user name => get search help attributes
  CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
    EXPORTING
      shlpname = gc_search_help
    IMPORTING
      shlp     = ls_shlp.

* now we have to set the input values
  READ TABLE ls_shlp-interface
       INTO ls_if
       WITH KEY shlpfield = gc_field_report.
  IF sy-subrc EQ 0.
    ls_if-value = sy-repid.
    MODIFY ls_shlp-interface
           FROM ls_if
           INDEX sy-tabix
           TRANSPORTING value.
  ENDIF.
  READ TABLE ls_shlp-interface
       INTO ls_if
       WITH KEY shlpfield = gc_field_user.
  IF sy-subrc EQ 0.
    ls_if-value    = sy-uname.
    MODIFY ls_shlp-interface
           FROM ls_if
           INDEX sy-tabix
           TRANSPORTING value.
  ENDIF.
* set the field for the return value
  READ TABLE ls_shlp-interface
       INTO ls_if
       WITH KEY shlpfield = gc_field_variant.
  IF sy-subrc EQ 0.
    ls_if-valfield = gc_field_variant.
    MODIFY ls_shlp-interface
           FROM ls_if
           INDEX sy-tabix
           TRANSPORTING valfield.
  ENDIF.

* Now call the search help
  CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
    EXPORTING
      shlp          = ls_shlp
    TABLES
      return_values = lt_return.

* get the value the user selected and pass it back
  READ TABLE lt_return INTO ls_return INDEX 1.
  IF sy-subrc EQ 0.
    xy_vari = ls_return-fieldval.
  ENDIF.

ENDFORM.                    " GET_VARIANT_LIST

That way you can restrict any input parameter that is passed into the search help.

Hope that helps,

Michael

Read only

0 Likes
958

Hello Michael,

Thank you so much for your reply.

I will tell you my requirement clearly.

I am using transaction "FB60" In that i have added a custom field using BADI.

I custom search help for that field with all the values.

This cotains some authorization and currency

Now my requirement is i want to display the values only

those curecy values entered in Fb60 transaction.

I have write serach help exit.If i hard coded it is working fine.

But I dont know how the curreny field value of FB60 will get visiablity in serach help exit.

Can you please give me a solution for this.

Thanks,

Read only

0 Likes
958

Hi Tarangini,

The fields in FB60 cannot be used in the search help exit.

Hope you are using custom search hlep. Instead, after fetching the values in an ITAB, filter them by deleting the unwanted ones, and use FM to display the F4 help in PAI module. No need to create any search help exit.

Regards,

Teja.

Read only

0 Likes
958

Hi ,

You can set an set a parameter id for your field ( Custom Field ) in the BADI and get the same in your Search help exit.

Hope this will help.

Read only

0 Likes
958

Hi teja,

Your solution is reasonable Can you please let us know hwich FM i need to use to display the my internal table values in F4 help in PAI.

Thanks

Edited by: tarangini katta on Sep 29, 2009 7:52 AM

Read only

0 Likes
958

Hi,

pass the filtered ITAB to the FM F4IF_INT_TABLE_VALUE_REQUEST.

Regards,

Teja.