Sunday, 8 April 2012

AT SELECTION-SCREEN ON VALUE REQUEST FOR field

This event is triggered when the user hits F4 on the field in a selection screen. This event gets triggered at the POV of the selection screen.

NOTE: If there is a select-option field, then this event has to be written twice i.e. one for field-low and another for field-high.


REPORT ztest .

TABLES: t001.

TYPES: BEGIN OF x_t001,
                bukrs TYPE t001-bukrs,
                butxt TYPE t001-butxt,
                ort01 TYPE t001-ort01,
                land1 TYPE t001-land1,
                stceg TYPE t001-land1,
             END OF x_t001.

DATA: it_t001 TYPE TABLE OF x_t001 WITH HEADER LINE.

SELECT-OPTIONS s_bukrs FOR t001-bukrs.

INITIALIZATION.
SELECT bukrs butxt ort01 land1 stceg
                      INTO TABLE it_t001
              FROM t001.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bukrs-low.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
  retfield = 'BUKRS'
  dynprofield = 'S_BUKRS'
  dynpprog = sy-cprog
  dynpnr = sy-dynnr
  value_org = 'S'
TABLES
  value_tab = it_t001.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bukrs-high.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
  retfield = 'BUKRS'
  dynprofield = 'S_BUKRS'
  dynpprog = sy-cprog
  dynpnr = sy-dynnr
  value_org = 'S'
TABLES
  value_tab = it_t001.


OUTPUT:

On pressing F4 button on the input field of company code the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field> gets triggered.