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: 
ajmaradiaga
Developer Advocate
Developer Advocate
In this blog post I quickly explain how to update the commodities of a commodity type question in a supplier questionnaire.

In the Supplier Data API with Pagination documentation - https://help.sap.com/viewer/60ec8b8bb9344dbe8dcf15e2a1edc85b/cloud/en-US/ade8c980937c4684a8cffeec714..., it is possible to find details on how to update answers to questions. Unfortunately, it only covers answers to simple questions and attachment type questions but what about commodity type questions?
If you want to learn how to update certificate type questions, check out this blog post - https://blogs.sap.com/2021/11/15/update-certificate-type-questions-via-the-sap-ariba-apis/

So, how do I update commodity questions in a supplier questionnaire?


To have an idea of the body structure required by the API for a certificate type question, I used Chromium Developer tools and captured the request sent when updating the question. Within the request I extracted the item that belongs to the commodity type question and used that as a starting point.


Chromium developer tools - submitQuestionnaire



There are limitations on when you are able to update the answers of a questionnaire, e.g. can't update an answer in any questionnaire that the supplier is currently acting on, make sure you are familiar with them. You can find the limitations here: https://help.sap.com/viewer/60ec8b8bb9344dbe8dcf15e2a1edc85b/cloud/en-US/ade8c980937c4684a8cffeec714...

Below a sample request to update a commodity type question. Notice that we need to commodity Id and "pack them" in an array as it is a field that allows multiple values.
curl --location --request POST 'https://openapi.ariba.com/api/supplierdatapagination/v4/prod/vendors/S350261234/workspaces/questionnaires/Doc3244061234/answers?realm=myrealm-T' \
--header 'Content-Type: application/json' \
--header 'apikey: S9f5ap58UGqw9f5a8ANamn9f5aUEg9f5a' \
--header 'Authorization: Bearer 0bad03e4-1234-1234-6789-f2f835065be1' \
--data-raw '{
"answers": [
{
"externalSystemCorrelationId": "KI_1211234",
"multiValueAnswer": [
"53",
"72"
]
}
]
}'

Once updated, we can retrieve the values via the API and there we will see the answers just posted to the API.


Commodity type question updated via API


I hope this quick blog post helps you when battling with the Supplier Data API with Pagination when trying to update commodity type questions :-).
6 Comments