cancel
Showing results for 
Search instead for 
Did you mean: 

Access RAP CDS behavior implementations (backend), via the Business App.Studio-UI5 (Frontend) button

former_member820465
Participant
3,276

Hello,

I have a question and I couldn't solve it.

I have a backend application with RAP that includes CDSs, CDs view, CDS Projection, Service definition, Service Binding and CDS-Behaviour and CDS-Behviour Implementation Classes. With this, a connection to a room in fiori UI is already implemented automatically.

I can also access this backend RAP from a fiori UI application with SAP BAS (Business Application Studio).

Problem: I want to be able to access this backend RAP from a SAPUI5 (not fiori UI) application with SAP BAS(Business Application Studio). But unfortunately I can't find it.

Here's what I want to do: I can't stay flexible and free with Fiori. I want to implement my own UI with SAPUI5 and I want to reach the backend (I want to use RAP - CDS Behavior Implementation Classes) with a button, for example.

my problem is with both RAP and (SAP Business Application Studio - SAPUi5).

We can make Fiori applications very easily with RAP in your teachings. I have implemented all of these. It's running well.

Fiori applications contain about 6 different "Floorplan". In other words, we can say 6 different templates or templates. But I don't need these templates in my UI part. We have a Business Logic (Unmanaged Scenario) of our own in the project we have done, and also a Fiori UI does not appeal to us (for this project) as we have a UI-Design of our own.

We want to design the front end with XML and Javascript codes (SAP Business Application Studio - SAPUi5). However, I'm running into a problem and I can't find any resources about it anywhere.

Problem: I can't find how to access our RAP project (Behavior Implementation Class in RAP) that we have created via SAP BAS SAPUI5, for example, when clicking a button.

Normally I can access my oData data. But how do I access the Behavior Implementation Class in RAP?

Fiori templates are not always a suitable choice for users. In some projects we want to use our own User Interface to be more flexible. You have already shown that we can normally access our RAP project (Backend - Behavior Implementation Class in RAP) with Fiori Templates. For example, with an "action"-button on Fiori, we can easily access the Behavior Implementation Class in RAP in the backend. But when we want to do it with SAPUI5 instead of Fiori, how do we do it?

In summary: How can we reach backend (Behavior Implementation Class in RAP and RAP) via frontend (SAP BAS-SAPUI5 part) (not Fiori - with SAP UI5). (like "-action" logic in Fiori) I want to reach Behaviour-Class in RAP with a button in SAPUI5. Unfortunately, this is not available in either RAP training or SAPUI5 training. I couldn't find any source. How can I do that?

Orhan

Jaman
Participant
0 Kudos

Hello Orhan,

I can completely understand your question.

Basically you have created RAP Project along with Fiori Elements. It works fine end to end.

But now you want to replace this Fiori Elements with UI5 application and want to know know whether you can re-use the Behavior Implementation (Business Logic).

Did you try using the web api created out of the RAP project in your UI5 application? Have you found any other solution for this?

Accepted Solutions (0)

Answers (4)

Answers (4)

ThomasFeyer
Explorer

Hi Orhan,

You are looking at RAP too complicated. All it does is create an oData service and of course you can consume this service any way you like. Fiori Templates are just one very easy way to do so.

For example, if you defined an action in your behavior definition (and implemented it in the appropriate class), this action will be defined as a function import in the oData service (which you can see in its metadata as well) and you can call this function import from your SAPUI5 app similar to how it used to work before we even had RAP and Fiori Templates.

Hope this helps to clarify a bit.

Best Regards,
Thomas

former_member820465
Participant
0 Kudos

Hi Thomas,

first of all thank you very much for your reply.

Unfortunately, it is still not clear for me at the moment. How can we do "function import" with RAP or how was it done before? How to access a function from a metadata?

Also, what I don't understand is about managed and unmanaged scenarios. If there is a legacy code or not, one of them must be selected. What kind of technical relationship it has with Legacy code, I can't make sense of it. Do you have any knowledge about this topic?

Thank you very much.

Kind Regards.

Orhan

ThomasFeyer
Explorer
0 Kudos

Hi Orhan,

I would suggest you find an older tutorial about SAPUI5 freestyle apps consuming oData services. I don't have any link, but there must be a few good ones available. Forget about RAP first and once you understand the concept, you should be able to use your RAP service in the very same way.

I personally haven't used unmanaged RAP, but in my understanding the difference is in the transactional processing. Managed scenarios take care of this automatically (e.g. create, update, delete, save) whereas in an unmanaged scenario you have to implement them yourself. If this is not clear, please also look for tutorials, SAP has a pretty good selection explaining everything step-by-step.

