Application Development 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: 

How to set restrictions in search help via source code

Former Member
0 Kudos

Hello, I am trying to use search help and I need that it should provide values restricted to some number, this number I get from screen input field and I do not know how to set restriction value automatically. When I click on search help at input field it shows whole list values, I can type number in its restriction but I want to set it automatically, how can I ? or how can i set it in source code? Any advice? Is it possible? Or any other way how can I show list in search help restricted to some value whitch is written in some input field?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello Martin

You can use a search help exit to implement your own logic and import the value from the screen field.

Please take a loot at the following resources:

How To Create Search Help Exit - ABAP Development - SCN Wiki

Implementing Search Help Exits - Code Gallery - SCN Wiki

Regards

Luis Becker

2 REPLIES 2

Former Member
0 Kudos

Hello Martin

You can use a search help exit to implement your own logic and import the value from the screen field.

Please take a loot at the following resources:

How To Create Search Help Exit - ABAP Development - SCN Wiki

Implementing Search Help Exits - Code Gallery - SCN Wiki

Regards

Luis Becker

sjeevan
Active Contributor
0 Kudos

Put something like this in your report program if your search help of one field is dependent on other:


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

   PERFORM char_value_f4 USING 'P_FIELD'

                               'S_FIELD-LOW'.



FORM char_value_f4  USING f_atnam

                          f_atwrt.

   DATA: BEGIN OF it_cawn OCCURS 0,

   atwrt LIKE cawn-atwrt,

   atwtb LIKE cawnt-atwtb,

   END OF it_cawn.

   DATA : it_return TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE.

   DATAtb_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE.

   DATAatinn TYPE cabn-atinn,

          atnam TYPE cabn-atnam.

   CLEAR: it_cawn[],

          it_return[].

***** Begin *** This part is not needed if your F4 of S_FIELD is not dependent on P_FIELD


   MOVE f_atnam TO tb_dynpfields-fieldname.

   APPEND tb_dynpfields.

   CALL FUNCTION 'DYNP_VALUES_READ'

     EXPORTING

       dyname                   = sy-repid "program name

       dynumb                   = '1000' "screen number

       perform_conversion_exits = 'X'

*      perform_input_conversion = 'X'

     TABLES

       dynpfields               = tb_dynpfields

     EXCEPTIONS

       invalid_abapworkarea     = 1

       invalid_dynprofield      = 2

       invalid_dynproname       = 3

       invalid_dynpronummer     = 4

       invalid_request          = 5

       no_fielddescription      = 6

       invalid_parameter        = 7

       undefind_error           = 8

       double_conversion        = 9

       stepl_not_found          = 10

       OTHERS                   = 11.

   IF sy-subrc NE 0.

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

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

   ENDIF.

   READ TABLE tb_dynpfields INDEX 1.

   CHECK NOT tb_dynpfields-fieldvalue IS INITIAL.

   atnam = tb_dynpfields-fieldvalue.


***** End *** This part is not needed if your F4 is not dependent on P_FIELD

   SELECT a~atwrt

          b~atwtb

     INTO CORRESPONDING FIELDS OF TABLE it_cawn

     FROM cawn AS a

     INNER JOIN cawnt AS b

     ON  a~atinn EQ b~atinn

     AND a~atzhl EQ b~atzhl

     INNER JOIN cabn AS c

     ON c~atinn EQ a~atinn

     WHERE c~atnam EQ atnam.

   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

     EXPORTING

       retfield        = 'ATWRT'

       dynpprog        = sy-repid

       dynpnr          = '1000'

       dynprofield     = f_atwrt

       value_org       = 'S'

     TABLES

       value_tab       = it_cawn

       return_tab      = it_return

     EXCEPTIONS

       parameter_error = 1

       no_values_found = 2

       OTHERS          = 3.

   IF sy-subrc <> 0.

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

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

   ENDIF.

ENDFORM.                    " CHAR_VALUE_F4