Skip to Content
Technical Articles

SAP CAI Chatbot Integration with ERP just have become Super Easier! for ABAPer

Hello Everyone,

Welcome to my another interesting blog on recently released SAP Conversational AI new features “Consume API Service”. In this blog i would try to discuss what is the benefit, how to use this feature, why chatbot integration just become super easier using this feature specially for ABAPer.

So what is Consume API Service ?

For example you are designing a chatbot¬† which will give you purchase requisition status from ECC or S/4HANA system then before “Consume API Service” we used to build a wrapper service based on node.js or python or java which as Webhook. And this wrapper normally we used to host either on SAP Cloud Platform Cloud Foundry or some other cloud provider like AWS, GCP. At the same time if some one is from ABAP background and dont know how to build wrapper using node.js or python is quite challenging to build such chatbot completely for him/her/others. But this Consume API service is just making everyone’s job easy, don’t need to build any wrapper direct calling odata can give you instant result.

After releasing this feature i am like ūüėõ

So How is the Technical Architecture?

If you look at the Architecture, we don’t node.js based Webhook application which normally runs on SAP Cloud Platform Cloud Foundry. I have used oData provisioning service because odata service need to be exposed into internet and my conversational AI is developer version which doesn’t come as SAP Cloud Platform Service. if you are having productive SAP Conversational AI which comes as Cloud Platform Subscription then you can directly connect cloud connector, don’t need any oData provisioning service.

What is the benefit?

You don’t need to build any wrapper node.js, don’t need to run any express Application or Python application which work as a Webhook. Direct integration with oData service.

How to use this Feature?

Let’s discuss the main thing which we are waiting for. I am not going to discuss here how to build SAP oData service which will fetch purchase requisition status. Rather we will focus on how we can call the odata service directly.

Lets break this whole integration into small step.


Step 1: Exposing backend oData through cloud connector and oData provisioning service (Prerequisite)

As a prerequisite you need to setup your cloud connector and oData provisioning service for exposing your On Premise oData into internet.


Please have a look at the very informative blog for how you can expose your backend odata into internet through Cloud connector and oData provisioning service (Formarly Known as Gateway as Service)

Step 2: Analyzing Postman or oData response

So i have already exposed odata service which is exposed through cloud connector and oData provisioning service and below is my postman call response. (i have passed Accept : Application/json in header to get json Response and Authentication type is basic your SCP P/S/D/C/I username and Passowrd)

This odata service is very simple which return a status for a purchase requisition as you can see. Here i am passing purchase requisition number  as filter. Now if you look at the JSON response and if i want to access requisition status then its pretty easy which is d.results[0].ProcStat.

Step 3: Building Chatbot and use Consume API service feature

If you are very new to Chatbot development and still wondering how to build your first chatbot then look at this awesome tutorial

so in this case i have designed my intent and skill like below

And Skill is like below

So this pr variable is going to store purchase requisition number and which we will be using it as filter parameter in action of the skill. Now go to action and click on add new message group then click on connect external service -> Consume API service.

As it is GET call, select type as GET and use {{}} as filter parameter. In Authentication use your SCP username and password

Now lets analyze the response of this API service.

This response part is non editable, and api_service_response variable is going to hold whole response from your odata. So this is how it looks like.

"api_service_response": {"default" : { "body":{odata response in json}}}

So if you want to access the purchase requisition status then below is how its look like                        {{api_service_response.default.body.d.results[0].ProcStat}}

so we just have to just add another text type send message below of this action to send purchase requisition status to user and then clear memory step like below.


Step 4: Test your chatbot


That’s it, i hope you learned something cool, if you enjoyed this blog please like, share and comment.









