Skip to Content

How to return many rows in Api_service_response array

Hello dear,

i using the sap CAI to consume a purchcase requisition in odata service. The retunr its working but, i have many itens in a RC, How do I return all items related to RC? In the case I need only for the status of the items.

The Odata service using is odata/SAP/C_PURREQUISITIONITEM_FS_SRV/C_PurRequisitionItemFs?$filter=PurchaseRequisition eq '{{memory.pr.value}}'&$top=1000

The response, i try this:

{{api_service_response.default.body.d.results[0].ProcessingStatusName}}

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 05, 2020 at 05:36 AM

    Hi Wilson,

    For your requirement, you can try something like below:

    {{#each api_service_response.default.body.d.results}} PR:{{api_service_response.default.body.d.results.PurchaseRequisition}}. Status: {{api_service_response.default.body.d.results.ProcessingStatusName}}{{/each}}

    Basically: {{#each array}}....{{/each}} . Whatever is between the two each tags, will be printed. How this works is that the CAI processor will check the array and iterate for each array index. and then using the relative path mentioned as in my example above, print the value in each row.

    Do let me know in case this resolves your issue.

    Best Regards,

    Rohit

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 04, 2020 at 10:47 PM

    Hi Wilson

    Its not clear from the API call how would the system know which specific PR is being used so maybe you want to look for PR item API and then pass the PR number example as below

    /sap/opu/odata/sap/PR_ITEMs/C_PurRequisitionItemFs?$filter=PurchaseRequisition eq '1234567890'

    I don't have a system to try this so I just mocked it up this should return a collection set which would have multiple line items


    regards

    Vinita


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Vinita, thanks for your message.

      I did not understand your position very well, but it is basically in the way that I am making the API return all the data, my problem is showing responses proven by SAP CAI. Where the way I commented, just returns one line from the array