SAP C4C

To integrate SAP Hybris C4C with Pricefx, we use two approaches:

In this section:

Set up SAP Environment

First you need to create accounts for accessing OData API and Web Service API. For details see SAP C4C - Accounts Data Integration.

Create WebService API Account

For details see Authorization.

Common SAP Integration Configuration

pfx.url=pricefx_url pfx.partition=pricefx_partition pfx.username=pricefx_user pfx.password=pricefx_password

Configure Fetching Products and Customers

application.properties
integration.sap.productsRefreshAfter=3600000 integration.sap.oDataServiceUri=https://myNNNNNN.crm.ondemand.com/sap/byd/odata/v1/c4codata/ integration.sap.rest.username=sap_rest_username integration.sap.rest.password=sap_rest_password integration.sap.ws.username=sap_ws_username integration.sap.ws.password=sap_ws_password

 

camel-context.xml - Products
<pfx:loadMapper id="sapProductMapper"> <pfx:body in="ID" out="sku"/> <pfx:body in="Description" out="label"/> <pfx:body in="UnitOfMeasureCode" out="unitOfMeasure"/> </pfx:loadMapper> <camelContext xmlns="http://camel.apache.org/schema/spring" useMDCLogging="true"> <route> <from uri="timer://foo?repeatCount=1"/> <to uri="pfx-c4c?method=fetchProducts&username={{integration.sap.rest.username}}&password={{integration.sap.rest.password}}&url={{integration.sap.url}}/sap/byd/odata/v1/c4codata/&batchedMode=true"/> <log message="body: ${body}" /> <split> <simple>${body}</simple> <to uri="pfx-c4c?method=fetchProducts&username={{integration.sap.rest.username}}&password={{integration.sap.rest.password}}&url={{integration.sap.url}}/sap/byd/odata/v1/c4codata/"/> <log message="body: ${body}" /> <to uri="pfx-api?method=loaddata&objectType=C&mapper=sapProductMapper"/> </split> </route> </camelContext>

 

camel-context.xml - Customers

Delta Synchronization of Products and Customers

Add the &deltaSync=true parameter to the fetch URI. The parameter must be added to both the batchedMode parent and the split section of the route definition.

 

Full-synchronization (no delta) routes can be configured as well. The system stores the date and time of last synchronizations in Pricefx Advanced Configuration Options.

Configure Price Lists Syncing

application.properties

 

Handle Exceptions

The pfx-c4c updatePriceList can throw three types of exceptions:

  • net.pricefx.integration.component.c4c.PfxC4CException
    Occurs when a business error from SAP C4C is received as a response to the request call. For example, a price list with the same validity already exists, a product with a particular ID does not exist, etc. PfxC4CException.getExceptionLog() gets the SAP C4C error log message.

  • org.apache.camel.CamelExecutionException
    This exception is thrown for technical issues.

  • java.lang.Exception or other exception

IntegrationManager version 5.8.0