Enter your keyword

post

Automate ERP Purchase Order creation using Oracle Integration

Most of the organizations are using Oracle Enterprise Resource Planning system for day to day business. It’s a business process management software that manages and integrates a company’s financials, supply chain, operations, reporting, manufacturing, and human resource activities. In this article, we are focusing on how to automate ERP Purchase Order creation using Oracle Integration Cloud (OIC).

In this article, we’ll use the OIC ERP adapter to connect to ERP.

See the previous articles.

ERP Adapter in Oracle Integration Cloud

ERP Integration using File Based Data Import: Oracle Integration

Subscribe Oracle ERP Business Events in Oracle Integration

Watch YouTube videos for more learning. Subscribe my YouTube Channel to get the latest videos.

Below is the use-case which we are going to execute in the article:

  • Expose a single REST APIs to create a purchase order and to get purchase order details.
  • User Oracle ERP adapter and call Create Purchase Order and Get Purchase Order Service.

Step by Step procedure to achieve the use-case

  • Create an App Driven Orchestration with name “PurchaseOrderService
  • On the Integration Canvas, drop the REST connection as a trigger point. Enter the below information and click on the Next button
    • What do you want to call your endpoint? PurchaseOrderService
    • Check the Select to configure multiple resources or verbs checkbox
  • From the next screen, enter the below information and click on the Next button.
FieldValue
Provide an operation nameCreatePrucahseOrder
What does this operation do? This operation will be used to CreatePurchaseOrder
What is the relative endpoint’s relative resource URI? /purhcaseorder
What action do you want to perform on the endpoint?POST
Configure a request payload for this endpointSelect this checkbox
Configure this endpoint to receive the responseSelect this checkbox
  • On the Request screen, Select JSON sample from select the request payload format and select <<<inline>>> link to enter below sample JSON. Click on the Next button

Note: I have taken only mandatory fields which are required for purchase order creation.

{
  "PurchaseOrder" : {
    "createPurchaseOrder" : {
      "createOrderEntry" : {
        "DocumentStyleId" : "1",
        "ProcurementBUId" : "22",
        "RequisitioningBUId" : "22",
        "BuyerId" : "11",
        "SupplierId" : "32",
        "SupplierSiteId" : "11",
        "DocumentDescription" : "Document",
        "PurchaseOrderEntryLine" : {
          "LineTypeId" : "1",
          "ItemDescription" : "Line Description",
          "CategoryId" : "1",
          "Price" : "400",
          "PurchaseOrderEntrySchedule" : {
            "NeedByDate" : "2020-01-02",
            "ShipToLocationId" : "11",
            "ShipToOrganizationId" : "11",
            "PurchaseOrderEntryDistribution" : {
              "RequesterId" : "11",
              "RequesterName" : "Test"
            }
          }
        }
      }
    }
  }
}
  • On the Response screen, Select JSON sample from select the request payload format and select <<<inline>>> link to enter below sample JSON. Click on the Next button
{
  "PurchaseOrderNumber" : "1"
}
  • From the next screen, Check Add another operation and click on the Next button.
  • On the Resource Configuration page enters below values and click on the Next button.
FieldValue
Provide an operation nameGetPurchaseOrder
What is the relative endpoint’s relative resource URI?/purchaseorder
What action do you want to perform on the endpoint?GET
Add and review parameter for this endpointSelect this checkbox
Configure this endpoint to receive the response Select this checkbox
  • On the Request Parameters page, add two string parameters and click on the Next button.
    • PurchaseOrderNumber
    • SoldToLegalEntity
  • On the Response screen, Select JSON sample from select the request payload format and select <<<inline>>> link to enter below sample JSON. Click on the Next button
{
  "POHeaderId" : 11,
  "OrderNumber" : "11",
  "SoldToLegalEntityId" : 22,
  "SoldToLegalEntity" : "Legal Entity",
  "CreationDate" : "2014-12-09T08:17:56+00:00",
  "StatusCode" : "CLOSED"
}
  • Finish the REST Wizard.
  • In the CreatePurchaseOrder operation, drop the ERP adapter, enter “CreatePO” as an endpoint name and click on the Next button.
  • From the next screen, select “Query, Create, Update or Delete Information” checkbox and click on the Next button.
  • From the next screen, select below options and Finish the wizard.
OptionValue
Browe bySelect “Services”
Select a ServiceSelect a “PurchaseOrderService”
Select the operation to perform on the Business Object/Resource or ServiceSelect “createPurchaseOrder”
  • Edit the CreatePO mapper and do the mapping as below:
SourceTarget
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:ProcurementBUId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/tns:ProcurementBUId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:RequisitioningBUId/nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/tns:RequisitioningBUId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:BuyerId/nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/tns:BuyerId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:SupplierId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/tns:SupplierId


