Search on this Website

Friday, December 7, 2007

How to Create F1 or F4 help on Selection Screen

Example 1: F1 Help

This tip has been copied from SearchSap.com
Tip submitted by: Rajeev Dev


Create F1 help for custom ABAP programs at field level. This method can help companies to eliminate the off-line documentation for custom programs. On top of that, users are not required to search for help documentation for a custom program.
Logo is: "Press F1 for help anywhere in SAP".


This is done by using "help-request" events.

Sample code:

at selection-screen on help-request for

message xxxx (ZZ)

You can maintain messages with varied degree of details here. You can also specify examples in messages long text to clarify the contents of program to your valued users.


Example 2: F4 Help
To control F4 help in a selection screen use the

AT SELECTION-SCREEN ON VALUE-REQUEST FOR
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.

No comments: