Home > ABAP > Getting a field value of a screen field

Getting a field value of a screen field

January 29th, 2009

In dialog programming, the value of a screen field will be moved to the variable in your program after the Process After Input (PAI) is executed. What if you need the value before PAI is executed? For example, you have two fields in your screen: functional location (VIQMEL-TPLNR) and equipment (VIQMEL-EQUNR). You need to implement a search help for equipment number, but you only what to get equipments that is installed in the functional location specified.

When you debug your search help module, you can’t get the value of functional location the user entered. Why? Because your search help module will be placed in Process on value-request (POV), and the POV will be executed before PAI.

How to obtain your screen field value then? Simple. Just execute Function Module ‘GET_DYNP_VALUE’ and you will get what you want.

Here’s the example code:
First, define a variable for storing report ID before calling the screen (e.g. 9000).
DATA: L_REPID LIKE SY-REPID.

START-OF-SELECTION.
L_REPID = SY-REPID.
CALL SCREEN 9000.

Here’s the POV implementation in your screen will look like:
PROCESS ON VALUE-REQUEST.
FIELD VIQMEL-EQUNR MODULE F4_EQUNR.

And here’s the module implementation in your program.

MODULE F4_EQUNR.

CALL FUNCTION ‘GET_DYNP_VALUE’
EXPORTING
i_field = ‘VIQMEL-TPLNR’
i_repid = l_REPID
i_dynnr = ‘9000′
changing
o_value = VIQMEL-TPLNR.

PERFORM F4_TPLNR USING VIQMEL-TPLNR
CHANGING VIQMEL-EQUNR.

ENDMODULE.

Voila! You will get your VIQMEL-TPLNR you need. Enjoy!

vera ABAP , ,

  1. No comments yet.
  1. No trackbacks yet.