cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a Local REST API ( a Custom RAP API ) inside another API in BTP ABAP Environment

Sijin_Chandran
Active Contributor
0 Kudos
1,094

Hello Gurus,

The context of my POST is somewhat related to as that of the below one,

https://community.sap.com/t5/technology-q-a/rap-managed-with-additional-save-exception-handling/qaq-...

In our case we need to update another Table inside the same RAP LUW, when we raise an Exception using FAILED parameter. But here the issue is if FAILED is raised then whole RAP BO LUW goes into ROLLBACK state and hence none of the DB Operations gets applied.

And the Table we have to update is a ERROR LOG table to record some of the details during the Failure.

So, for this as a solution we had created a RAP Web API on top of the ERROR_LOG Table we had and that we tried calling inside the the Original RAP Interface Web API. 

We tried with all the options for creating the destination, i.e.:

1.) cl_http_destination_provider=>create_by_url

2.) cl_http_destination_provider=>create_by_cloud_destination

3.) cl_http_destination_provider=>create_by_comm_arrangement

Regarding the Comm Arrangement, we created a Comm Arrangement for Inbound call and once we did this we were able to successfully call the ERROR_LOG RAP API using the POSTMAN tool.

But when we call this inside the MAIN RAP API Program for logging the Error its not working, our Impression was that when it works for POSTMAN, then cl_http_destination_provider=>create_by_url should have worked by passing hardcode Credentials for Authentication.

But it returns UCON error,

Sijin_Chandran_0-1727348415567.png

Can anyone suggest how we can resolve this and why this error is coming when the system is trying to call itself only.

Thanks,

Sijin

 

Accepted Solutions (1)

Accepted Solutions (1)

junwu
SAP Champion
SAP Champion

try this CL_ABAP_PARALLEL (if_abap_parallel)

no need to make remote api call.

Sijin_Chandran
Active Contributor
0 Kudos

Hello @junwu, this looks promising!

Let me give this a try and get back to you here, thanks for this.

Still could you suggest where we are missing while making a call to an API locally ? and how to do away with that UCON Error message?

Thanks,

Sijin

Sijin_Chandran
Active Contributor
0 Kudos
Hello @junwu, The solution you suggested works like a charm!

Answers (0)