Bidirectionally synchronize product data between Salesforce and SAP. Configure this template quickly by modifying the fields to be synchronized, how they map, and criteria on when to trigger the synchronization. This template is initiated via an IDoc message from SAP and polling on SFDC side (which can be easily switched to receive outbound messages to reduce API calls). This template leverages watermarking functionality to ensure that only the most recent items are synchronized and uses batch to effectively process many records at a time, if you choose not to process all the records one at a time.
This template is subject to the conditions of the MuleSoft License Agreement. Review the terms of the license before downloading and using this template. You can use this template for free with the Mule Enterprise Edition, CloudHub, or as a trial in Anypoint Studio.
This template provides an online bidirectional synchronization of products or materials between Salesforce and SAP. Every time there is a new product or material or a change in an existing one in Salesforce or a SAP instance, the template fetches it and sends it as an IDoc to SAP or Salesforce respectively to update product and material there.
Requirements have been set not only to be used as examples, but also to establish a starting point to adapt the integration to your requirements.
This template leverages the Mule batch module. The batch job is divided in Process and On Complete stages.
The integration is triggered by polling one of Salesforce products or SAP materials. New or modified products and materials are passed to the batch process as input. In the batch, the material and product is fetched from SAP by material number or from Salesforce by its product code.
Afterwards every such product and material is sent to destination instance - to Salesforce with Upsert or to SAP in form of iDoc XML where it is asynchronously updated or created.
To make this template run, there are certain preconditions that must be considered. All of them deal with the preparations in SAP, that must be made for the template to run smoothly. Failing to do so can lead to unexpected behavior of the template.
Before continuing with the use of this template, see the SAP connector guide, that teaches you how to work with SAP and Anypoint Studio.
This template uses a few private Maven dependencies from MuleSoft to work. If you intend to run this template with Maven support, you need to add three extra dependencies for SAP to the pom.xml file.
Here's what you need to know to get this template to work with SAP.
The SAP backend system is used as a source of data. The SAP connector is used to send and receive the data from the SAP backend. The connector can either use RFC calls of BAPI functions and/or IDoc messages for data exchange, and needs to be properly customized per the "Properties to Configure" section.
This template uses the custom BAPI function. To create, use these steps:
SE11as per its definition in file
SE11as per its definition in file
SE91as per definition in file
SE37as per source file
Referenced files are in src/main/resources directory.
If the user who configured the template for the source system does not have at least read only permissions for the fields that are fetched, then an InvalidFieldFault API fault displays.
java.lang.RuntimeException: [InvalidFieldFault [ApiQueryFault [ApiFault exceptionCode='INVALID_FIELD' exceptionMessage='Account.Phone, Account.Rating, Account.RecordTypeId, Account.ShippingCity ^ ERROR at Row:1:Column:486 No such column 'RecordTypeId' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Reference your WSDL or the describe call for the appropriate names.' ] row='1' column='486' ] ]
There are no considerations with using Salesforce as a data destination.
Simple steps to get this template running.
In this section we help you run this template on your computer.
If you are new to Mule, download this software:
Note: Anypoint Studio requires JDK 8.
In Studio, click the Exchange X icon in the upper left of the taskbar, log in with your Anypoint Platform credentials, search for the template, and click Open.
After you import your template into Anypoint Studio, follow these steps to run it:
mule.dev.properties, in src/main/resources.
Mule Application (configure).
mule.envto the value
Run. For this template to run in Anypoint Studio, you need to install SAP libraries. See Install SAP Libraries.
Update the properties in one of the property files, for example in mule.prod.properties, and run your app with a corresponding environment variable. In this example, use
When creating your application in CloudHub, go to Runtime Manager > Manage Application > Properties to set the environment variables listed in "Properties to Configure" as well as the mule.env value.
In Studio, right click your project name in Package Explorer and select Anypoint Platform > Deploy on CloudHub.
To use this template, configure properties such as credentials, configurations, etc.) in the properties file or in CloudHub from Runtime Manager > Manage Application > Properties. The sections that follow list example values.
SalesForce Connector Configuration
Note: To find out the correct sfdc.integration.user.id value, refer to the example project Salesforce Data Retrieval in Anypoint Exchange.
SAP Connector Configuration
SAP Material Properties Configuration
Salesforce imposes limits on the number of API calls that can be made. Therefore calculating this amount may be an important factor to consider. The template calls to the API can be calculated using the formula:
For instance if 10 records are fetched from an origin instance, then 12 API calls are made (1 + 10 + 1).
This brief guide provides a high level understanding of how this template is built and how you can change it according to your needs. As Mule applications are based on XML files, this page describes the XML files used with this template. More files are available such as test classes and Mule application files, but to keep it simple, we focus on these XML files:
This file provides the configuration for connectors and configuration properties. Only change this file to make core changes to the connector processing logic. Otherwise, all parameters that can be modified should instead be in a properties file, which is the recommended place to make changes.
The business logic XML file creates or updates objects in the destination system for a represented use case. You can customize and extend the logic of this template in this XML file to more meet your needs.
This file contains the endpoints for triggering the template and for retrieving the objects that meet the defined criteria in a query. You can execute a batch job process with the query results.
This file handles how your integration reacts depending on the different exceptions. This file provides error handling that is referenced by the main flow in the business logic.
|Published on||Nov 14, 2018|