Add customer own fields in case of Equipment replication
In the CRM Standard the following data is exchanged between both systems:
- Description
- Long texts
- Hierarchy
- Business partners
- Address
- Status (leading system is the ECC System)
- Variant configuration
- Manufacturer
- ERP identification (such as equipment number)
Sometime it's desired to have customer own field (Z-Fields) in the replication from ECC System to the CRM. These document adress the replication of customer own fields of equipment from ECC to CRM.
- On ECC side the table EQUI needs to be enhanced with the required customer fields.
- Enhance the BAPI_EQUI1 structure with customer fields on ECC & CRM side
.
- Make a copy of standard FM SAMPLE_CUST_EXIT_CRM0_200 on ECC side and make the changes to add the data to the customer fields.
Sample Code
FIELD-SYMBOLS: <bapidata> TYPE bapimtcs.
FIELD-SYMBOLS: <fs_bapi_equi1> TYPE bapi_equi1.
CASE i_obj_name.
WHEN 'EQUIPMENT'.
LOOP AT t_int_tables WHERE tabname = 'EQUI'.
READ TABLE t_bapistruct ASSIGNING <bapidata>
WITH KEY objkey = t_int_tables-objkey
tabname = 'BAPI_EQUI1'.
IF sy-subrc = 0.
ASSIGN <bapistruct>-data TO <fs_bapi_equi1> CASTING.
if <fs_bapi_equi1> is assigned.
<fs_bapi_equi1>-zfield1 = 'value of z field1'.
<fs_bapi_equi1>-zfield2 = 'value of z field2'.
endif.
ENDIF.
ENDLOOP.
endcase.
- Assign the customer functionmodul per process interface
start the SAP-GUi Transaction FIBF
--> Setting->Process Module->Of a Customer
add the custom function module created in step before for process CRM0_200.
With these action the F.M. will be called before sending the data and the customer fields will be transfered to CRM along with the equipment.
- On CRM side objects can be enhanced using set types, create attributes and set types for the relevant customer fields on ECC side .
Create Set type using COMM_ATTRSET on CRM side.Create Z fields as attributes under the set type.
- Implement the CRM_EQUI_LOAD BADI.
use the method Enlarge_set_types to map the fields received from ECC via BDOC to set types in CRM
Example code (without warranty)
DATA ls_cust_set TYPE comxif_pr_s_product_set.
DATA ls_cust TYPE comxif_pr_product_set_cust.
DATA lt_cust_settype TYPE comxif_pr_product_set_cust_t.
DATA ls_product_s_admin TYPE comxif_product_s_admin .
ls_cust_set-settyp_id = 'ZSETTYPE'."ZSETTYPE is the set type name
ls_product_s_admin-task = iv_update_task.
ls_product_s_admin-logsys = iv_logical_system.
ls_product_s_admin-upname = sy-uname.
ls_cust_set-s_admin = ls_product_s_admin.
ls_cust-attr_id = 'ZATTRIBUTE'."ZAATRIBUTE is the attribute in set type ZSETTYPE
ls_cust-value = is_equipment-<ZFIELD>."Zfield
APPEND ls_cust TO lt_cust_settype.
ls_cust_set-attributes = lt_cust_settype.
APPEND ls_cust_set TO ct_customer_set.