This is part 2 of the 6 series blog. Please start with
Part 1: Introduction to understand the Use case, Solution Architecture, High-Level functionality, and context of this blog series.
This blog series is divided into 6 parts:
Part 1:
Introduction
Part 2: SAP Ariba – API Setup
Part 3:
SAP Integration Suite – Integration Flows Build
Part 4:
Ariba Requisitions Service Application
Part 5:
Ariba Requisitions Fiori Application
Part 6:
Central Fiori Launchpad Setup
Part 2: SAP Ariba - API Setup
Pre-Requisites
- Your organization is registered to use the SAP Ariba APIs and your Organization Admin user has set up Developer user accounts
- Create an application in the developer portal, get it approved and you have Application Key, OAUTH ClientId, and OAUTH Secret.
- An API Client tool like Postman, SOAPUI, etc. Postman is used to perform the steps in this blog series.
SAP Help URL that explains steps to achieve the above prerequisites is as below.
SAP Ariba API Help URL
Get Bearer Token
Request
- URL: https://api.ariba.com/v2/oauth/token?grant_type=openapi_2lo
- Authorization: Base 64 Encoded OAuth Client ID and OAuth Secret
Picture 2
Response
Value of
access_token is the bearer token that is needed on the request for creating the custom ViewTemplate
Picture 3
Create Custom ViewTemplate
- Method: Select Post
- Provide URL as below and replace <realmid> with your realmId.
- https://openapi.ariba.com/api/procurement-reporting-view/v2/prod/viewTemplates/KC_GetRequisitions?re...;
- Click on Headers tab
- Use the access_token from the response you got in Get Bearer Token step above.
- Provide the application key you would have secured during application creation as mentioned in the Pre-Requisites section.
- Click on Body tab and copy paste the full text from Create Custom ViewTemplate Requisition code snippet below.
- Click on Send.
{
"status": "published",
"documentType": "Requisition",
"selectAttributes": [
"TotalCost",
"UniqueName",
"Name",
"Requester",
"StatusString",
"Active"
],
"filterExpressions": [
{
"name": "createdDateFrom",
"field": "TimeCreated",
"op": ">",
"defaultValue": null
},
{
"name": "createdDateTo",
"field": "TimeCreated",
"op": "<=",
"defaultValue": null
},
{
"name": "updatedDateFrom",
"field": "TimeUpdated",
"op": ">",
"defaultValue": null
},
{
"name": "updatedDateTo",
"field": "TimeUpdated",
"op": "<=",
"defaultValue": null
},
{
"name": "statusInList",
"field": "StatusString",
"op": "IN",
"defaultValue": [
"Approved",
"Canceled",
"Canceling",
"Collaborating",
"Collaboration",
"Completed",
"Denied",
"Invalid",
"Ordered",
"Ordering",
"Received",
"Receiving",
"Submitted"
]
},
{
"name": "uniquenames",
"field": "UniqueName",
"op": "IN",
"defaultValue": null
}
]
}
Picture 4
You will receive a
200 OK response along with the full Custom View Template details. This indicates the successful creation of the Custom ViewTemplate.
Unit Testing Custom ViewTemplate via Postman
In Postman, perform the below steps in the same sequence
- Select Method as GET.
- Provide the URL of the Custom ViewTemplate created along with the filters as below.
- https://openapi.ariba.com/api/procurement-reporting-details/v2/prod/views/KC_GetRequisitions?realm=h...
- filter parameter provided in the above URL is for sample purposes. Modify the filter parameter value to fit your needs.
- Select the Headers tab.
- Use the access_token from the response you got in Get Bearer Token step above.
- Provide Content-type as application/json
- Provide the application key you would have secured during application creation as mentioned in the Pre-Requisites.
- Click on Send button.
- Response code should 200 OK.
- Response body should have the Requisition data from the SAP Ariba realm based on the filter criteria. It should be in JSON format.
Picture 5
Next In Series
Part 3:
SAP Integration Suite – Integration Flows Build
Part 4:
Ariba Requisitions Service Application
Part 5:
Ariba Requisitions Fiori Application
Part 6:
Central Fiori Launchpad Setup