Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
52 views

Module Programming - II

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.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Module Programming - II

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.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Module Pool Programming

Flow Logic Events


Flow Logic Events

Process on Value Request


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

MODULE INIT OUTPUT.


PROGNAME = SY-REPID.
DYNNUM = SY-DYNNR.
CLEAR: FIELD_VALUE, DYNPRO_VALUES.
FIELD_VALUE-FIELDNAME = 'CARRIER'.
APPEND FIELD_VALUE TO
DYNPRO_VALUES.
ENDMODULE.

MODULE CANCEL INPUT.


LEAVE PROGRAM.
ENDMODULE.
Code
MODULE VALUE_CARRIER INPUT.
CALL FUNCTION
'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME = 'DEMOF4HELP'
FIELDNAME = 'CARRIER1'
DYNPPROG = PROGNAME
DYNPNR = DYNNUM
DYNPROFIELD = 'CARRIER'.
ENDMODULE.
Code
MODULE VALUE_CONNECTION INPUT.

CALL FUNCTION 'DYNP_VALUES_READ'


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.

You might also like