You must be Logged on to comment or reply to a post.
  • Hi Sudip Ghosh,

    I tried consuming a oData Service in a Chatbot by following the steps which you have mentioned in the blog, but my oData Service is throwing below error and failing to load the service, Can you please let me what could be the reason for this.



    • Hello Krish,

      First make sure your odata service is reachable over internet, can you share the postman response format of your odata service.



    • Hi Krishnakanth Gajula,


      Did you fix this issue? I am also facing the same issue and same error message.

      Please help if you fix the same error message.

      Thanks in advance.




      • Hi Sudip,


        I have added Accept : application/json in header but HTTPS call is throwing error message.

        Surprisingly ODATA with HTTPS is working in web browser but its failing and throwing error message with HTTPS.


        Please help.



  • Hi Sudip,
    Can you give an example on how to make a post request call using CONSUME API SERVICE? Because before making a POST call, we need to fetch the x-csrf-token using a GET call. How do we fetch the token and pass it to the POST call?
    Sangita Purkayastha

    • i didnt try it for POST based call, I guess it is only made for get call, if you want to create some thing then you have to handle it in get entity set method only as there is no scope i can see for fetching csrf as of now

    • Hi Sangita,

      you can make POST calls using the "Consume API Service", but it is currently not possible to extract a x-csrf-token and cookie headers of a previous GET call. This is something we're planning to support in future.

      Currently the only option would be to have a service (e.g. node.js) that would make the GET call, extract the x-csrf-token and cookie as header and return it in the body. Then in your skill you can first call this service to fetch the token and cookie and use them for any "Consume API Service" actions by referencing the corresponding {{api_service_response}} variable.

      You might also want to check if your OData service can be accessed with another authentication type, which does not require cookies and x-csrf-token, as these are usually only required for browser-based communication scenarios and not for server-to-server communication.


  • As ABAPer, it will help me a lot. Javascript at SAP WEB IDE was killing me!

    Anyway, I need to try some stuff, for example we have quickreplies (buttons) developed at node.js side with the oData information. I guess the Odata service developed in ABAP will not be enough to skip this transformation.



  • Hi Sudip,Amazing blog, couldn't stop my self trying this out.But Unfortunately it is not working for me..I always get "No Reply" from bot.I can access my service in postman after odata provisioning.Please guide

    • Ahhh! check your object properly where is your array number [0] , check mine one {{api_service_response.default.body.d.results[0].ProcStat}}

      • Thanks a lot such quick response.Path is correct.I even hardcoded the PO number.

        Seems it is not connecting to resource, i tried with an amazon service also.NO idea what is wrong here. In monitoring i see "There are no entries here"


    • You can try adding {{api_service_response.default.status_code}} and {{api_service_response.default.body}} to a "Send message" action to see what the service returns. If these are completely empty, it means that the call itself failed, then please check the debug log for details (switch on "Debug" in the top of the "Test your bot").

      Also make sure you did not set any namespace in "Response" tab.

      • Hello Jonas Brand¬† and Sudip Ghosh¬†,

        I have tried both -  {{api_service_response.default.status_code}} and {{api_service_response.default.body}} in 'Send Message'

        and I am getting status as '200' but nothing in 'body'.  Where are all going wrong . I can see many people have this issue.



        • Hello Jonas Brand and Sudip Ghosh

          I understand the issue now -> we are passing Sales Order ID as '0500000483'  but bot is removing 0 from the beginning. How to tackle this situation ?

          I have checked the response in the memory variable it is removing '0' from the beginning. Thus it is not returning any result.

          I am using #number in 'Required Information' to save SalesOrderID in memory of Bot.

          It would be helpful if you could guide us.


  • Hi Sudip,

    I want to print this long text in the chat box as multi-line


    Overall Picking / Putaway Status is : Completely processed \n Overall Goods Movement Status is : Not yet processed \n


    but \n is not working any suggestions please

  • Hi Sudip,

    My url of odata service is of http and in cai chat bot we can only use https or use destination so any suggestion or anything that can work on

    Thanks in advance

      • Hi Sudip,

        If my Odata service required authentication then ?every time i am accessing it from browser i need to enter my login id for that then how to add that credential in this. do I have to add it in header? or in basic authentication tab. I am getting timed out error every time.



      • Hi Sudip ,

        Can you please elaborate more on how can we make it https ?

        I am facing issue and have tried various options but not able to test the chatbot , any help will be highly appreciated .

        Regards & Thanks,

        Ashwani Rohilla

        • Create a wrapper HTTPS API using API management and use that wrapper API URL with https. it would work if you don't have SSL installed.

  • Hello Sudip,


    Thank you for this great blog, I tried it and it is working, but I have a question here.

    I want to create a list as response and want to display more than 4 rows of list, manually I can achieve it by giving results[0], results[1]..etc are there any dynamic way to display the results in array?

    Thanks in advance

  • HI Sudip,

    This is very nice blog for new learns form ABAP.

    I have one doubt why we have to connect HANA  cloud connector and Odata Provisioning.Why can't access directly to  Odata service in SAP CAI .

    My scenario like we are using azure gatway to connect the OnPrimes HANA systems.

    Postman it is success

    Postman response


    But if we trying in CAI I got below  path building failed error .

    "\": PKIX path building failed: Details: unable to find valid certification path to requested target; nested exception is Details: PKIX path building failed: Details: unable to find valid certification path to requested target",

    CAI Action

    Please help me on this.

    Thanks ,


  • Hi Sudip,

    Your blog made me excited to try it. But facing an issue which I'm unable to solve. Hence I'm stuck. Please help.

    My Cloud Connector is reachable.

    I'm able to access service catalogs from WebIDE while creating Fiori App.

    The problem is with ODATA Provisioning.

    I have enabled OData provisioning in my Neo trial account. I have also assigned the GW_Admin and GW_User role to my s-user. Still, when I try to access the "Destination" tab under Configure Service, it shows me "UNAUTHORIZED!" - 401 error. Can you please help me in setting up this?

    I have already refered to :

    And Note - 2669874 - ODATA Provisioning Administration Error - You do not have sufficient authorization to access this page

  • Hi Sudip,


    I am getting below error. Can you please help?


    Warning: An API error has been detected on
    "Error while processing request. Error Code: TemplateEngine - 0105. Server response with: An error occured during the expansion of template with key 'url'. >>Undefined context path 'memory.po.scalar'. (error code: 'TemplateEngine - 0106', id: 'c7635be8-c30a-4c39-8a16-288a391590cd')<<"




  • Hi Sudip ,

    I also followed the similar steps and tried to add ES5 data, but once I click on yes I am not getting any responses.Could you please suggest.


    Responce Error

  • Hello Sudip and thanks a lot for your blog.

    I can run the https URL for my OData Provisioning Service but when running it from Postman i always have the message:

            <p>Note: Your browser does not support JavaScript or it is turned off. Press the button to proceed.</p>
    i am passing Accept: Application/json and Authorization my SAP HCP username/password.
    Do you know what can be wrong?
  • Hello Sudeep,

    I am facing issue in this step-

    Step 1: Exposing backend oData through cloud connector and oData provisioning service (Prerequisite)

    I read the blog you shared in link but i am not able to see Neo account on my HCP home page.

    Can you please guide me on this step.


    Thanks ,


      • Hi Sudip, I also faced somewhat same problem. I was unable to locate the OData provisioning on the HCP.¬† After some analysis, came to know about the Serverless runtime service which has OData provisioning as a part. Your views on using serverless runtime?

      • Hello Sudeep,

        Can you help me with some steps or share any document to expose my on premise odata service to internet using Extension factory service as you said?

        And also i am using the trial version of CAI , do i need the enterprise edition in order to connect my CAI bot to my Odata service?

        I contacted you on linked earlier but you were on vacation that time.

        Can you spare some time anytime soon to help me in this topic. It will be really helpful.

        Thanks & Regards,