This blog is continuation of SAP Hybris – Customizing Data Hub

Load IDOC to Hybris

  • IDoc is an SAP object that carries data of a business transaction from one system to another in the form of electronic message
  • IDoc is an acronym for Intermediate Document.
  • The purpose of an IDoc is to transfer data or information from SAP to other systems and vice versa.
  • The transfer from SAP to non-SAP system is done via EDI (Electronic Data Interchange) subsystems whereas for transfer between two SAP systems, ALE is used.

Step-by-step procedure.

Step 1: After successfully loading the customproduct 

Step 2: Create the xml (spring.xml)


Note: The below is the sample IDoc (just for an example, you try with your own IDoc)


Step 3:

Now add custom raw data to “customproduct-raw-datahub-extension.xml” , based on the idoc we will add custom rawitems to this XML file and also to “customproduct-raw-datahub-extension-spring.xml” .

  • customproduct-raw-datahub-extension.xml
<extension xmlns:xsi="" xmlns="" xsi:schemaLocation="" name="customproduct-raw"> <dependencies> <dependency> <extension>customproduct-canonical</extension> <extension>saperpproduct-canonical</extension> </dependency> </dependencies> <rawItems> <item> <type>RawCustomProduct</type> <description>Raw representation of a sample raw item</description> <attributes> <attribute> <name>E101COMXIF_PRODUCT_MATERIAL-PRODUCT_ID</name> </attribute> </attributes> </item> </rawItems> <canonicalItems> <item> <type>CanonicalCustomProduct</type> <attributes> <attribute> <name>productId</name> <transformations> <transformation> <rawSource>RawCustomProduct</rawSource> <expression>E101COMXIF_PRODUCT_MATERIAL-PRODUCT_ID</expression> </transformation> </transformations> </attribute> </attributes> </item> </canonicalItems> </extension>



  • customproduct-raw-datahub-extension-spring.xml
<beans xmlns="" xmlns:xsi="" xmlns:context="" xmlns:int="" xmlns:int-xml="" xmlns:util="" xsi:schemaLocation=""> <!-- ========================== --> <!-- Spring-Integration Content --> <!-- ========================== --> <int:channel id="idocXmlInboundChannel"> <int:interceptors> <int:wire-tap channel="logger" /> </int:interceptors> </int:channel> <int:logging-channel-adapter log-full-message="true" id="logger" level="DEBUG" /> <bean id="idocInboundService" class="com.hybris.datahub.sapidocintegration.spring.HttpInboundService"> <property name="idocXmlInboundChannel" ref="idocXmlInboundChannel" /> </bean> <!-- Data Hub input channel for raw data --> <int:channel id="rawFragmentDataInputChannel" /> <!-- Maps received IDOCs by value of header attribute: "IDOCTYP" to corresponding mapping service --> <int:header-value-router input-channel="idocXmlInboundChannel" header-name="IDOCTYP"> <int:mapping value="ZCRMXIF_PRODUCT_MATERIAL" channel="ZCRMMATMAS" /> </int:header-value-router> <!-- sap crm product --> <int:service-activator input-channel="ZCRMMATMAS" output-channel="rawFragmentDataInputChannel" ref="customproductCRMMappingService" method="map" /> <!-- Dummy implementations of mapping services implemented elsewhere --> <bean id="customproductCRMMappingService" class="com.hybris.datahub.sapidocintegration.IDOCMappingService"> <property name="rawFragmentDataExtensionSource" value="customproduct" /> <property name="rawFragmentDataType" value="RawCustomProduct" /> </bean> </beans>

Step 4:

Now add custom canonical data to customproduct-canonical-datahub-extension.xml”


  • customproduct-canonical-datahub-extension.xml
<extension xmlns:xsi="" xmlns="" xsi:schemaLocation="" name="customproduct-canonical"> <canonicalItems> <item> <type>CanonicalCustomProduct</type> <description>Canonical representation of sample item</description> <status>ACTIVE</status> <attributes> <attribute> <name>productId</name> <model> <localizable>false</localizable> <collection>false</collection> <type>String</type> <primaryKey>true</primaryKey> </model> </attribute> </attributes> </item> </canonicalItems> </extension>

Step 5:

Now add custom target data to customproduct-target-datahub-extension.xml”

  • customproduct-target-datahub-extension.xml
<extension xmlns:xsi="" xmlns="" xsi:schemaLocation="" name="customproduct-target"> <dependencies> <dependency> <extension>customproduct-canonical</extension> </dependency> </dependencies> <targetSystems> <targetSystem> <name>HybrisCore</name> <type>HybrisCore</type> <exportURL>${datahub.extension.exportURL}</exportURL> <userName>${datahub.extension.username}</userName> <password>${datahub.extension.password}</password> <exportCodes> </exportCodes> <targetItems> <item> <type>TargetCustomProduct</type> <exportCode>Product</exportCode> <description>Hybris Platform representation of Product</description> <updatable>true</updatable> <canonicalItemSource>CanonicalCustomProduct</canonicalItemSource> <status>ACTIVE</status> <attributes> <attribute> <name>identifier</name> <localizable>false</localizable> <collection>false</collection> <transformationExpression>productId</transformationExpression> <exportCode>code[unique=true]</exportCode> <mandatoryInHeader>true</mandatoryInHeader> </attribute> </attributes> </item> </targetItems> </targetSystem> </targetSystems> </extension>


Step 6: Run command mvn clean install

Step 7: Now go to the

<YOURPATH>datahub6.2archetypecustomproductcustomproduct-canonical arget

Step 8: Copy above highlighted jar file to the below path folder


Same procedure will be followed for raw and target also

Step 9: Go to the path <YOURPATH>datahub6.2archetypecustomproductcustomproduct-raw arget

Copy the jar file into crm folder

Step 10: Go to the path <YOURPATH>datahub6.2archetypecustomproductcustomproduct-target arget

Copy the jar file into crm folder

Note: If any changes are done in customproduct – raw, canonical, target  Step 5 to Step 10 should be followed and restart the Tomcat server.

Step 11: Now go to chrome via

Step 12: Click on launch the app button

Step 13: Open Postman App and add the header details as below

Headers : Content-Type – application/xml

URL: http://localhost:8080/datahub-webapp/v1/idoc/receiver


Step 14: Go to Body-> raw -> add the IDoc and click on send button

  • We will get a response as 200 which means the process is a success.

Step 15: Now go to mysql workbench and check the “rawitem” table data.



Data composition means the transfer of data from raw items to canonical items.

Step 16: Post the

URL:  http://localhost:8080/datahub-webapp/v1/pools/GLOBAL/compositions

as shown in below

Step 17: Now go to MySQL workbench and check the “canonicalitem” table data.


Data publication means the transfer of data from canonical items to target items.

Step 18: Post the URL below


Step 19: Now go to MySQL workbench and check the “targetitem” table data.


Step 20: Start the hybris server with recipe “sap_aom_som_b2b_b2c”.

If we don’t get datahubadapter in the xml file in config .Then add it manually

“<extension name=”datahubadapter” />”

Step 21: Go to hmc,catalog->products enter the product id and click on search.

  • Product which is sent via IDoc can be viewed in hmc.

Thanks for reading 🙂


New NetWeaver Information at

Very Helpfull

User Rating: Be the first one !