1 Declarations
DATA: l_eh_data TYPE /saptrx/eh_data,
ls_hdr TYPE /saptrx/eh_hdr_dyn,
ls_cntrl TYPE /saptrx/eh_cntrl_dyn,
lt_cntrl TYPE /saptrx/eh_cntrl_tab,
l_eh_flags TYPE /saptrx/eh_access_flags,
l_model TYPE REF TO /saptrx/cl_eh_event_msg_model,
l_evm_data TYPE /saptrx/evm_tables,
ls_evm_hdr TYPE /saptrx/evm_hdr_str,
l_evt_guid TYPE /saptrx/ev_guid,
ls_evmsg TYPE /saptrx/eh_evmsg_dyn,
lt_eh_evmsg TYPE STANDARD TABLE OF /saptrx/eh_evmsg_dyn,
ls_cntrl TYPE /saptrx/eh_cntrl_dyn,
lt_cntrl TYPE /saptrx/eh_cntrl_tab,
l_eh_flags TYPE /saptrx/eh_access_flags,
l_model TYPE REF TO /saptrx/cl_eh_event_msg_model,
l_evm_data TYPE /saptrx/evm_tables,
ls_evm_hdr TYPE /saptrx/evm_hdr_str,
l_evt_guid TYPE /saptrx/ev_guid,
ls_evmsg TYPE /saptrx/eh_evmsg_dyn,
lt_eh_evmsg TYPE STANDARD TABLE OF /saptrx/eh_evmsg_dyn,
l_parameters TYPE /saptrx/evm_par_stru,
l_param1 TYPE /saptrx/function_param,
l_arg_1 TYPE /saptrx/msg_var,
ls_evm_header TYPE /saptrx/evm_hdr_str,
ls_bapi_cntrl TYPE /saptrx/eh_cntrl_dyn,
ls_tspardc TYPE /saptrx/tspardc.
l_param1 TYPE /saptrx/function_param,
l_arg_1 TYPE /saptrx/msg_var,
ls_evm_header TYPE /saptrx/evm_hdr_str,
ls_bapi_cntrl TYPE /saptrx/eh_cntrl_dyn,
ls_tspardc TYPE /saptrx/tspardc.
2 Retrieving Data
2.1 Retrieving Activity Parameters
DATA: l_param1 TYPE /saptrx/function_param,
l_arg_1 TYPE /saptrx/msg_var,
l_arg_1 TYPE /saptrx/msg_var,
* First parameter:
l_param1 = i_eai-task-param_1.
l_param1 = i_eai-task-param_1.
* If parameter is a meta data element like <EVENT_MSG-HDR-TRXCOD>
then:
l_arg_1 = i_eai-eh_model->get_activity_meta_data(
i_eai = i_eai
i_meta_data = l_param1 ).
l_arg_1 = i_eai-eh_model->get_activity_meta_data(
i_eai = i_eai
i_meta_data = l_param1 ).
2.2 Retrieving EH Detail
DATA: l_eh_data TYPE /saptrx/eh_data,
l_eh_flags TYPE /saptrx/eh_access_flags.
l_eh_flags-evm_ext =
l_eh_flags-evmsg =
l_eh_flags-cntrl = 'X'.
l_eh_data = i_eai-eh_model->eh_data( l_eh_flags ).
2.3 Retrieving Event Message Detail
DATA: l_model TYPE REF TO /saptrx/cl_eh_event_msg_model,
l_evm_data TYPE /saptrx/evm_tables.
l_evm_data TYPE /saptrx/evm_tables.
* get Event Message data
l_model ?= i_eai-eh_model.
CALL METHOD l_model->evm_data
IMPORTING
e_evm_data = l_evm_data.
l_model ?= i_eai-eh_model.
CALL METHOD l_model->evm_data
IMPORTING
e_evm_data = l_evm_data.
3 Updating Data
3.1 Updating a Control Parameter
DATA: l_eh_data TYPE /saptrx/eh_data,
ls_cntrl TYPE /saptrx/eh_cntrl_dyn,
ls_bapi_cntrl TYPE /saptrx/eh_cntrl_dyn.
ls_cntrl TYPE /saptrx/eh_cntrl_dyn,
ls_bapi_cntrl TYPE /saptrx/eh_cntrl_dyn.
LOOP AT l_eh_data-cntrl INTO ls_cntrl
WHERE param_name = 'ZEMC_UPDATE_QTY.
WHERE param_name = 'ZEMC_UPDATE_QTY.
ls_bapi_cntrl-param_value = lv_update_qty.
CONDENSE ls_bapi_cntrl-param_value.
CONDENSE ls_bapi_cntrl-param_value.
ls_bapi_cntrl-update_ind = 'U'.
ls_bapi_cntrl-eh_guid = l_eh_data-hdr-eh_guid.
ls_bapi_cntrl-param_value = ls_cntrl-param_value.
ls_bapi_cntrl-param_name = ls_cntrl-param_name.
ls_bapi_cntrl-param_index = ls_cntrl-param_index.
ls_bapi_cntrl-seq_nbr = ls_cntrl-seq_nbr.
ls_bapi_cntrl-language = sy-langu.
ls_bapi_cntrl-param_type = 'C'.
ls_bapi_cntrl-param_length = '15'.
* Add/change/delete control parameter
CALL METHOD i_eai-eh_model->set_cntrl_parameter
EXPORTING
i_eh_cntrl = ls_bapi_cntrl
RECEIVING
result = lv_result.
ls_bapi_cntrl-eh_guid = l_eh_data-hdr-eh_guid.
ls_bapi_cntrl-param_value = ls_cntrl-param_value.
ls_bapi_cntrl-param_name = ls_cntrl-param_name.
ls_bapi_cntrl-param_index = ls_cntrl-param_index.
ls_bapi_cntrl-seq_nbr = ls_cntrl-seq_nbr.
ls_bapi_cntrl-language = sy-langu.
ls_bapi_cntrl-param_type = 'C'.
ls_bapi_cntrl-param_length = '15'.
* Add/change/delete control parameter
CALL METHOD i_eai-eh_model->set_cntrl_parameter
EXPORTING
i_eh_cntrl = ls_bapi_cntrl
RECEIVING
result = lv_result.
ENDLOOP.
No comments:
Post a Comment