There are three ways of displaying field help for screen elements:
If you place a field on the screen in the Screen Painter by copying a 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.
If the data element documentation is insufficient, you can expand it by writing a data element supplement
Data element supplement documentation contains the heading Definition, as well as the following others:
To create data element supplement documentation for a screen, choose Goto -> Documentation -> DE supplement doc. from the element list of the screen. A dialog box appears in which the system proposes a number as the identified for the data element supplement. You can then enter help texts for the above headings using the SAPscript editor.
Data element supplement documentation created in this way is program- and screen-specific. Any data element supplement documentation created in the ABAP Dictionary with the same number is overridden by the screen-specific documentation. You can link existing data element supplement documentation created in the ABAP Dictionary with a screen field by using the table THLPF. To do this, crate a new row in THLPF containing the link data: program name, screen number, field number and number of the additional documentation for the data element.
To display data element supplement documentation, you must code the following screen flow logic in the POH event:
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 FIELDstatement 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.
If data element supplement documentation is insufficient for your requirements, or 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:
FIELD f MODULE mod.
After the PROCESS ON HELP-REQUESTstatement, you can only use the MODULE statement together with the FIELDstatement. When the user chooses F1 for a field f, the system calls the module modbelonging to the FIELD statement. If there is more than one FIELDstatement 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 FIELDstatement 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.
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.
text = text-001.
CALL SCREEN 100.
MODULE cancel INPUT.
MODULE f1_help_field2 INPUT.
int = int + 1.
var = '0100'.
var = '0200'.
int = 0.
MODULE f1_help_field3 INPUT.
CALL FUNCTION 'HELP_OBJECT_SHOW_FOR_FIELD'
doklangu = sy-langu
doktitle = text-002
called_for_tab = 'DEMOF1HELP'
called_for_field = 'FIELD1'.
MODULE f1_help_field4 INPUT.
CALL FUNCTION 'HELP_OBJECT_SHOW'
dokclass = 'TX'
doklangu = sy-langu
dokname = 'DEMO_FOR_F1_HELP'
doktitle = text-003
links = links.
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.
MODULE cancel AT EXIT-COMMAND.
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.