Replicate equipments with Z fields from ECC to CRM.
Equipment download is an important activity required for any CRM Service implementation. and i have seen requirement in most of the cases to replicate Z fields of the equipments in ECC to CRM.
This Blog will explain how to replicate Z fields of equipment in ECC to CRM.
1. In ECC EQUI table needs to be enhanced with the Z fields.
2. On CRM side Iobjects can be enhanced using set types.Create attributes and set types for the corrosponsing Zfields in ECC.
3. Enhance the BAPI_EQUI1 structure with Z fields in ECC.
4. Enhance the BAPI_EQUI1 structure with Z fields in CRM.
5. Make a copy of standard FM SAMPLE_CUST_EXIT_CRM0_200 and make the changes to add the data to z fields.
FIELD–SYMBOLS: <bapidata> TYPE bapimtcs.
FIELD–SYMBOLS: <fs_bapi_equi1> TYPE bapi_equi1.
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’.
6. GO to FIBF transaction and add the custom function module created in step 5 for process CRM0_200 which will be called before sending the data. Go to the path Setting->Process Module->Of a Customer . With this now Z fields will be transferred to CRM along with the equipment.
7.Create Set type using COMM_ATTRSET.Create Z fields as attributes under the set type
8. 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
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.
-attributes = lt_cust_settype.
APPEND ls_cust_set TO ct_customer_set.