cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 and SAP B1 Service Layer's Odata v4

Ondřej_Nekvinda
Participant
0 Kudos
1,964

Hello,

I would like to know if there is a possibility to connect SAPUI5 Apps directly to the Service Layer? We are looking for a solution deployable to HANA 1.0 On-Premise and in the future also to HANA 2

We were able to login and perform normal ajax requests, but it would be nice to be able to use OData v4 SAPUI5 models and smart controls with direct connection to the Service Layer’s OData v4.

Our problem with that is, so far, that we are unable to force the app to send SL session cookies together with it‘s http requests that are automatically generated after the OData model binding is done. In a simple ajax call we can force it to send the cookies via xhrFields: {"withCredentials": "true"} setting, but we haven‘t found any option to do that for the SAPUI5 odata v4 model and therefore we are always unauthorized.

Is there any solution to this issue? Preferably one that does not involve something like xsjs proxy, we would like to avoid deploying anything else on the HANA Server, except the SAPUI5 application.

Thank You,

Ondřej Nekvinda

Accepted Solutions (1)

Accepted Solutions (1)

former_member197733
Contributor
0 Kudos

- On Odata V2, you could specify custom headers upon the model creation.

- On Odata V4, this method isn't available. However, the documentation shows how to update the header of a model(see #changeHttpHeaders). You can use this approach to set the header 'Cookies' with the content provided by SL /Login response.

Overall this is quite ok if you just want to show B1 data on a HTML page, without any custom business logic (ui logic is fine).

That not being the case. I.e, you are building a solution that will communicate with SL, it should be better to revaluate your architecture decisions. Business Logic should not be placed on client side code (UI5/Javascript). So, the SL interactions are handled by the server (See here example with HANA 1.0).

Mathias_Uhlmann
Product and Topic Expert
Product and Topic Expert

Answers (2)

Answers (2)

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ondrej,

Last year we also prepared an exercise around SAPUI5 connecting directly to SL.

The main exercise document HandsOn_SCP_Instructions.pdf is connecting to API Hub but there is another document Connect with B1 Backend Instead of API HUB.pdf you can see the steps to connect with a SL destination instead.

Let me know if you have questions about it.

Regards,
Trinidad.

former_member260921
Participant
0 Kudos

Hi Trinidad,

Hope all is well with you.

I have the trial account, Web IDE and cloud platform andI tried to follow the instructions in HandsOn_SCP_Instructions.pdf carefully.

I got as far as page 17 and tried to run the app but it failled and showed these messages in the right corner.

Starting module "/mta_B1SL_Summit2018/mta-b1sl-summit2018-approuter".
Could not run module "/mta_B1SL_SUMMIT_2018F/mta-b1sl-summit-2018f-approuter".

Do you have any suggestions to get past this?

Thanks,

Mel Dodd

florian_polland
Newcomer
0 Kudos

Hello,

I am also interested in building an SAPUI5 App directly connected to B1 SL. The github Repository you're Documents are saved in doesn't exist any more. Are there any other resources you can recommend for this topic.

Thanks!

Regards

Florian

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ondrej,

SAPUI5 does support oData v4 since a bit more than a year now.

There is one template adapted to oData v4 called “SAP Fioi Worklist Application OData V4”. With this template you can see the SAPUI5 app connects automatically with B1 SL via API Hub or a SL destination. I tried it yesterday and I was able to easily create an application directly connecting to Service Layer.
WebIDE is still available as a direct link for trial accounts https://cockpit.hanatrial.ondemand.com/cockpit/#/home/trial and you can use it to generate your SAPUI5/Fiori applications and check how the SAPUI5 models and binding is done with SL oData v4.

Let me know if this helps you build your application against SL.

Regards,
Trinidad.