Parameter mapping is used for multiple use of actions. If you use one action for several events - for example, multiple buttons - you require unique information to specify the desired assignment. You can get this information using parameter mapping.
We do not recommend that you pass the standard parameter ID (see below), because in this case, actions and UI elements cannot be clearly separated.
Parameter mapping is performed by a program:
DATA PARAMETERS TYPE WDR_NAME_VALUE_LIST. DATA PARAMETER TYPE WDR_NAME_VALUE. DATA data_ref TYPE REF TO data. FIELD-SYMBOLS TYPE any.
" Parameters can be simple values PARAMETER-NAME = 'LINES_TO_INSERT'. PARAMETER-VALUE = '3'. PARAMETER-TYPE = CL_ABAP_TYPEDESCR=>TYPEKIND_STRING. INSERT PARAMETER INTO TABLE PARAMETERS.
" Parameters can be object references PARAMETER-NAME = 'CUSTOMER'. PARAMETER-OBJECT = customer_object. PARAMETER-TYPE = CL_ABAP_TYPEDESCR=>TYPEKIND_OREF. INSERT PARAMETER INTO TABLE PARAMETERS.
" Parameters can be deep data objects (structure/table) CREATE OBJECT data_ref LIKE table. ASSIGN data_ref->* TO . = table. PARAMETER-NAME = 'TABLE'. PARAMETER-DREF = data_ref. PARAMETER-OREF = CL_ABAP_TYPEDESCR=>TYPEKIND_DREF. INSERT PARAMETER INTO TABLE PARAMETERS.
" Specify parameter mapping CL_WD_BUTTON->MAP_ON_ACTION( parameters ).
" Read parameter mapping CL_WD_BUTTON->MAPPED_ON_ACTION( importing parameters = parameters ). |
When the event is triggered, the linked action is called using the following parameters:
● Web Dynpro ABAP standard parameters (ID and CONTEXT_ELEMENT)
● Special parameters of the UI element
● Event parameters specified in the parameter mapping
The parameters can be defined as method parameters of the action. The type of method parameters must be MOVE-compatible with the parameter values.
All method parameters are mandatory. If not all method parameters are filled with event parameters when calling the action, an exception is raised.
Parameter values can also be read using the WDEVENT object:
= WDEVENT->GET_INT( 'LINES_TO_INSERT' ). = WDEVENT->GET_OBJECT( 'CUSTOMER' ). = WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ). |
or
= WD_EVENT->GET_DATA( EXPORTING name = 'TABLE' importing value = table ).
|
No comments:
Post a Comment