In this article, I’ll demonstrate how to call an Oracle SaaS ESS Job using Oracle Integration and receive the callback using a business event.

Prerequisites

  1. Oracle SaaS Instance 
  2. ESS Job in SaaS Instance ( refer to my previous blog to know how to create ESS Job)
  3. Oracle Integration Cloud Instance 
  4. ERP Adapter Connection

To call the ESS Job and receive a callback in Oracle Integration we’ll create two separate integrations as described in the next section.

Integrations Required

  1. Schedule-based Integration: This Integration uses an ERP adapter to invoke the ESS Job using export bulk data operation.
  2. App Driven Integration: This Integration uses an ERP adapter as a trigger and receives the callback using ERP Integration Outbound Business Event.

Schedule based Integration

Following are the steps to create the scheduled based integration which will trigger the Oracle SaaS ESS job:

  1. Create a new integration by selecting the Schedule Orchestration pattern.
  2. In this integration, we will be calling the ESS Job which was already created in Oracle SaaS.
  3. Select the ERP connection and select the Query, Create, Update or Delete Information from the Actions screen as shown below screenshot:
  1. From the Operations screen, select Services in Browse by option, select the ErpIntegrationService from the Select a Service option, and exportBuldData from the Select the Operation to Perform on the Business Service option as shown in the following screenshot, and finish the adapter wizard:
  1. In the mapper of the ERP connection, pass the following detail:
    • Job Name: Comma-separated value of ESS Job Path and Ess Job Name: For example: /oracle/apps/ess/custom/test,TEST_ESS_JOB
    • Parameter List: This is required only if ESS Job has parameters, else leave it as it is. In our case there is no parameter hence no mapping is required.
    • Job Option: To receive a callback event we need to pass “EnableEvent=Y”
    • Notification: Hardcode value as 30. ( where 3 indicates Email & Bell Notifiaction and 0 indicates Send in any case)
  1. After completing all the steps, the integration will look like as shown in the below screenshot. Once developed activate the integration.

App Driven Integration

The app-driven integration will be developed to receive the callback once the ESS job is completed in the Oracle SaaS. Following are the steps to create the callback integration:

  1. Create a new integration by selecting App Driven pattern.
  2. Select ERP Adapter as trigger connection and on the request, page select Receive Business Events raised within ERP Cloud in Define the purpose of this trigger and select ERP Integration Outbound event in Business Event For Subscription
  1. On the Response page, select None in Response Type

After the ESS Job is completed in Oracle SaaS, a zip containing logs, XML output, and report output will be placed in UCM. To download the zip file we need to use an ERP adapter and pass the document id received as part of the callback event. You can place this zip file at any FTP location, send it over email, etc. Now for this use case, I’m sending this file over email.

  1. Select the ERP connection and select the Query, Create, Update or Delete Information from the Actions screen as shown below screenshot:
  1. From the Operations screen, Select Services in Browse by option, select the ErpIntegrationService from the Select a Service option, and getDocumentForDocumentDId from the Select the Operation to Perform on the Business Service option as shown in the following screenshot, and finish the adapter wizard:
  1. In the mapper for the adapter map the DOCUMENTID as shown in the below screenshot
  1. The response from the above ERP adapter will be base64, so let’s write to the stage file using the opaque scheme
  1. Below is the opaque schema file code:
<?xml version='1.0' encoding='UTF-8'?>
<schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/opaque/" xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="opaqueElement" type="base64Binary"/>
</schema>
  1. To send the file as an email attachment, select notification activity, and in the attachment, section attaches the file reference of the stage write a response.
  1. Once all the steps are completed, the integration will look like the below as shown screenshot. Once developed activate the integration.

Testing the Integrations

  1. Make sure both the integrations developed in the previous two sections are active.
  2. Submit the Scheduled based integration which will invoke the ESS job in Oracle SaaS
  3. Login into the Oracle SaaS and see the job should be kicked off as shown in the below screenshot:
  1. Once the ESS job completes the execution, SaaS will raise a business event and it will be captured by App driven Integration.
  2. App Driven will start automatically as shown in the below screenshot
  1. App Driven Integration will receive a message as shown in the following XML file which contains execution details.
<ns01:onEvent xmlns:ns01="http://xmlns.oracle.com/cloud/adapter/erp/Callback_REQUEST/types">
	<ns0:ErpExportBulkDataEvent xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared">
		<ns0:SUMMARYSTATUS>SUCCEEDED</ns0:SUMMARYSTATUS>
		<ns0:DOCUMENTID>124556</ns0:DOCUMENTID>
		<ns0:JOBS>
			<ns0:JOBPATH>/oracle/apps/ess/custom/testess</ns0:JOBPATH>
			<ns0:REQUESTID>124555</ns0:REQUESTID>
			<ns0:JOBNAME>Test Ess Job</ns0:JOBNAME>
			<ns0:STATUS>SUCCEEDED</ns0:STATUS>
		</ns0:JOBS>
		<ns0:JOBS>
			<ns0:JOBPATH>/oracle/apps/ess/financials/commonModules/shared/common/interfaceLoader</ns0:JOBPATH>
			<ns0:REQUESTID>124556</ns0:REQUESTID>
			<ns0:JOBNAME>Upload Interface Error and Job Output File to Universal Content Management</ns0:JOBNAME>
			<ns0:STATUS>SUCCEEDED</ns0:STATUS>
		</ns0:JOBS>
	</ns0:ErpExportBulkDataEvent>
</ns01:onEvent>
  1. An email will be sent with an attachment as shown below to the email address provided in the notification activity
  1. The zip file will contain the below files as shown in the screenshot

Further Readings

How to create a BIP report in Oracle SaaS

How to create and test custom ESS job in Oracle SaaS

Merging two CSV files into a single file in Oracle Integration

ERP Integration using File Based Data Import: Oracle Integration

Import Suppliers using FBDI in Oracle Integration