There are three ways of displaying field help for screen elements:
Data Element Documentation
If you place a field on the screen in the Screen Painter by copying an ABAP Dictionary field, the corresponding data element documentation from the ABAP Dictionary is automatically displayed when the user chooses field help (as long as the help has not been overridden in the screen flow logic).
For further information about creating data element documentation, refer to Data Elements.
Data Element Supplement Documentation
If the data element documentation is not sufficient, you can expand it by writing a data element supplement
Data element supplement documentation contains the heading Definition, as well as the following:
You can create data element supplement documentation in the
ABAP Dictionary when you edit a data element,
Screen Painter (),
F1 Help, by choosing
You assign the documentation to a screen field in the Screen Painter or by calling the SAPscript Editor from the document display for the screen field. This assignment is stored in the database table THLPF. You can also create and change the link data (program name, screen number, field name, and number of data element supplement documentation) directly in this table by choosing.
The data element supplement documentation statically assigned in table THLPF is automatically displayed when the user calls the F1 Help. This static assignment, however, can be overidden dynamically so that the screen flow logic responds to the POH event as follows:
PROCESS ON HELP-REQUEST. ... FIELD f [MODULE mod] WITH num. ...
After PROCESS ON HELP-REQUEST, you can only use FIELD statements. If there is no PROCESS ON HELP-REQUEST keyword in the flow logic of the screen, the data element documentation for the current field, or no help at all is displayed when the user chooses F1. Otherwise, the next FIELD statement containing the current field f is executed.
If there is screen-specific data element supplement documentation for the field f, you can display it by specifying its number num. The number num can be a literal or a variable. The variable must be declared and filled in the corresponding ABAP program.
You can fill the variables, for example, by calling the module mod before the help is displayed. However, the FIELD statement does not transport the contents of the screen field f to the ABAP program in the PROCESS ON HELP-REQUEST event.
For further information about data element supplement documentation, refer to Data Element Supplements.
Calling Help Texts from Dialog Modules
If the data element supplement documentation is not sufficient for your requirements, or if you want to display help for program fields that you have not copied from the ABAP Dictionary, you can call dialog modules in the POH event:
PROCESS ON HELP-REQUEST. ... FIELD f MODULE mod. ...
After the PROCESS ON HELP-REQUEST statement, you can only use the MODULE statement together with the FIELD statement. When the user chooses F1 for a field f, the system calls the module mod belonging to the FIELD statement. If there is more than one FIELD statement for the same field f, only the first is executed. However, the contents of the screen field f are not available in the module mod, since it is not transported by the FIELD statement during the PROCESS ON HELP-REQUEST event. The field help should not be dependent on the user input.
The module mod is defined in the ABAP program like a normal PAI module. The processing logic of the module must ensure that adequate help is displayed for the field in question. Instead of calling an extra screen with text fields, you should use one of the following function modules to display a suitable SAPscript document:
This function module displays the data element documentation for components of any structure or database table from the ABAP Dictionary. You pass the name of the component and structure or table to the import parameters FIELD and TABLE.
Use this function module to display any SAPscript document. You must pass the document class (for example, TX for general texts, DE for data element documentation) and the name of the document to the import parameters DOKCLASS and DOKNAME. For technical reasons, you must also pass an empty internal table with the line type TLINE to the tables parameter of the function module.
For further information about how to create SAPscript documents, refer to the Documentation of System Objects documentation.
Field help on screens.
REPORT demo_dynpro_f1_help. DATA: text(30) TYPE c , var(4) TYPE c , int TYPE i, links TYPE TABLE OF tline, field3(10) TYPE c, field4(10) TYPE c. TABLES demof1help. text = text-001. CALL SCREEN 100. MODULE cancel INPUT. LEAVE PROGRAM. ENDMODULE. MODULE f1_help_field2 INPUT. int = int + 1. CASE int. WHEN 1. var = '0100'. WHEN 2. var = '0200'. int = 0. ENDCASE. ENDMODULE. MODULE f1_help_field3 INPUT. CALL FUNCTION 'HELP_OBJECT_SHOW_FOR_FIELD' EXPORTING doklangu = sy-langu doktitle = text-002 called_for_tab = 'DEMOF1HELP' called_for_field = 'FIELD1'. ENDMODULE. MODULE f1_help_field4 INPUT. CALL FUNCTION 'HELP_OBJECT_SHOW' EXPORTING dokclass = 'TX' doklangu = sy-langu dokname = 'DEMO_FOR_F1_HELP' doktitle = text-003 TABLES links = links. ENDMODULE.
The next screen (statically defined) for screen 100 is 100. It has the following layout:
The screen fields DEMOf1HELP-FIELD1 and DEMOF1HELP-FIELD2 from the ABAP Dictionary and the program fields field3 and field4 are assigned to the input fields. The pushbutton has the function code CANCEL with function type E.
The screen flow logic is as follows:
PROCESS BEFORE OUTPUT. PROCESS AFTER INPUT. MODULE cancel AT EXIT-COMMAND. PROCESS ON HELP-REQUEST FIELD demof1help-field2 MODULE f1_help_field2 WITH var. FIELD field3 MODULE f1_help_field3. FIELD field4 MODULE f1_help_field4.
The components FIELD1 and FIELD2 of structure DEMOF1HELP both refer to the data element DEMOF1TYPE. This data element is documented, and also has two supplements with numbers 0100 and 0200.
The following field help is displayed:
When the user chooses F1 on the input field for DEMOF1HELP-FIELD1, the data element documentation for DEMOF1TYPE is displayed, since the field does not occur in the PROCESS ON HELP-REQUEST event.
If the user chooses F1 repeatedly for the input field DEMOF1HELP-FIELD2, the data element documentation is displayed, along with the supplement documentation for either 0100 or 0200 alternately. The variable var is filled in the dialog module f1_help_field2.
When the user chooses F1 on the input field for field3, the data element documentation for DEMOF1TYPE is displayed, since this is called in the dialog module f1_help_field3 by the function module HELP_OBJECT_SHOW_FOR_FIELD.
When the user chooses F1 on the input field for field4, the SAPscript documentation DEMO_FOR_F1_HELP is displayed, since this is called in the dialog module f1_help_field4 by the function module HELP_OBJECT.