Hello SAP developers,
So the problem I am trying to solve involves connecting to MS Graph API in ABAP (cloud foundry) where the classes are slightly different to normal on-premise systems.
I can connect to open APIs in ABAP cloud that don't require authentication, many examples online of this, however not what I need.
How do you connect using refresh tokens and client secret using abap cloud, and finally display the payload in a z-table? Do you use destinations or is it better to set it all manually in the abap class/program?
I have already been through the following;
OAuth Credentials
https://help.sap.com/docs/CP_CONNECTIVITY/cca91383641e40ffbe03bdc78f00f681/4e1d742a3d45472d83b411e14...
Destination connection in abap cloud from BTP
https://developers.sap.com/tutorials/abap-environment-external-api.html#237e1bf4-668e-4c95-871e-4258...
SAP BTP and Azure integration
https://blogs.sap.com/2021/07/08/sap-btp-integration-with-microsoft-azure/
Connect MS Graph to Destination in BTP
https://blogs.sap.com/2020/10/12/consuming-microsoft-365-api-in-the-cloud-application-programming-ca...
Consume REST API in ABAP Cloud
https://blogs.sap.com/2020/10/27/consuming-rest-apis-with-cloud-abap/
Also, this connection in POSTMAN works fine, can see the payload no worries and all the data I need. So from the Azure side it is set-up fine.
Thanks so much,
Paul
Request clarification before answering.
So the problem is connecting from Steampunk, right? I have not tried this yet, but since you are saying the calls are working from Postman you have already figured out all the steps for the "authentication dance".
Can you share more insights on where you are facing the problems? Are some of your HTTP calls going through? Are you able to connect to any other external API that requires authentication?
- Holger.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Holger,
thanks for replying. So today I managed to get some success however I am having trouble getting the access token into a variable that I can use for the actual header request to MS Graph and get the data I need.
I am doing 2 calls, one for the token, then one to use that token to get the data. I have moved away from BTP destinations and instead am hard coding a destination in steampunk using if_web_http_client and then setting the header and form-fields using variables from postman.
See screen shots, first 2 are from postman where I can get the access token fine with the 4 main form values (clientID, clientSecret grant-type and scope). I can call this as many times as I like and I get a new token. Also, the second screenshot shows that the token will work successfully to get the data I need. Again, this is in postman and I need this to be done in steampunk.
I do get a 200 code return in my abap console output when I use if_web_http_client->get_headers() however the if_web_http_client->get_text() does not show the token, therefore I cannot use the response for the next call in the header to get the actual data I need.
This is where I am stuck?
Token GET in postman - working.

GET user entity request in postman - working

| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.