Wednesday, January 17, 2024

OIC - ERP - create an integration to send outbound ERP File using BI bursting FTP delivery channel and ESS job | How to create an erp Outbound flow in Oracle Integration

Usecase: Here, we will see outbound integration which will process ERP outbound files using BI bursting FTP delivery channel and ESS job. 

Steps involved:

  1. Create an Integration (app driven or schedule based on requirement) and feed following inputs:
    1. essJobName : containes ess job package, jobdefinitionName and appended name value parameters with a ";". 
    2. fileName
    3. reportPath: BI report absolute path
  2. Fetch name and value parameters into a stage csv file which will be used while submitting ess job request. Follow below blog to know how to get the name and value parameters. (https://soalicious.blogspot.com/2021/05/oic-params.html)
  3. Submit ESS job with this fetched value parameters> call BI Bursting with FTP Delivery channel (https://soalicious.blogspot.com/2024/01/oic-erp-submit-ess-job-sending-multiple.html)
  4. Check getESSjobStatus(https://soalicious.blogspot.com/2021/07/oic-get-ess-job-status.html)
  5. If ESSJobStatus not Succeeded then
    1. Call BI report: in a loop and retry:  (https://soalicious.blogspot.com/2022/03/oic-how-to-call-and-read-bi-publisher.html)
      1. While condition: $p_decodeFileRef ='NULL' and $retryCounter <5.0
      2. Call BI report with ExternalReportWSSServive.
      3. Update file ref:
        1. p_decodeFileRef: decodeBase64ToReference(reportBytes)
      4. UPdate retry count  retryCounter = $retryCounter + 1.0
    2. Read File : take a stage and read entire file where specify file ref : $p_decodeFileRef and provide a sample csv file (C1 field)
    3. Take row counts : take a for each loop and count rows using repeating elements and rowCounter.
    4. Check row counts
      1. If rowcount >=2.0 then throw new fault as ess job failure
      2. Else, call another child integration to have the blank file and process. https://soalicious.blogspot.com/2024/02/oic-erp-create-reusable-outbound.html
      3. Monitor the child integration process status. Follow my below blog to call and monitor scheduled integration.(https://soalicious.blogspot.com/2024/01/oic-run-schedule-integration-now-from.html)
We are calling ess job to invoke to BI report to do ftp bursting for a reason. We are doing it to fetch delta data(daily data).

Tuesday, January 16, 2024

OIC - ERP - Monitor Progress of ESS job and return status | Reusable component to monitor the ESS job run status

Usecase: we will create reusable integration which will take the ESS job run request id as input and monitor the ESS job status and return back the status as response to the caller integration.

Detailed logic steps:

  1. Create an app driven rest trigger integration with
    1. Input: ESSJOBRequestID as template param and queryCount as Query param.
    2. Output: returnStatus
  2. SetRequestVariables
    1. requestStatus = ""
    2. loopCounter = 0.0
    3. inProgress = "true"
    4. MaxLoopCount = $queryCount
  3. Take a while loop with condition $I_inProgress = "true"
    1. Configure ERP cloud adapter and call erpIntegrationService and operation: getESSJobStatus
    2. Update loop counter and status
      1. loopCounter = $loopCounter +1
      2. requestStatus = result
      3. inProgress = returnStatusV2(result)
    3. Take a switch
      1. If loopCounter = maxLoopCount then Exit loop with below updates
        1. inProgress = "false"
        2. requestStatus = "Error, exceeded max wait time."
  4. Update request status

Response rest json:

{

"returnStatus": "",

"exceptionCode":"",

"exceptionReason":"",

"exceptionDetails":""

}

Detailed steps with Screenshots:




















Friday, January 12, 2024

ERP - Create a RTF file based on data model xml file

Usecase: We will see how to create a RTF template based on exported datamodel xml file.

Detailed steps:

Step1: Install BI publisher Desktop softwate so that we can create RTF file on MS word.

https://soalicious.blogspot.com/2022/03/erp-bi-publisher-installation-and.html

Step2: export xml file from data model and import to MS word as sample xml.




Step3: under BI publisher tab, insert the table rows and columns required and uaing field section, we can drag and drop field names to the table.


Step4: using repeating Group, we can add G_1 and G_2 repeating groups







Once RTF template ready > clik on format like pdf or xml etc to preview and save it .rtf.


See the data is showing as required





OIC ERP - Send custom Invoice report using Ess Job call and BI bursting report

Usecase: Instead of directly send the custom invoice report using Notification activity, we can also alternatively call ess job and do BI report bursting and send the email notification.

Highlevel steps:
  1. Create Data models
  2. Add BI bursting with email delivery channel.
  3. Create RTF template using msword BI publisher plugin.
  4. Upload the RTF template and create BI report
  5. Create ESS job and call the BI report as reporting id.
  6. From integration, call the submitESSJobRequest of erp cloud adpater erpIntegrationService with load id and source name as input feeds.
Detailed steps:

Step1: Create Data Model:

Invoice Callback Custom BI report SQL query:

WITH details AS

(Select 'Source: AP : ' || (select DISTINCT aii1.source FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id) AS source_name,

'Total number of invoices received: ' || (select TO_CHAR(COUNT(invoice_id)) AS invoice_id FROM ap_invoices_interface aii1 WHERE aii1.load_request_id =  :p_load_request_id) AS count_rcv,

'Total dollar amount of invoices received: '|| (select NVL(SUM(invoice_amount),0) AS invoice_amnt FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id) AS amount_rcv,

'Total number of invoices loaded from staging table: ' || (select COUNT(invoice_id) FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id and aii1.status = 'PROCESSED') AS count_loaded,

'Total dollar amount of invoices loaded from staging table: '|| (select NVL(SUM(invoice_amount),0) FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id and aii1.status = 'PROCESSED') AS amount_loaded,

'Total number of invoices not loaded from staging table: ' || (select COUNT(invoice_id)  FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id and NVL(aii1.status,'REJECTED')= 'REJECTED') AS count_ignored,

'Total dollar amount of invoices not loaded from staging table: '|| (select NVL(SUM(invoice_amount),0)  FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id and NVL(aii1.status,'REJECTED')= 'REJECTED') AS amount_ignored,

'Total number of errored invoices: ' || (select COUNT(invoice_id) FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id and aii1.status= 'REJECTED') AS count_rejected,

'Total dollar amount of errored invoices: '|| (select NVL(SUM(invoice_amount),0) FROM ap_invoices_interface aii1 WHERE aii1.load_request_id = :p_load_request_id and aii1.status = 'REJECTED') AS amount_rejected,

'00121' KEY

From DUAL

Where (select distinct aii1.source from ap_invoices_interface aii1 where aii1.load_request_id = :p_load_request_id and aii1.source = :p_source) is not null

 )

Invoice error details SQL query:

Select Distinct aii.invoice_num, aii.invoice_date,aii.vendor_num,aii.invoice_amount,'00121' KEY from ap_invoices_interface aii where aii.load_request_id = :p_load_request_id and aii.source= :p_source and aii.status = ' REJECTED'






Step2 : create email bursting

Bursting query used:
Select
'00121' as "KEY",
'Template' TEMPLATE,
'en-US' LOCALE,
'XLSX' OUTPUT_FORMAT,
'CONTROL_REPORT' || to_char(SYSDATE, 'yyyymmdd') OUTPUT_NAME,
'EMAIL' DEL_CHANNEL,
'ReceiverEmail@gmail.com' PARAMETER1,
NULL PARAMETER2,
'SenderEmail' PARAMETER3,
'Import Invoice Control Report for Source : '|| :p_source || to_char(SYSDATE,'yyyymmdd') PARAMETER4,
'Please find attached Control Report' PARAMETER5,
'true" PARAMETER6,
NULL PARAMETER7
FROM DUAL



Step3: Create RTF template:


Step4: Create BI report.





Step5: create ESS job which will invoke this BI report.

Go to Home > My enterprise > Setup and Maintenance search with Manage Enterprise Schedule > click on Manage Enterprise Schuduler Job Definitions and job sets for financial, suppy chain management and related applicarions > click on create (+) button 

Provide BI report absolute path to reporting id.


We can test/schedule the created ESS job from tools > Scheduled Processes > schedule new process

Search with ESS job name and provide required input feeds and submit.




Step6: From integration, call the submitessjob of erp cloud adpater erpIntegrationService with load id and source name as input feeds.

Jobdifinition: "Test_AP_Email_CTRL_ESS1"
JobPackageName: "oracle/apps/ess/custom/ess"










Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...