How to Implement an ERP Integration in Calem
In the coming release of R21a, the Calem API has been extended to support the implementation of ERP (Enterprise Resource Planning solution) integration. Inventory integration is used as an example in this blog. Here is the data flow of the integration.
|Calem to ERP||Requisitions for spare parts created, and approved in Calem.|
|ERP to Calem||Purchase Orders (POs) created, and approved in ERP|
|Calem to ERP||Transactions of Parts/services received against POs. |
|Calem to ERP||Other inventory transactions: a) checkout of parts/services to work orders; b) return parts/services to vendors; c) return of unused parts checked out; c) physical count of parts; d) off-site repairs and receipts; and e) on-site repairs and receipts.|
1. Calem to ERP
Events and listeners are used to send requisitions and transactions to ERP. The standard event generator will generate an event with data from a single record. A custom event generator is used in this example to generate both REQ and its line items, and also to format the JSON data fields based on requirements.
- Edit-events are configured for Requisition and Inventory Transactions.
- Custom event generators are implemented based on ERP integration requirements:
- REQ event generator: REQ header and items are generated as a JSON object.
- Inventory transaction generator: Inventory transaction are generated as a JSON object.
- A custom event notifier may be provided if the ERP does not support the standard Calem notifier.
- The notifier performs the REST API invocation to the ERP web service.
1.1 REQ Data Change Event
A data change event is generated when an object is edited. We will go through the example for REQ. The setup process is similar for inventory transactions ("cm_in_tran" table).
- Menu path: Admin | Open | Data Change Events
- Create an event for REQ (cm_req) object.
- Set a custom event generator (CmErpReqEventGen)
- The standard event generator only generates the data from REQ header object. The custom generator will generate the REQ event data including both REQ header and items.
- The custom event generator is developed and deployed in Calem. See API Guide for more information about custom event generator setup.
- Calem Integration Team is responsible for developing custom event generators.
- We use "erp" in this blog for demo purpose. You may replace "erp" by your ERP solution name to be more specific. For instance, if your ERP solution is "kc", the custom event generator may be named as CmKcReqEventGen.
- Check "Track Selected" and add "Status" field to the "Field" tab so that the event should only be evaluated by the custom generator when a status field is changed. The custom generator can further evaluate the status values and will only generate a data event if a REQ is changed to "Approved" status.
1.2 Event Listener
The event listener defines the end point of the web service of ERP application.
- Menu path: Admin | Open | Data Change Listeners
- Create a listener for the ERP application
- The listener needs to be developed and deployed at the ERP application. It accepts REST API invocation from Calem.
- The client key and secret of the listener are provided by the ERP integration team.
- Events to be dispatched to this listener are added to the list of "Listener Mapping" below.
- The REQ events are dispatched to this "Listener Mapping".
- A custom notifier may be used to dispatch events to the ERP listener.
- A custom notifier can provide features not available in the standard notifier. For instance, the API authentication is defined in Calem API Guide. If a different authentication method is required by ERP listener, Calem integration Team may develop a custom notifier to implement it.
2. ERP to Calem
The PO data is sent to Calem via standard Calem REST API.
- The Calem REST API allows a third party to search, create, update and delete records in a table.
- A custom handler will be needed in our example in order to handle both a PO header and its line items in one API invocation.
- The custom handler will be developed by Calem Integration Team.
- The ERP will invoke the custom handler in a "POST" operation to create a PO. The API call includes a JSON data payload of PO header and its line items.
- A virtual table such as "cm_erp_po" will be used as table for PO creation. You may replace the "erp" with your ERP solution name so it's intuitive. For instance, your ERP solution is "kc", the PO virtual table will be "cm_kc_po" for "POST" operation.
- See Calem API Guide for more information for the setup of a custom handler.