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.