[OIC] Automating AP Invoice Attachment Downloads: Oracle Fusion, BIP, and OIC

 



Extracting invoice attachments in bulk is a common requirement for auditing and archival. This post details how to automate this using Business Intelligence Publisher (BIP) to identify documents and the Universal Content Management (UCM) SOAP API to retrieve them within Oracle Integration Cloud (OIC).


Step 1: Create a BIP Report for Attachment Metadata
Before downloading, you need the unique identifiers for the files stored in Oracle's UCM.
Below is the query which you can use to get the attachment details:

select /*+ parallel(aia) parallel(fad) parallel(fd) parallel(fdt) */
     aia.invoice_id                             PK1_VALUE
    ,aia.invoice_num                            PK2_VALUE
    ,fad.entity_name                            ENTITY_NAME
    ,fd.document_id                             DOCUMENT_ID
    ,fdt.description                            DESCRIPTION
    ,fdt.title                                  TITLE
    ,fdt.dm_version_number                      DM_VERSION_NUMBER
    ,fdt.dm_document_id                         DM_DOCUMENT_ID
    ,fdt.dm_repository                          DM_REPOSITORY
    ,fdt.file_name                              FILE_NAME
    ,fdt.dm_type                                DM_TYPE
    ,fdt.object_size                            OBJECT_SIZE
    ,fdt.object_content_type                    OBJECT_CONTENT_TYPE
    ,to_char(aia.invoice_date,'MM-dd-yyyy')     INVOICE_DATE
from
     ap_invoices_all aia
    ,fnd_attached_documents fad
    ,fnd_documents fd
    ,fnd_documents_tl fdt
where 1=1
--and aia.invoice_num='CHM_MSI_1782_9000081'
and aia.invoice_id          = fad.pk1_value
and fad.entity_name         ='AP_INVOICES_ALL'
and fad.document_id         = fd.document_id
and fd.document_id          = fdt.document_id
and fdt.object_content_type ='application/pdf'
and invoice_date between :P_FROM_DATE and :P_TO_DATE

Sample Output:


  • Now, you can create an OIC Integration which will first run this report and get the data of invoice attachments. Then insert this data in ATP table:



  • Loop over these records and then use the Oracle ERP Adapter


  • Then use the ERP Cloud Adapter follow these steps:
    • Select the Query, Create, Update or Delete Information
    • Select Browse By as Services
    • Select the Service ErpIntegrationService
    • Select operation as getDocumentForDocumentId
    • Map DM VERSION NUMBER to the Document Id


  • Once document is downloaded we will decode it (as the content will be in base64). We will be using Stage write activity with content structure type using XML Schema (XSD) document using opaque schema.
  • Below is the opaque_schema.xsd file:
<?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>



  • Map the Content element to opaque element in mapper



  • After writing the stage file you can use it like sending as an attachment using the notification activity





    Comments

    All Categories

    Call Fusion BIP Report2 Change Password1 Code Combinations2 Compute Instance2 CTE1 Customer1 Data Aggregation2 Database5 Date Conversion1 DB Adapter2 Decryption1 Development1 EBS4 Encryption1 ESS Jobs3 Examine1 FBDI3 Fusion APIs1 Fusion BIP7 GIT2 GL3 GL Journals1 GL_DAILY_CONVERSION_TYPES1 GL_DAILY_RATES1 ICS1 Identity Domain1 Integrations1 Java1 Journal Import1 Keys1 Legal Entity1 LookupTypeLOV1 LOV1 LOVs1 MultiPartAPIs1 Networking1 NVL2 NVL in OIC2 OCI11 OCI Billing1 OCI Compute5 OCI Cost Management1 OCI Events Service1 OCI Free Tier3 OCI Notifification Service1 OCI Security3 OIC4 OIC Mapper2 Oracle26 Oracle ADF17 Oracle APEX1 Oracle Apps59 Oracle Apps R126 Oracle ATP1 Oracle BIP8 Oracle Cloud12 Oracle Cloud Free Tier1 Oracle cloud Infrastructure9 Oracle Cloud Security2 Oracle Cloud VM1 Oracle DB4 oracle ebs5 Oracle ERP4 Oracle ERP Adapter2 Oracle ERP Cloud7 Oracle financials2 Oracle Forms1 Oracle Fusion57 Oracle Fusion BIP4 Oracle Fusion ERP17 Oracle Fusion Financials18 Oracle Integration Cloud3 Oracle OAF17 Oracle OCI14 Oracle OIC22 Oracle SOA 12c10 Oracle SQL17 Oracle VBCS1 Oracle VBS2 Oracle Visual Builder Cloud Service1 Oracle Visual Builder Studio2 Oracle Workflow Notifications1 Others10 Payables2 Payables Import1 Properties1 R121 Register BIP as ESS Job1 Reset Password1 Responsibility1 REST4 Security List1 Site Map1 SOAP2 SOAP API2 SOAP UI3 SQL16 SQL Functions3 SQL Queries14 SQL Query8 SQL Tips3 SSH1 TCA1 Value Sets1 VBCS1 Virtual Machine2 Virtual Machines1 XML1 XSLT1
    Show more