cancel
Showing results for 
Search instead for 
Did you mean: 

CAP application with external API on BTP

Shanir
Discoverer
0 Kudos
352

Hi CAP experts!

I have developed couple of CAP applications on BTP with SAP backend before, but i have come to meet new challenge and going through various blogs I cant seem to locate the information pertaining my usecase, I only find blogs where external api is used as value helps, no as main data source.

The gist of the case is a simple one: need model based LR app with create/ediit functionality. But the issue is that data resides outside SAP systems - in external API, that I added as an destination to BTP and connected to CAP project in BAS, which imported it as xml and cds files in srv/external.

Now while testing local service I can see data, but no create or edit, which i assume is because I don't use local db..

So the question is - is there a way to achieve create app based on solely external data service and get out of the box create/edit? Should the data be replicated in hana db fully? or the way is to add create/edit functions as extensions on UI? or maybe draft functionality can be levergaed somehow differently?

Also thereto - is it possible to create such app using managed approuter or?

 

Thx,Shanir

View Entire Topic
WouterLemaire
Active Contributor

You want to have a fiori elements app on top of your cap app that uses an external odata service and use the create and edit function if I understand it correctly?

For this, you need to enable draft on the entity which doesn’t work out of the box with cap for external api’s. The npm package that dinu proposes could help with that but I haven’t used it before. An alternative could be that you use a temporary table in between with draft enabled. In the after create event handler you can send the data to your external api. 

Shanir
Discoverer

Hi @WouterLemaire ! Yes you understanding is correct. Big thanks for pointers. While searching for information I came accross rizing's npm package, but is it production safe?

Can you tell me a bit more about your suggestion, maybe there's some sample of that? How would that look, do I create local db model with all the data I need and then map it in the handler to external? 

thank you!

Shanir