Skip to Content

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.

Sample Code

  FIELDSYMBOLS: <bapidata>   TYPE bapimtcs.

  FIELDSYMBOLS: <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_tablesobjkey
                   tabname = ‘BAPI_EQUI1’.

                  IF sysubrc = 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.

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

example code

   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_admintask = iv_update_task.
           ls_product_s_adminlogsys = iv_logical_system.
            ls_product_s_adminupname = syuname.

            ls_cust_sets_admin = ls_product_s_admin.
            ls_custattr_id = ‘ZATTRIBUTE’.”ZAATRIBUTE is the attribute in set type ZSETTYPE

           

ls_custvalue = 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.

To report this post you need to login first.

15 Comments

You must be Logged on to comment or reply to a post.

  1. Varun Mishra

    Hi Naresh,

    How did you enhanced the BAPI_EQUI1? If I am seeing at the enhancement category option, it ‘Cannot be Enhanced’.

    Please revert to me asap.

    BR
    Varun

    (0) 
    1. Piyush Arora

      Hi Naresh,

      I am not able to enhanced the BAPI_EQUI1 structure .. category is ” cannot be enhanced ” for this.

      Varun.. how did you solve this ?

      Thanks

      Piyush

      (0) 
      1. Varun Mishra

        Hi Piyush,

        I added one more structure in the internal table of BAPIMTCS at the ECC side in the exit which is called before data is send to CRM, and at CRM side, in the BADI “*EQUI*LOAD” , I fetch the data from that table and then did my processing.

        Hope I am clear. 🙂

        BR
        Varun

        (0) 
        1. Piyush Arora

          Hi Varun,

          Thanks a lot for your reply.

          How you add the structure in internal table. If you can send me code it would be very helpful. I copy the FM SAMPLE_CUST_EXIT_CRM0_200 to my Z FM .

          Thanks Varun.

          (0) 
          1. Piyush Arora

            Hi Varun,

            I have successfully added the structure to BAPIMTCS in ECC side but I am not able to find this in badi crm_equi_load. In which method you have written code to get this data in crm.

            Thanks

            Piyush

            (0) 
                1. Piyush Arora

                  Hi Varun / Naresh,

                  Is there any way we can pass Zfields at Functional location level. I tried to implement the same logic as above but there is no method in CRM_FUNCLOC_BADI to map the set type as it is there in CRM_EQUI_LOAD.

                  Any pointers will be appreciated, how to achieve this.

                  (0) 
  2. Dhaval Raval

    Hi Naresh,

    Thank you for your very useful blog. I have same requirement And I follow the same steps. But Problem what I got is I am able to see Zfield in BDOC in CRM side But Value coming blank .

    Do we have to enter anything in CRMSUBTAB Table .

    I did same coding in function module as defined above.

    Below thing I didn’t do it because I added custom fields iin  BAPI_EQUI1 structure itself.

    I added one more structure in the internal table of BAPIMTCS at the ECC side in the exit which is called before data is send to CRM, and at CRM side, in the BADI “*EQUI*LOAD” , I fetch the data from that table and then did my processing

    Anything I have to do the same.

     

    (0) 

Leave a Reply