Spend Management Blogs by SAP
Stay current on SAP Ariba for direct and indirect spend, SAP Fieldglass for workforce management, and SAP Concur for travel and expense with blog posts by SAP.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member680688
Participant
1,504
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



  1. URL: https://api.ariba.com/v2/oauth/token?grant_type=openapi_2lo

  2. 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



  1. Method: Select Post

  2. Provide URL as below and replace <realmid> with your realmId.

    1. https://openapi.ariba.com/api/procurement-reporting-view/v2/prod/viewTemplates/KC_GetRequisitions?re...;



  3. Click on Headers tab

  4. Use the access_token from the response you got in Get Bearer Token step above.

  5. Provide the application key you would have secured during application creation as mentioned in the Pre-Requisites section.

  6. Click on Body tab and copy paste the full text from Create Custom ViewTemplate Requisition code snippet below.

  7. 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

  1. Select Method as GET.

  2. Provide the URL of the Custom ViewTemplate created along with the filters as below.

    1. https://openapi.ariba.com/api/procurement-reporting-details/v2/prod/views/KC_GetRequisitions?realm=h...

    2. filter parameter provided in the above URL is for sample purposes. Modify the filter parameter value to fit your needs.



  3. Select the Headers tab.

  4. Use the access_token from the response you got in Get Bearer Token step above.

  5. Provide Content-type as application/json

  6. Provide the application key you would have secured during application creation as mentioned in the Pre-Requisites.

  7. Click on Send button.

  8. Response code should 200 OK.

  9. 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