Pressing the F4 button on a dynpro screen field brings up a list of possible values you can enter into that field. This list of values is usually derived from the domain of the data dictionary definition the screen field is based on. Alternatively if you do not want this to happen or if the field does not reference a data dictionary field the F4 help functionality can be created manually. This is done by creating your own bespoke ABAP code and via the PROCESS ON VALUE-REQUEST event assigning it to the relevant screen field.
The below code shows you how to activate the PROCESS ON VALUE-REQUEST event for a specific field抯 F4 value help functionality. It then shows you how to point this event to your bespoke ABAP code, which will display the value help to the user. Finally it shows you how to return the value select by the user to the dynpro screen field.
* Screen flow logic……..
PROCESS BEFORE OUTPUT.
*MODULE PBO_MODULE.
PROCESS AFTER INPUT.
*MODULE PAI_MODULE.
PROCESS ON VALUE-REQUEST. “F4
FIELD EKPO-EBELP MODULE help_ekpo.
* populate screen field from within PROCESS ON VALUE-REQUEST(F4) call
*&——————————————————————*
*& Module help_responsibility INPUT
*&——————————————————————*
* text
*——————————————————————-*
MODULE help_ekpo INPUT.
**Transport values to table dynpro/screen table control
DATA: l_stepl LIKE sy-stepl,
l_indx LIKE sy-stepl.
DATA: dynpfields LIKE dynpread OCCURS 5 WITH HEADER LINE.
* Adjust for scroling within table control
CALL FUNCTION ‘DYNP_GET_STEPL’
IMPORTING
povstepl = l_stepl
EXCEPTIONS
stepl_not_found = 0
OTHERS = 0.
l_indx = tc_ekpotable-top_line + l_stepl – 1.
“tc_ekpotable should already have been declared
REFRESH dynpfields.
CLEAR dynpfields.
dynpfields-fieldname = ‘EKPO-EBELN’.
dynpfields-fieldvalue = ‘00010’ “wa_ekpo-ebeln.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
dynpfields-fieldname = ‘EKPO-EBELP’.
dynpfields-fieldvalue = ‘00020’ “wa_ekpo-ebelp.
dynpfields-stepl = l_stepl.
APPEND dynpfields.
CALL FUNCTION ‘DYNP_VALUES_UPDATE’
EXPORTING
dyname = ‘SAPLZZ_EKKO’ “Program name
dynumb = ‘0100’ “Screen number
TABLES
dynpfields = dynpfields
EXCEPTIONS
OTHERS = 0.
ENDMODULE. ” help_ekpo INPUT
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/20008.html