Hi,
I´m following this Detailed step by step procedure for Creating Gateway Service with all the CRUD Operations and testing them in Service Explorer Part2 , but in my system I'm having problem with the code generated for the method "MATRSET_DELETE_ENTITY ", this code only mapped the keys fields, and the constants values , someone knows why?.
My system:
SAP_BASIS | 740 | 0009 |
SAP_ABA | 740 | 0009 |
SAP_GWFND | 740 | 0014 |
SAP_UI | 740 | 0015 |
method MATRSET_DELETE_ENTITY.
*-------------------------------------------------------------
* Data declaration
*-------------------------------------------------------------
data CLIENTDATA type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPI_MARA.
data CLIENTDATAX type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPI_MARAX.
data HEADDATA type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPIMATHEAD.
data RETURN type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPIRET2.
data LV_RFC_NAME type TFDIR-FUNCNAME.
data LV_DESTINATION type RFCDEST.
data LV_SUBRC type SYST-SUBRC.
data LV_EXC_MSG type /IWBEP/MGW_BOP_RFC_EXCEP_TEXT.
data LX_ROOT type ref to CX_ROOT.
DATA ls_converted_keys TYPE ZCL_ZBPS_MATR_DEMO_MPC=>TS_MATR.
DATA lv_source_entity_set_name TYPE string.
DATA lo_dp_facade TYPE REF TO /iwbep/if_mgw_dp_facade.
*-------------------------------------------------------------
* Map the runtime request to the RFC - Only mapped attributes
*-------------------------------------------------------------
* Get all input information from the technical request context object
* Since DPC works with internal property names and runtime API interface holds external property names
* the process needs to get the all needed input information from the technical request context object
* Get key table information
io_tech_request_context->get_converted_keys(
IMPORTING
es_key_values = ls_converted_keys ).
* Maps constant value to function module parameters
CLIENTDATAX-DEL_FLAG = 'X'.
CLIENTDATAX-MATL_GROUP = 'X'.
* Maps key fields to function module parameters
HEADDATA-MATERIAL = ls_converted_keys-MATERIAL.
* Get RFC destination
lo_dp_facade = /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
lv_destination = /iwbep/cl_sb_gen_dpc_rt_util=>get_rfc_destination( io_dp_facade = lo_dp_facade ).
*-------------------------------------------------------------
* Call RFC function module
*-------------------------------------------------------------
lv_rfc_name = 'BAPI_MATERIAL_SAVEDATA'.
if lv_destination is initial or lv_destination eq 'NONE'.
try.
call function lv_rfc_name
exporting
HEADDATA = HEADDATA
CLIENTDATA = CLIENTDATA
CLIENTDATAX = CLIENTDATAX
importing
RETURN = RETURN
exceptions
system_failure = 1000 message lv_exc_msg
others = 1002.
lv_subrc = sy-subrc.
*in case of co-deployment the exception is raised and needs to be caught
catch cx_root into lx_root.
lv_subrc = 1001.
lv_exc_msg = lx_root->if_message~get_text( ).
endtry.
else.
call function lv_rfc_name destination lv_destination
exporting
HEADDATA = HEADDATA
CLIENTDATA = CLIENTDATA
CLIENTDATAX = CLIENTDATAX
importing
RETURN = RETURN
exceptions
system_failure = 1000 message lv_exc_msg
communication_failure = 1001 message lv_exc_msg
others = 1002.
lv_subrc = sy-subrc.
endif.
*-------------------------------------------------------------
* Map the RFC response to the caller interface - Only mapped attributes
*-------------------------------------------------------------
*-------------------------------------------------------------
* Error and exception handling
*-------------------------------------------------------------
IF lv_subrc <> 0.
* Execute the RFC exception handling process
me->/iwbep/if_sb_dpc_comm_services~rfc_exception_handling(
EXPORTING
iv_subrc = lv_subrc
iv_exp_message_text = lv_exc_msg ).
ENDIF.
IF RETURN IS NOT INITIAL.
* Call RFC call exception handling
me->/iwbep/if_sb_dpc_comm_services~rfc_save_log(
EXPORTING
is_return = RETURN
iv_entity_type = iv_entity_name
it_key_tab = it_key_tab ).
ENDIF.
* Call RFC commit work
me->/iwbep/if_sb_dpc_comm_services~commit_work(
EXPORTING
iv_rfc_dest = lv_destination
) .
endmethod.
The parameter CLIENTDATA never is populated and i had mapped:
If i'll compare this code with the code generated for the method "MATRSET_UPDATE_ENTITY":
method MATRSET_UPDATE_ENTITY.
*-------------------------------------------------------------
* Data declaration
*-------------------------------------------------------------
data CLIENTDATA type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPI_MARA.
data CLIENTDATAX type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPI_MARAX.
data HEADDATA type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPIMATHEAD.
data RETURN type ZIF_BAPI_MATERIAL_SAVEDATA=>BAPIRET2.
data MATERIALDESCRIPTION type ZIF_BAPI_MATERIAL_SAVEDATA=>__BAPI_MAKT.
data LS_MATERIALDESCRIPTION type line of ZIF_BAPI_MATERIAL_SAVEDATA=>__BAPI_MAKT.
data LV_RFC_NAME type TFDIR-FUNCNAME.
data LV_DESTINATION type RFCDEST.
data LV_SUBRC type SYST-SUBRC.
data LV_EXC_MSG type /IWBEP/MGW_BOP_RFC_EXCEP_TEXT.
data LX_ROOT type ref to CX_ROOT.
DATA ls_request_input_data TYPE ZCL_ZBPS_MATR_DEMO_MPC=>TS_MATR.
DATA ls_converted_keys LIKE ER_ENTITY.
DATA lv_source_entity_set_name TYPE string.
DATA lo_dp_facade TYPE REF TO /iwbep/if_mgw_dp_facade.
*-------------------------------------------------------------
* Map the runtime request to the RFC - Only mapped attributes
*-------------------------------------------------------------
* Get all input information from the technical request context object
* Since DPC works with internal property names and runtime API interface holds external property names
* the process needs to get the all needed input information from the technical request context object
* Get request input data
io_data_provider->read_entry_data( IMPORTING es_data = ls_request_input_data ).
* Get key table information
io_tech_request_context->get_converted_keys(
IMPORTING
es_key_values = ls_converted_keys ).
* Maps constant value to function module parameters
CLIENTDATAX-MATL_GROUP = 'X'.
* Maps key fields to function module parameters
HEADDATA-MATERIAL = ls_converted_keys-MATERIAL.
* Map request input fields to function module parameters
CLIENTDATA-base_uom = ls_request_input_data-base_uom.
CLIENTDATA-matl_group = ls_request_input_data-matl_group.
HEADDATA-ind_sector = ls_request_input_data-ind_sector.
HEADDATA-matl_type = ls_request_input_data-matl_type.
LS_MATERIALDESCRIPTION-langu_iso = ls_request_input_data-langu_iso.
LS_MATERIALDESCRIPTION-langu = ls_request_input_data-langu.
LS_MATERIALDESCRIPTION-matl_desc = ls_request_input_data-matl_desc.
* Append lines of table parameters in the function call
IF LS_MATERIALDESCRIPTION IS NOT INITIAL.
APPEND LS_MATERIALDESCRIPTION TO MATERIALDESCRIPTION.
ENDIF.
* Get RFC destination
lo_dp_facade = /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
lv_destination = /iwbep/cl_sb_gen_dpc_rt_util=>get_rfc_destination( io_dp_facade = lo_dp_facade ).
*-------------------------------------------------------------
* Call RFC function module
*-------------------------------------------------------------
lv_rfc_name = 'BAPI_MATERIAL_SAVEDATA'.
if lv_destination is initial or lv_destination eq 'NONE'.
try.
call function lv_rfc_name
exporting
HEADDATA = HEADDATA
CLIENTDATA = CLIENTDATA
CLIENTDATAX = CLIENTDATAX
importing
RETURN = RETURN
tables
MATERIALDESCRIPTION = MATERIALDESCRIPTION
exceptions
system_failure = 1000 message lv_exc_msg
others = 1002.
lv_subrc = sy-subrc.
*in case of co-deployment the exception is raised and needs to be caught
catch cx_root into lx_root.
lv_subrc = 1001.
lv_exc_msg = lx_root->if_message~get_text( ).
endtry.
else.
call function lv_rfc_name destination lv_destination
exporting
HEADDATA = HEADDATA
CLIENTDATA = CLIENTDATA
CLIENTDATAX = CLIENTDATAX
importing
RETURN = RETURN
tables
MATERIALDESCRIPTION = MATERIALDESCRIPTION
exceptions
system_failure = 1000 message lv_exc_msg
communication_failure = 1001 message lv_exc_msg
others = 1002.
lv_subrc = sy-subrc.
endif.
*-------------------------------------------------------------
* Map the RFC response to the caller interface - Only mapped attributes
*-------------------------------------------------------------
*-------------------------------------------------------------
* Error and exception handling
*-------------------------------------------------------------
IF lv_subrc <> 0.
* Execute the RFC exception handling process
me->/iwbep/if_sb_dpc_comm_services~rfc_exception_handling(
EXPORTING
iv_subrc = lv_subrc
iv_exp_message_text = lv_exc_msg ).
ENDIF.
IF RETURN IS NOT INITIAL.
* Call RFC call exception handling
me->/iwbep/if_sb_dpc_comm_services~rfc_save_log(
EXPORTING
is_return = RETURN
iv_entity_type = iv_entity_name
it_key_tab = it_key_tab ).
ENDIF.
* Call RFC commit work
me->/iwbep/if_sb_dpc_comm_services~commit_work(
EXPORTING
iv_rfc_dest = lv_destination
) .
endmethod.
All was fine for update method .
There is a BUG in the generator for the method DELETE?.
Best regards.