
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.
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 <data> 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 <data>. <data> = 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:
The parameters can be defined as method parameters of the action. The type of method parameters must be MOVE-compatible with the parameter values.
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 ).