Manage Requisitions by Users with Project Information

Previously, non-integrator users could create, update, and submit requisitions via a REST resource. The use case was an employee, Mary Brown, who needed to order office supplies for herself.

Let's assume that Mary Brown has been temporarily assigned to prepare for attending the annual Oracle Open World Conference. A special project, the Oracle Open World Conference Project, has been created to track expenses related to the Oracle Open World Conference. Mary Brown needs to order office supplies and charge it to the Oracle Open World Conference Project. Such project-related information is captured via Project Costing Descriptive Flexfields.

Let's discuss these scenarios briefly.
  • Create a requisition with the project information.

  • Update the project information.

  • View the requisition.

Create a Requisition With Project Information

This involves executing a POST action against the Purchase Requisition resource.

Example URL

/fscmRestApi/resources/version/purchaseRequisitions

cURL Command

curl -u username:password -X POST -H "Content-Type:application/vnd.vision.adf.resourceitem+json" -d 'request payload' "https://servername/fscmRestApi/resources/version/purchaseRequisitions"

Example Request

Here's an example of the request body in JSON format:

{
    "RequisitioningBUId": 204,

    "PreparerId": 100100004256726,

    "ExternallyManagedFlag": false,

    "Description" : "Office Supplies",

    "lines": [{

            "LineNumber": 1,

            "LineTypeCode": "Goods",

            "CategoryName": "Paper",

            "ItemDescription": "Notebook – 100 Pages",

            "UOM": "Each",

            "Quantity": 1,

            "Price": 4.99,

            "CurrencyCode": "USD",

            "DestinationTypeCode": "EXPENSE",

            "DestinationOrganizationId": 204,

            "RequesterId": 100100004256726,

            "DeliverToLocationId": 204,

            "RequestedDeliveryDate": "2021-09-15",

            "distributions":[{

                "DistributionNumber":1,

                "CurrencyAmount": 4.99,

   "Quantity": 1,

        "projectDFF":[{

                   "__FLEX_Context" :  "POR_Requisition" ,

                   "__FLEX_Context_DisplayValue" :  "POR: Requisition", 
        "_PROJECT_ID_Display" : "OOWC Project",

                   "_TASK_ID_Display" :  "1.1" ,

                   "_EXPENDITURE_ITEM_DATE" :  "2021-09-15",

                   "_EXPENDITURE_TYPE_ID" :  10046 ,

                   "_EXPENDITURE_TYPE_ID_Display" :  "Office Supply Consumables" ,

                   "_ORGANIZATION_ID" :  null ,

                   "_ORGANIZATION_ID_Display" :  "Vision Operations" ,

                   "_CONTRACT_ID" :  null ,

                   "_CONTRACT_ID_Display" :  null ,

                   "_RESERVED_ATTRIBUTE1" :  null ,

                   "_RESERVED_ATTRIBUTE1_Display" :  null ,

                   "_BILLABLE_FLAG" :  null ,

                   "_BILLABLE_FLAG_Display" :  null ,

                   "_CAPITALIZABLE_FLAG" :  null ,

                   "_CAPITALIZABLE_FLAG_Display" :  null ,

                   "_WORK_TYPE_ID" :  null ,

                   "_WORK_TYPE_ID_Display" :  "Funding - External"

                    }]

 

            }]

        }]

}

Note:

  • The PreparerId must match the personId of the person making the REST call.
  • The person making the call must have access to the requisitioning business unit in which the requisition is being created.
  • The person making the call must have the necessary privilege for the type of line they are creating. For example, if the payload has a deliver-to location that is different from what is on the user's HR record, then the person must have the privilege to create requisition lines with a deliver-to location different from what is on their HR record.
  • You don't have to specify a "__FLEX_Context" for projectDFF. If the attribute is not part of the payload, the application automatically populates the correct value, which is POR_Requisition.
  • For projectDFF attributes, you can specify either their ID, display name, or both. If you specify both the ID and display name, the id ID has a higher priority.