/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:SupplierSiteId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/tns:SupplierSiteId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:DocumentDescription /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/tns:DocumentDescription
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:LineTypeId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/tns:LineTypeId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:ItemDescription /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/tns:ItemDescription
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:CategoryId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/tns:CategoryId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:Price /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/tns:Price
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:PurchaseOrderEntrySchedule/nssrcdfl:ShipToLocationId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/
tns:PurchaseOrderEntrySchedule/tns:ShipToLocationId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:PurchaseOrderEntrySchedule/nssrcdfl:ShipToOrganizationId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/
tns:PurchaseOrderEntrySchedule/tns:ShipToOrganizationId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:PurchaseOrderEntrySchedule/nssrcdfl:NeedByDate /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/
tns:PurchaseOrderEntrySchedule/tns:NeedByDate
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:PurchaseOrderEntrySchedule/nssrcdfl:PurchaseOrderEntryDistribution/nssrcdfl:RequesterId /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/
tns:PurchaseOrderEntrySchedule/
tns:PurchaseOrderEntryDistribution/tns:RequesterId
/nssrcmpr:execute/nssrcdfl:requestwrapper/nssrcdfl:PurchaseOrder/nssrcdfl:createPurchaseOrder/nssrcdfl:createOrderEntry/nssrcdfl:PurchaseOrderEntryLine/nssrcdfl:PurchaseOrderEntrySchedule/nssrcdfl:PurchaseOrderEntryDistribution/nssrcdfl:RequesterName /nstrgmpr:createPurchaseOrder/
nstrgmpr:createOrderEntry/
tns:PurchaseOrderEntryLine/
tns:PurchaseOrderEntrySchedule/
tns:PurchaseOrderEntryDistribution/tns:RequesterName
  • Validate and Close the mapper. Drop the mapper after ERP adapter and do mapping as below:
SoruceTarget
$CreatePO/nsmpr0:createPurchaseOrderResponse/nsmpr0:result/tns:OrderNumber /nstrgmpr:executeResponse/
nstrgdfl:response-wrapper/nstrgdfl:PurchaseOrderNumber
  • In the GetPurchaseOrder operation, drop the ERP adapter, enter “GetPO” as an endpoint name and click on the Next button.
  • From the next screen, select “Query, Create, Update or Delete Information” checkbox and click on the Next button.
  • From the next screen, select below options and Finish the wizard.
OptionValue
Browe bySelect “Services” section
Select a ServiceSelect a “PurchaseOrderService”
Select the operation to perform on the Business Object/Resource or ServiceSelect “findPurchaseOrderByOrderNumber”
  • Edit the GetPO mapper and do the mapping as below:
SourceTarget
PurchaseOrderNumberOrderNumber
SoldToLegalEntityId SoldToLegalEntityId
  • Drop a mapper after GetPO ERP connection and do the mapping as below:
SourceTarget
$GetPO/nsmpr0:findPurchaseOrderByOrderNumberResponse/nsmpr0:result/ns32:Value/ns32:POHeaderId /nstrgmpr:executeResponse/
nstrgdfl:response-wrapper/nstrgdfl:POHeaderId
$GetPO/nsmpr0:findPurchaseOrderByOrderNumberResponse/nsmpr0:result/ns32:Value/ns32:OrderNumber /nstrgmpr:executeResponse/
nstrgdfl:response-wrapper/nstrgdfl:OrderNumber
$GetPO/nsmpr0:findPurchaseOrderByOrderNumberResponse/nsmpr0:result/ns32:Value/ns32:SoldToLegalEntityId/nstrgmpr:executeResponse/
nstrgdfl:response-wrapper/nstrgdfl:SoldToLegalEntityId
$GetPO/nsmpr0:findPurchaseOrderByOrderNumberResponse/nsmpr0:result/ns32:Value/ns32:SoldToLegalEntity/nstrgmpr:executeResponse/
nstrgdfl:response-wrapper/nstrgdfl:SoldToLegalEntity
$GetPO/nsmpr0:findPurchaseOrderByOrderNumberResponse/nsmpr0:result/ns32:Value/ns32:CreationDate /nstrgmpr:executeResponse/
nstrgdfl:response-wrapper/nstrgdfl:CreationDate
$GetPO/nsmpr0:findPurchaseOrderByOrderNumberResponse/nsmpr0:result/ns32:Value/ns32:PurchaseOrderLine/ns32:LineStatusCode /nstrgmpr:executeResponse/
nstrgdfl:response-wrapper/nstrgdfl:StatusCode
  • Validate and close the mapper

The integration configuration is completed. Save, Close, and Activate your integration.

Test the Integration

We’ll use the POSTMAN tool to test the integration.

Create Purchase Order

First, create a purchase order. Open the POSTMAN tool and hit the POST URL. Put the valid data in JSON payload else order creation will get fail.

Get Purchase Order

Get a purchase order. Open the POSTMAN tool and hit the GET URL. Pass the PurchaseOrderNumber and SoldToLegalEntityId in the request parameters.

Leave a Reply

Your email address will not be published.