This document describes how to program flow logic events in ABAP to provide dynamic dropdown lists for fields. It includes an example using modules to call functions like F4IF_FIELD_VALUE_REQUEST and F4IF_INT_TABLE_VALUE_REQUEST when the user presses F4 in certain fields to populate other dependent fields from database tables. The modules are attached to fields using the FIELD statement within a PROCESS ON VALUE-REQUEST event.
This document describes how to program flow logic events in ABAP to provide dynamic dropdown lists for fields. It includes an example using modules to call functions like F4IF_FIELD_VALUE_REQUEST and F4IF_INT_TABLE_VALUE_REQUEST when the user presses F4 in certain fields to populate other dependent fields from database tables. The modules are attached to fields using the FIELD statement within a PROCESS ON VALUE-REQUEST event.
After the PROCESS ON VALUE-REQUEST statement, you can only use the MODULE statement together with the FIELD statement. When the user chooses F4 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. FLOW LOGIC EVENTS
The module <mod> is defined in the ABAP program
like a normal PAI module.
However, the contents of the screen field <f> are not
available, since it is not transported by the FIELD statement during the PROCESS ON HELP-REQUEST event. Code TYPES: BEGIN OF VALUES, CARRID TYPE SPFLI-CARRID, CONNID TYPE SPFLI-CONNID, END OF VALUES. DATA: CARRIER(3) TYPE C, CONNECTION(4) TYPE C. DATA: PROGNAME LIKE SY-REPID, DYNNUM LIKE SY-DYNNR, DYNPRO_VALUES TYPE TABLE OF DYNPREAD, FIELD_VALUE LIKE LINE OF DYNPRO_VALUES, VALUES_TAB TYPE TABLE OF VALUES. CALL SCREEN 100. Code
EXPORTING DYNAME = PROGNAME DYNUMB = DYNNUM TRANSLATE_TO_UPPER = 'X' TABLES DYNPFIELDS = DYNPRO_VALUES. READ TABLE DYNPRO_VALUES INDEX 1 INTO FIELD_VALUE. Code SELECT CARRID CONNID FROM SPFLI INTO CORRESPONDING FIELDS OF TABLE VALUES_TAB WHERE CARRID = FIELD_VALUE-FIELDVALUE Code CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING RETFIELD = 'CONNID' DYNPPROG = PROGNAME DYNPNR = DYNNUM DYNPROFIELD = 'CONNECTION' VALUE_ORG = 'S' TABLES VALUE_TAB = VALUES_TAB. ENDMODULE. Layout
The next screen (statically defined) for screen 100 is
itself. It has the following layout: Code
PROCESS BEFORE OUTPUT.
MODULE INIT. PROCESS AFTER INPUT. MODULE CANCEL AT EXIT-COMMAND. PROCESS ON VALUE-REQUEST. FIELD CARRIER MODULE VALUE_CARRIER. FIELD CONNECTION MODULE VALUE_CONNECTION.