In this blog I will describe how to enhance the customer master Idoc DEBMAS_CFS by a custom own field in order to send additional data in the customer master to Cloud for Customer.
My use case is to send a text field to Cloud for Customer where I pass additional information on the account.
Required steps on ERP side
First thing I am doing is to enhance the respective IDOC DEBMAS_CFS by a new segment where I will put my data. Here are the steps:
- Goto transaction WE31 and create a new segment type which will contain your fields. To do so, in WE31 add a name for your new segment type and press the create symbol. Then enter a short description and add the fields in the segment. In my case this is only a char20 text field.
- Save your new segment.
- To be able to use this segment you need to release it. In the start screen of WE31 choose EDIT->Set release.
- The next step is to create an extension for IDOC type DEBMAS06. To do so, go to transaction WE30, choose radio button Extension and enter a name for your IDOC extension. Press ‘create’.In the pop-up which gets opened, choose radio button ‘Create new’ and enter DEBMAS06 in field ‘linked basic type’. Choose a description and press continue. Place the cursor where you want this segment to be added and press ‘Create segment’. Enter the segment name you created in the previous step.Choose the Minimum and Maximum number of segments in sequence (1 in my case). Press ‘continue’. Press ‘save’. In the upcoming Popup ‘Create Object Directory Entry’ choose the package where you want to save this IDOC extension or create it as a local object in case you do not want to transport it.
- To use the new IDOC extension which was created in the previous steps, we need to assign this extension to our message type. This must be done in transaction WE82. In transaction WE82, choose ‘create new entry’ and enter the following data: Message Type ‘DEBMAS_CFS’, Basic type ‘DEBMAS06’, extension (name of your extension), Release (Release you set for the extension in the previous step). Save this new entry.
- The last step to be able to use this extension is to adapt the Partner profile entry. For this, go to transaction code WE20. Search for Partner Type LS. Search for the logical system entry which you use to communicate with Cloud for Customer and double click on it. In the outbound parameters tables, select the entry with Message Type ‘DEBMAS_CFS’ and do a double click on it. In Tab ‘Outbound Options’, in field ‘Extension’ enter the name of your created extension. Save your changes.
- Now the IDOC segment is ready and can be filled with data. I put data to the IDOC segment through a BAdi implementation of BAdi CUSTOMER_AD_DATA_BI:
METHOD if_ex_customer_add_data_bi~fill_ale_segments_own_data. DATA: ls_idoc_data TYPE edidd. IF i_segment_name = 'E1KNA1M'. ls_idoc_data-segnam = 'ZDEBC4C'. ls_idoc_data-sdata = 'TestC4C'. APPEND ls_idoc_data TO t_idoc_data. e_cimtype = 'ZDEBMC4C'. ENDIF.
I only entered hard coded some text for this custom own field. Another option would be to enhance the customer master by a new Z-field and retrieve and put this value in this BAdi to the new IDOC segment.
How the customer master screen can be enhanced with a custom own field is described in note 577502 – or in more detail in my parallel blog https://blogs.sap.com/wp-admin/post.php?post=646717 .
Necessary steps on HCI and Cloud for Customer side
- To be able to use this enhanced IDOC for the ERP – Cloud for Customer integration, the extended IDOC definition must be uploaded to HCI. This blog describes how to retrieve the new IDOC WSDL from ERP and upload it to HCI (I will also describe in a later step how to upload the retrieved WSDL to HCI): https://blogs.sap.com/2015/05/06/handling-extendedcustom-idoc-in-hci-with-standard-content/
- Next, this field must be added in Cloud for Customer to the account screen and the new WSDL from Cloud for Customer side must be uploaded to HCI as well.
- In Cloud for Customer, go to the Account screen and press ‘Adapt->Edit Master Layout’.
- Place the cursor where you want to add this field and choose ‘Add Field’. In the pop-up which opens, choose ‘New Field’ and create the field as required (see my screenshot on the data I used. Press Save.
- Now this field must be added to the service definition. Press the change properties symbol on this new field and choose Field Definition.
- In the window which gets opened, choose Tab Services. The Service where this field should be added is Business Partner Replication to ERP – General Information. Press the button ‘Add field’ in the Action column. Then save the changes. Now this field is added to service.
- This new service definition should now be uploaded to HCI. To do so, you have to download it from the communication scenario.The communication scenario from which to download it is Business Partner Replication from SAP ERP, Service Replicate Business Partner from SAP ERP. You can follow the steps described under the following link to download the WSDL: https://blogs.sap.com/2013/12/12/guide-how-to-download-wsdl-and-api-documentation-of-a-business-object/
- Logon to your HCI account and choose package SAP Hybris Cloud for Customer Integration with SAP ERP.Click on the ‘Replicate Business Partner from SAP ERP’ iFlow. Then press Edit. Select Mapping and click on the Resource name.Within the Mapping on the left side you need to upload your WSDL for your changed IDOC definition on ERP side. On the right side, the enhanced definition of the Service from Cloud for Customer must be uploaded. To do so press the Edit message button and upload the two files which you downloaded in the previous steps.Once this is done, link the extension fields, see my screenshot:Deploy the iFlow and you are ready to use this new field.
I hope these instructions are useful!