Best Regards,
Thomas

former_member820465
Participant
0 Kudos

Hello Thomas,

Even if I forget that I do all Annotations and oData over RAP, we create Implementation Classes based on these annotations (for example "action") in RAP.

Previously (before RAP) there was no concept of accessing ABAP Class data directly from the UI. This is totally a novelty.

And while this implementation Class can be accessed with "action" created in CDs and shown in Fiori, when I build an empty UI5 project on this RAP, I want to control this "action" in CDs. RAP, I can access the oData, it's fine, but the button created with the action in the CDs does not appear as a button in the UI with an empty SAPui5 project. How can I show this button? is that the question?

Kind Regards

Orhan

Altarkawi
Participant
0 Kudos

Hey Orhan, as Andre mentioned, you are probabely looking for SAPUI5 freestyle application, in your BAS you can find your RAP Service Binding.

There is another way to change some UI (adding action button) to your RAP app by using the Guided Development in BAS. this also would make able to import your function and as you already asked how it works

former_member820465
Participant
0 Kudos

Hello Mohammed,

If I try 2 options over SAP BAS (Business Application Studio).

1. Fiori Application (I tried all scenarios)

2. SAPUI5 Application

If I try as a Fiori Application, I can use all the features in RAP such as the "action" button and access the Implementation Class in CDs.

However, this is a completely fixed Template and not flexible. So I can't organize this page as I want.

If I create a UI5 Freestyle Project, I'm totally flexible but this time I can't find a way to access the "action" button inside the CDs. I should see the action button in my ui5 project and clicking this button should run "CDs Behavior Implementation Class" in the backend.

I checked the link Andre suggested (Create a UI Using Freestyle SAPUI5 | Tutorials for SAP Developers). Unfortunately, this resource is all about CAP (Cloud Application Programming model), in short, it's not about RAP (ABAP Restful Application Programming Model).

If you use CAP, you have to choose Java or Node.js Programming, we prefer RAP because we use ABAP code and we want to use it. Unfortunately, ABAP code cannot be used with CAP.

Kind Regards

Orhan

former_member820465
Participant
0 Kudos

Hello Andre,

The main purpose of accessing RAP via SAPUI5 should be to access and manage CDS Behavior Implementation Classes in RAP, right?

But unfortunately this cannot be done, or I could not find a way. Do you know about this?

Thank you very much.

Kind regards

Orhan

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Orhan,

what you are looking for is probably a so called freestyle SAPUI5 application.

Do you know this tutorial?

Create a UI Using Freestyle SAPUI5 | Tutorials for SAP Developers

Kind regards,

Andre

former_member820465
Participant
0 Kudos

Hello Andre,

Thank you very much for your reply.

Yes, what I'm looking for is definitely a freestyle SAPUI5 application.

But my problem is with both RAP and (SAP Business Application Studio - SAPUi5).

We can make Fiori applications very easily with RAP in your teachings. I have implemented all of these. It's running well.

Fiori applications contain about 6 different "Floorplan". In other words, we can say 6 different templates or templates. But I don't need these templates in my UI part. We have a Business Logic (Unmanaged Scenario) of our own in the project we have done, and also a Fiori UI does not appeal to us (for this project) as we have a UI-Design of our own.

We want to design the front end with XML and Javascript codes (SAP Business Application Studio - SAPUi5). However, I'm running into a problem and I can't find any resources about it anywhere.

Problem: I can't find how to access our RAP project (Behavior Implementation Class in RAP) that we have created via SAP BAS SAPUI5, for example, when clicking a button.

Normally I can access my oData data. But how do I access the Behavior Implementation Class in RAP?

Fiori templates are not always a suitable choice for users. In some projects we want to use our own User Interface to be more flexible. You have already shown that we can normally access our RAP project (Backend - Behavior Implementation Class in RAP) with Fiori Templates. For example, with an "action"-button on Fiori, we can easily access the Behavior Implementation Class in RAP in the backend. But when we want to do it with SAPUI5 instead of Fiori, how do we do it?

In summary: How can we reach backend (Behavior Implementation Class in RAP and RAP) via frontend (SAP BAS-SAPUI5 part) (not Fiori - with SAP UI5). Unfortunately, this is not available in either RAP training or SAPUI5 training.

Thank you in advance for your reply.

Orhan

former_member820465
Participant
0 Kudos

Hello Andre,

I checked the link you suggested. Unfortunately, this resource is all about CAP (Cloud Application Programming model), in short, it is not about RAP (ABAP Restful Application Programming Model).

I'm still researching this issue. Unfortunately I haven't been able to find anything yet.

Kind regards

Orhan