Hi, welcome back to our video tutorial series about developing applications with SAP Ariba
APIs.
I am Denys van Kempen from the Digital Partner Engineering team of SAP’s global partner
organisation.
This video is part of a series.
In previous videos, we have covered how to get started.
So in case you are having trouble following along, please take a look at the top of the
playlist first.
Time of recording is January 2020.
For updates, again, please check the SAP Ariba API playlist on our YouTube channel.
Okay - in this video we are going to talk about the operational reporting APIs for Procurement
Let’s start with the documentation on the SAP Help Portal
Procurement APIs Operational reporting
to support operational decisions, invoices to pay or purchase requisitions that need
approval Here we see the type of transactions we can
get data from synchronous versus asynchronous usage
do you want it in real-time or batched there are some limitations if you want it
in real-time, so you may have to check first what works for you
there are some query parameter we can specify, we will see this in a minute
the filter parameters these we pass in the request body
then we have workflow - this is important to understand what we can do with the API
here we see this in action We start with a GET call to list the names
and details of the reporting views currently in the system for a particular document type
/viewtemplates with realm, document type and status as query parameters
For the details of a particular view template, we use /viewtemplates with the template name
and the realm To create a custom reporting view template,
we use the same URL but now with a POST and should we need to modify it, we can use
the patch endpoint to change the status.
Those are the possible view template actions available.
Then we also have a /metadata endpoint to our disposal
This provides the data we need, the fields and document types to create custom templates
we will see this in action in a minute
Also documented here is the view template structure.
As you will see, we will get a lot of data back
Here you can find the explanation what it is you are looking at
A sample request to create a view template - we are going to use this with Postman
Okay - so much for the documentation
The API specification we can find on the SAP API Business Hub
SAP Ariba Ariba APIs
30 listed today if we filter on reporting
list view
you can see that we have analytical reporting APIs
we already covered those in a previous video tutorial, but this works pretty much the same
way
and than operational reporting for sourcing
and for procurement synchronous
job results job submission
view management
Let’s start with view management
Here we have the specs three GETs and two POSTs
/metadata and /viewTemplates
If we expand the metadata endpoint, we can see that we need to provide the realm
and product: buyer (procurement) or sourcing optionally the document type or fields, should
you want to filter the output and whether you want a JSON schema or not.
For the viewtemplates endpoint, we only specify the realm and should we need some information
about a specific view template, we need to provide this as parameter.
It is a GET call so we are not going to create anything, of course.
For this, we would use the POST call endpoint is the same
but now we pass some data in the body.
Details, contains an excerpt of the documentation, with the URLs.
procurement-reporting-view
let’s switch to the SAP Ariba developer portal
the specification is the same here we have a link to the documentation
and a reminder of the request limits
We can try them out here, you will need to create an API key first for that but let’s
go straight to the real thing and take a look at how this work when using Postman
Okay I have created a collection for this API
The URL is specified as collection variable, so here we have the runtime url and the sandbox.
Let’s start with /metadata realm and product were required.
the API key and token are in the header - these are set as environment variables.
with this bit of code First, we need to get a token, that will be
passed to the header and now we can run the GET metadata request
Document type, here invoice Filter fields, unique name, status string,
time updated, there are a lot.
Select fields, also quite a list
Now we could decide we wanted to filter on a particular document type
Here I have listed a couple
we could also do a select.
Now we get all the different document types Alternatively, we could select only the filter
or select fields
Okay,
Next, we have view templates Only the realm is required.
This returns a list of view templates.
We see the name the status
the document type and the associated select attributes and filter
expressions
If we scroll all the way down, we get a page token
and this is what we need to add for the next page
Okay - to only get the details, we do a GET on the viewTemplates endpoint with a template
name in the path Same data, except for a single view template
let’s create a view template In the body I have add the sample code from
the documentation, with some slight adjustments
we need to add commas
and then remove the view template name
and put that in here as a path variable
Send
and we get the same body back, status 200 OK, view template created
Note that the status is draft
Next, we can then use the patch endpoint paste in the view template again
in the body, we now set the status to published
Send
and we have updated the view.
okay - that’s it for operational reporting API for procurement, view management.
In the next video we will continue and take a look at the jobs.
Thank you for watching