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:
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 <f> 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:
• HELP_OBJECT_SHOW_FOR_FIELD
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.
• HELP_OBJECT_SHOW
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 [Extern] documentation.
Field help on screens.
REPORT DEMO_DYNPRO_F1_HELP.
Field Help
DATA: TEXT(30), VAR(4), INT TYPE I,
LINKS TYPE TABLE OF TLINE, FIELD3, FIELD4.
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:
Field Help
December 1999 599
Field 1 Field 2
Cancel Field 3 Field 4
Data element documentation
Data element supplement documentation Any data element documentation
Any documentation
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.
Field Help