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

Custom code in selection method for search help

stefan_kolev4
Participant
0 Likes
4,824

Hi,

Is it possible to have my custom code in selection method for a search help.

The idea is to put values needed for search help in one internal table and the result to be based on it.

Regards,

Stefan

9 REPLIES 9
Read only

Former Member
0 Likes
1,596

Hi Stefan,

You could explore the concept of the Search Help Exit where you can change the search help data using ABAP code.

help.sap.com and F1 on the field within the search help from SE11 gives a lot of information.

Cheers,

Aditya

Read only

former_member156446
Active Contributor
0 Likes
1,596

search the forum on search help exit and you can find many post of mine.

Read only

Former Member
0 Likes
1,596

use the following FM for custom search help.

create your internal table for search help and pass to this function module.

F4IF_INT_TABLE_VALUE_REQUEST

Regards,

Lalit Mohan Gupta.

Read only

Former Member
0 Likes
1,596

hi Stefan,

see the below exapmle for F4 help..


F4 Help - Calling it from a program  and limiting values

To avoid the standard F4 help to be show, insert the event PROCESS ON-VALUE-REQUEST in the  program and add a field
statement for the field that should trigger the F4 help. In the mdoule called from PROCESS ON-VALUE-REQUEST, call function module
F4IF_FIELD_VALUE_REQUEST.


Example 1 - Dynpro

process before output.
.....


process after input.
.....


PROCESS ON VALUE-REQUEST.
  FIELD it_zsd00003-prctr MODULE f4_help_for_pctr.



MODULE f4_help_for_pctr INPUT.

* NOTE: 
* Tabname/fieldname is the name of the table and field
* for which F4 should be shown. 
*
* Dynprog/Dynpnr/Dynprofield are the names of the Progran/Dynpro/Field
* in which the f4 value should be returned.
*

* Value: The value of the Dynpro fuield when calling the F4 help. 
* You can limit the values shown, by inseting a value in this parameter
* e.g  '50*' to show only values beginning with 50 



  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      tabname                   = 'ZSD00003'
      fieldname                 = 'PRCTR'
*   SEARCHHELP                = ' '
*   SHLPPARAM                 = ' '
      dynpprog                  = 'ZSD00002_BRUGERKONV_LISTE'
      dynpnr                    = '0100'
      dynprofield               = 'IT_ZSD00003-PRCTR'
*   STEPL                     = 0
      value                     = '50*'
*   MULTIPLE_CHOICE           = ' '
*   DISPLAY                   = ' '
*   SUPPRESS_RECORDLIST       = ' '
*   CALLBACK_PROGRAM          = ' '
*   CALLBACK_FORM             = ' '
* TABLES
*   RETURN_TAB                =

* EXCEPTIONS
*   FIELD_NOT_FOUND           = 1
*   NO_HELP_FOR_FIELD         = 2
*   INCONSISTENT_HELP         = 3
*   NO_VALUES_FOUND           = 4
*   OTHERS                    = 5
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


ENDMODULE.                 " F4_help_for_pctr  INPUT



Example 2 - Report

To control F4 help in a selection screen use the

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field>
event.

Note that for ranges both the low and high value of the field
must have there own ON VALUE-REQUEST

Example:

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-low.
  PERFORM f4_help_prctr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-high.
  PERFORM f4_help_prctr.

REPORT f4help.

PARAMETERS:
p_auart LIKE vbak-auart.



START-OF-SELECTION.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_auart.
  PERFORM f4_help_aaurt.



*---------------------------------------------------------------------*
*       FORM f4_help_auart                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM f4_help_auart.
  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      tabname                   =  'VBAK'
      fieldname                 =  'AUART'
*   SEARCHHELP                = ' '
*   SHLPPARAM                 = ' '
*   DYNPPROG                  = ' '
*   DYNPNR                    = ' '
*   DYNPROFIELD               = ' '
*   STEPL                     = 0
*   VALUE                     = ' '
*   MULTIPLE_CHOICE           = ' '
*   DISPLAY                   = ' '
*   SUPPRESS_RECORDLIST       = ' '
*   CALLBACK_PROGRAM          = ' '
*   CALLBACK_FORM             = ' '
* TABLES
*   RETURN_TAB                =
* EXCEPTIONS
*   FIELD_NOT_FOUND           = 1
*   NO_HELP_FOR_FIELD         = 2
*   INCONSISTENT_HELP         = 3
*   NO_VALUES_FOUND           = 4
*   OTHERS                    = 5
            .
  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.

Regards,

Prabhudas

Read only

Former Member
0 Likes
1,596

Hi,

  • SEARCHHELP = ' '
  • SHLPPARAM = ' '
  • STEPL = 0
  • MULTIPLE_CHOICE = ' '
  • DISPLAY = ' '
  • SUPPRESS_RECORDLIST = ' '
  • CALLBACK_PROGRAM = ' '
  • CALLBACK_FORM = ' '
  • TABLES
  • RETURN_TAB =
  • EXCEPTIONS
  • FIELD_NOT_FOUND = 1
  • NO_HELP_FOR_FIELD = 2
  • INCONSISTENT_HELP = 3
  • NO_VALUES_FOUND = 4
  • OTHERS = 5
  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
AT-SELECTION SCREEN ON VALUE-REQUEST FOR it_zsd00003-prctr . CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST' EXPORTING tabname = 'ZSD00003' fieldname = 'PRCTR' dynpprog = 'ZSD00002_BRUGERKONV_LISTE' dynpnr = '0100' dynprofield = 'IT_ZSD00003-PRCTR' value = '50*' . IF sy-subrc <> 0. ENDIF.

Regards

Krishna

Read only

stefan_kolev4
Participant
0 Likes
1,596

Thanks everybody !

The idea is like this. I would like when we search for a material to have search help with material number, description, stock in plant1, stock in plant2, stock in plant3. I have internal table with needed data, but I don't know how to use it in FM F4IF_INT_TABLE_VALUE_REQUEST.

Please advise !

Stefan

Read only

stefan_kolev4
Participant
0 Likes
1,596

Thanks everybody !

The idea is like this. I would like when we search for a material to have search help with material number, description, stock in plant1,

stock in plant2,

stock in plant3.

I have internal table with needed data,

but I don't know how to use it in FM F4IF_INT_TABLE_VALUE_REQUEST.

Please advise !

Stefan

Read only

stefan_kolev4
Participant
0 Likes
1,596

Solved