Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Dynpros →  Statements in the Screen Flow Logic →  FIELD →  Field and Input Help →  Field and Input Helps - Examples 

Screens, Input Help in Dialog Modules

The example shows how to implement input help in dialog modules.

Other versions: 7.31 | 7.40 | 7.54

Source Code

REPORT demo_dynpro_f4_help_module .

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 TYPE sy-repid,
      dynnum   TYPE sy-dynnr,
      dynpro_values TYPE TABLE OF dynpread,
      field_value LIKE LINE OF dynpro_values,
      values_tab TYPE TABLE OF values.

CALL SCREEN 100.

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.

MODULE value_carrier INPUT.

  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
       EXPORTING
            tabname     = 'DEMOF4HELP'
            fieldname   = 'CARRIER1'
            dynpprog    = progname
            dynpnr      = dynnum
            dynprofield = 'CARRIER'.

ENDMODULE.

MODULE value_connection INPUT.

  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            dyname             = progname
            dynumb             = dynnum
            translate_to_upper = 'X'
       TABLES
            dynpfields         = dynpro_values.

  field_value = dynpro_values[ 1 ].

  SELECT  carrid, connid
    FROM  spfli
    WHERE carrid = @field_value-fieldvalue
    INTO  CORRESPONDING FIELDS OF TABLE @values_tab.

  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.

Description

The static next screen number of screen 100 is 100. The input fields have been taken from the program fields carrier and connection. The function code of the pushbutton is CANCEL with the function type E. The screen flow logic is as follows:

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.

When choosing the F4 help for the individual fields, the user receives the following types of input help:

  • For the airline, the module value_carrier is called at POV. There the function module F4IF_FIELD_VALUE_REQUEST displays the input help of the component CARRIER1 of the structure DEMOF4HELP from the ABAP Dictionary, that is, the search help DEMOF4DE. The item selected by the user is copied to the screen field carrier.
  • For the connection, the module value_connection is called at POV. There the function module DYNP_VALUE_READ transfers the value of the screen field carrier to the program. SELECT then reads the matching values from the database table SPFLI to internal table values_tab and passes them to the function module F4IF_INT_TABLE_VALUE_REQUEST. The function module displays these values as an input help and copies the item selected by the user to the screen field connection.