Update Project Information

Let's say Mary Brown needs to change the date on which the expense is to be charged against the project, that is, the _EXPENDITURE_ITEM_DATE .

Since project information is at the distribution level, updating the project information involves executing a PATCH request against a specific distribution.

Example URL

/fscmRestApi/resources/version/purchaseRequisitions/purchaseRequisitionsUniqID/child/lines/linesUniqID/child/distributions/RequisitionDistributionId/child/projectDFF/DistributionId

cURL Command

curl -X PATCH -u "username:password" -H "Content-Type: application/vnd.oracle.adf.resourceitem+json" -d 'request payload'  "https://servername/fscmRestApi/resources/version/purchaseRequisitions/purchaseRequisitionsUniqID/child/lines/linesUniqID/child/distributions/RequisitionDistributionId/child/projectDFF/RequisitionDistributionId"

Example Request

Here's an example of the request body in JSON format:
  {

           "__FLEX_Context" :  "POR_Requisition" ,

           "__FLEX_Context_DisplayValue" :  "POR: Requisition", 
  "_PROJECT_ID_Display" : "OOWC Project",

             "_TASK_ID_Display" :  "1.1" ,

             "_EXPENDITURE_ITEM_DATE" :  "2021-09-10",

             "_EXPENDITURE_TYPE_ID" :  10046 ,

             "_EXPENDITURE_TYPE_ID_Display" :  "Office Supply Consumables" ,

             "_ORGANIZATION_ID" :  null ,

             "_ORGANIZATION_ID_Display" :  "Vision Operations" ,

             "_CONTRACT_ID" :  null ,

             "_CONTRACT_ID_Display" :  null ,

              "_RESERVED_ATTRIBUTE1" :  null ,

              "_RESERVED_ATTRIBUTE1_Display" :  null ,

              "_BILLABLE_FLAG" :  null ,

              "_BILLABLE_FLAG_Display" :  null ,

              "_CAPITALIZABLE_FLAG" :  null ,

              "_CAPITALIZABLE_FLAG_Display" :  null ,

              "_WORK_TYPE_ID" :  null ,

              "_WORK_TYPE_ID_Display" :  "Funding - External"

          }

Note:

  • The PreparerId of the requisition must match the personId of the person making the REST call. This means you can only update requisitions that you own.
  • The person making the call must have access to the requisitioning business unit in which the requisition was created. This means if, for example, you created the requisition in Business Unit A but no longer have access to that business unit, you won’t be able to execute a PATCH against it.
  • A PATCH for ProjectCostingDFF is essentially a POST. The payload overwrites the information in the database, which means your payload has to include all project attributes and their corresponding values, not just the attribute that you intend to change.

View the Requisition

Let's say Mary Brown wants to check if she entered the correct information before submitting the requisition for approval.

This involves executing a GET request against a specific requisition. Here's an example of the request body in JSON format:

Example URL

/fscmRestApi/resources/version/purchaseRequisitions/purchaseRequisitionsUniqID
cURL Command
curl -u username:password "https://servername/fscmRestApi/resources/version/purchaseRequisitions/purchaseRequisitionsUniqID"

Note:

  • The PreparerId of the requisition must match the personId of the person making the REST API call. This means you can only view requisitions that you own. Unlike with the web application, you can't view requisitions for which you are listed as a requester on one of the lines unless you also own the requisition.
  • Unlike with the web application, having the View Requisitions - All privilege, POR_VIEW_REQUISITIONS_ALL, will not allow you to view requisitions created by other people when you make the call to retrieve the requisition via REST API.
  • The person making the call must have access to the requisitioning business unit in which the requisition was created. This means if, for example, you created the requisition in Business Unit A but no longer have access to that business unit, you won't be able to execute a PATCH against it.
  • If the requisition contains project information, only the currently active Project Information fields (segments) will be returned. This means inactive segments will not be returned even if the segment had a value before it was made inactive.