Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
mariusobert
Developer Advocate
Developer Advocate
In the past two years, I wrote a few posts that explained the nature of the managed approuter and when it can be helpful to use this feature (here and here). In parallel, we created a GitHub repository that contains sample projects and diagrams to make the differences between both options more tangible. Overall, there's a lot of content that explains why it makes sense to favor the managed over the standalone approuter. (I highly recommend that you make yourself familiar with the linked resources above if you don't know them yet). Once you read the content, you have a good understanding of the managed approuter's advantages. And with this, it makes sense that the managed option is the default setup for newly generated SAP Fiori apps in the SAP Business Application Studio.

Update: August 2021: Added a new question Q9

But, naturally, many developers are new to SAP Business Application Studio and SAP BTP, which can cause confusion about the standalone approuter (as they only know the managed approuter). For those developers, I compiled this short FAQ to help them understand the differences when you come "from the other direction":


How to pick the right option?


Q1: Is the managed approuter a service in SAP BTP?

No, the managed approuter is not a service. It is a feature of various SaaS subscriptions that SAP provides in SAP BTP. Both the SAP Launchpad service and the SAP Cloud Portal service come with that feature. This is why you don’t find the managed approuter in the Discovery Center.

Q2: Why don't I see my app in the Cloud Foundry space?

A: Cloud Foundry spaces only contain applications that consume runtime memory. HTML5 applications won't show up here as they are a set of static content files (.html, .js, .css) that are run by the browser. In SAP BTP, HTML5 Applications are stored in HTML5 Application Repository service. During runtime, HTML5 Application files are served to the browser by the managed or standalone approuter.

If you have a standalone approuter, you will see it in the space, unlike the HTML5 Applications hosted in HTML5 Application Repository. These applications can be visualized using HTML5 Applications UI (in the SAP BTP Cockpit) or via cf html5-list.

Q3: I used the default option (managed approuter) when I created the SAP Fiori app, and I could deploy it. But now I get the following error "Error No client with requested id". (or here)

A: This most likely means you didn't subscribe to the correct subscription service. As mentioned above, here are two services: The SAP Launchpad Service and the SAP Cloud Portal service, both of which should work for what you want to do. Make sure you are subscribed to these subscriptions. Depending on your account, you might also see service instances with these names. Please don't use service instances for this; they won't help you here!

The URL of the managed approuter contains either cpp (pointing to the SAP Cloud Portal service) or launchpad(pointing to the SAP Launchpad service). Both segments are substitutable, but you need to verify to use the segment of your enabled subscription. 

Q4: Can I change the URL of the managed approuter?

A: Th default URL is determined by the subscription service and your subaccount subdomain. But you can change the URL in production accounts via the custom domain service. 

Q5: When using the managed approuter, should I use subaccount- or instance-level destinations?

A: Instance-level destinations should be used from now on forward as they avoid subaccount-wide access and enable better mta lifecycle handling. Note that when undeploying with instance-level destination, the destination configurations get deleted as well, unlike subaccounts destinations.

Q6: I neither want to use the SAP Launchpad Service nor the SAP Cloud Portal service. Can I use the mana...

A: You can subscribe to these products just to get managed approuter functionality (no need to model launchpad tiles, etc.); just run the applications from HTML5 Application UI. We recommend using a standalone approuter only if you need to implement approuter extensibility for some special use cases.

Q7: How can I build an SAP Fiori app that leverages the standalone approuter?

A: The SAP Business Application Studio offers a shortcut for the default option that uses the managed approuter. Look at this video which explains the longer flow (create empty MTA, add managed approuter, add Fiori app). Follow this flow but select the "standalone" approuter when prompted. I also added a few screenshots below that you can follow to see all the needed steps.

Q8: Can I change the URL of the standalone approuter?

A: Yes. The default URL can be customized via the "host" property of the mta.yaml file. The *.cfapps.eu10.hana.ondemand.com-suffix is usually given, but you can change this as well with a custom domain

Q9: Can I use the approuter to host web apps that provide UI5 flexibility features?

Yes, this is possible with both options. If you use the standalone approuter, you need to integrate it with a key-user service instance and make some configuration changes. In case you go with the managed approuter, you don't need to integrate this service. It's worth mentioning that this option currently doesn't allow key-user changes. Other features of the UI5 flexibility service such as custom filter variants will work out of the box with the managed approuter if you embed the application in an SAP Fiori Launchpad.

Q10: I want to built an application that can handle multiple tenants. Which approuter option should I choose?

As of September 2021, MTX apps are not supported by the managed approuter. Therefore, you should go with the standalone approuter in this case.

Attachment to question 7:



Create an empty MTA project.



Create a module from template.



Select "Approuter Configuration".



Make sure to answer these questions with a yes.



Add any web app and in the last step of the wizard, make sure to include it in the MTA project and add the deployment configuration.


Now you are ready to build and deploy the project with the standalone approuter.
65 Comments
martinstenzig
Contributor
0 Kudos
Marius,

you mentioned Portal and Launchpad. Does this also work with the SAP Workzone for HR subscription?

Hi Martin, SAP WorkZone for HR only offers limited  usage for HR Szenarios. It has to be setup the same way like other Editions of WorkZone or Launchpad.

https://help.sap.com/viewer/b03c84105ff74f809631e494bd612e83/Cloud/en-US/edc62f97f50a432bb8dba046266...

mariusobert
Developer Advocate
Developer Advocate
What Sissy says 🙂
MustafaBensan
Active Contributor
Hi Marius,

You have mentioned the recommendation of "using a standalone approuter only if you need to implement approuter extensibility for some special use cases."  Do you have any further advice or clarification on approuter choice in the case of multi-tenant web app development?

Thanks,

Mustafa.
mariusobert
Developer Advocate
Developer Advocate
Hi Mustafa,

Good point! As of now, I'd say that multi-tenancy requirements are also a legit use case for a standalone approuter.
manuel_seeger
Explorer
0 Kudos

Hello Marius,

Can we still configure the managed approuter with environmental variables, for example to send custom headers?

https://www.npmjs.com/package/@sap/approuter#additional-headers-configuration

Best regards,

Manuel

mariusobert
Developer Advocate
Developer Advocate
0 Kudos
Hi Manuel,

yes and no. It is not possible to change the environment variables for the managed approuter BUT you can make use of all properties of the xs-app.json configuration file:

responseHeaders property


With the custom response header property, you can add headers, which the application router returns to the client in its responses.
The property is an array of objects, each object having the following properties:























Property Type Optional Description
name String response header name
value String response header value

Example:

{ "responseHeaders" : [
{"name": "header1", "value": "value1"},
{"name": "header2", "value": "value2"}
]
}

poornamamatha
Participant
0 Kudos
 

Hello Marius,

The blog was very useful and informative related to Application router Feature in BAS (IDE).

I had created an MTA Project , the project structure is


and then Deployed the Application to CF Space. while logging in to CF in terminal through Commands.

I am able to get Application URL but unable to open the App when opened the URL showing "Not Found".

 



 

The App is working fine Business Application Studio but after deploying the Standalone App to CF Space the application is getting Visible in my Dev Space but when clicking on the generated URL it is showing the Not Found Error.

Could you please help me out with this issue.

Thanks in Advance.

Regards,

Mamatha M
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
Hi Mamatha,

It seems like a route points to a target but the approuter cannot find anything there. This could either mean the route points to the wrong target or that the target is right but empty.

Here are a few questions that might guide you to the solution:

Where does this route point to?

Is there something at the target (either in the local directory or in the HTML5 app repo)?

Does the log of the approuter provide any additional information?
0 Kudos

Here there is no target i.e.., no destinations I have taken a sample App with static Data, created app with standalone appRouter and deployed it to Cloud Foundry Space there after deployment I can get the App is started and App URL but when I am opened it is getting either "Not found" or "Internal server error" .

I tried with managed approuter, deployed the app to CF space, app getting started  but still same I am getting like shown below

I have sample Static data in my application which runs fine in BAS but when I deploy the same app and after clicking on the generated URL it is showing error.

please let me know where I am getting wrong do we need to add any piece of code in package.json, xs-app.json, ui5.yaml files to get the app to be displayed. In Xs-app.json file given

"welcomeFile": "index.html" .
Regards,
Mamatha M

 

aracelychavez
Participant
0 Kudos
Hi Mamatha, same happened to me, you need to check the file xs-app.json inside the approuter directory and be sure there is a destination, I had to add it manually, try something like this:
{
"authenticationMethod": "route",
"routes": [
{
"source": "(.*)",
"target": "$1",
"destination": "your-destination"
}
]
}

Hope it helps.

ara
poornamamatha
Participant

Hi Ara,

Thanks for quick reply, Actually I don't have any destination as I am doing without destination static data but I will try now adding destination and will let you know.

Thank you

Mamatha

mariusobert
Developer Advocate
Developer Advocate
0 Kudos
So you added your web app manually and did not follow the wizard to add it, right?

This would explain why the connection between the approuter and the HTML5 application repository isn't working.

Can you execute "cf html5-list" from the terminal to see whether the web app has been uploaded to the HTML5 application repo?

The next step, would then be to change the xs-app of the standalone approuter to point to this web app like shown here.
poornamamatha
Participant
0 Kudos
No I didn't add webapp Manually I followed the wizard process only while creating the Application. If I execute the "cf html5-list" the application is successfully uploaded to HTML Application repo. But I am unable to get the Application Displayed and I tried with taking destination while connecting to Odata Service if I tried to deploy in CF Space it is showing

"For application 'Demo': Routes cannot be mapped to destinations in different spaces"

in terminal while I try to push the App to CF.

 

 
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
I would assume that something is wrong with your destination. Can you confirm that the destination that you referenced in the xsapp exists in your target space?
poornamamatha
Participant
0 Kudos
No Actually I didn't taken any Destination at first I have taken sample UI5 App without any Destination only with static Data to load UI. Later I tried with Northwind.

With Destination xs-app file code


but still same problem persists.

WIthout Destination xs-app.json file


Now needed without destination just UI to load in the App. Have deployed the app to CF Space, the generated URL is not getting opened showing some errors like follows:

"Not Found", "Internal Server error" or "Requested route does not exists"

Either By taking MTA or Freestyle SAP UI5 Template getting same issue, URL is not getting opened.

Suggest me where I goes wrong.

Thanks in Advance

 
arjun_thakur
Active Contributor
0 Kudos
Hi Marius,

Is it possible to change approuter config from managed to standalone? If yes, can you pls guide how it can be done?

Regards,

Arjun
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
Hi Arjun,

are you asking for a "wizard" option to change the selection that has been made previously? The answer to this question would be no, it's not possible.

But you can remove the files of the standalone approuter and then add a managed approuter manually (and vice-versa). That works.
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
You use destinations in both cases. The upper file uses a "northwind" destination and the lower one uses a "ui5" destination.

If you use any type of destination, you need to (a) create a destination service instance, (b) bind it, and (c) add the destination configuration (this tutorial might help you).
poornamamatha
Participant
0 Kudos
if we use the UI5 as destination we wont take any service right so we couldn't bind anything. what is the use of creating the destination service instance, after creating the Destination service instance, what is the next process.

I followed the same what was given in tutorial. I am able to access the Entitysets and able to bind. But after deploying the App to CF. The Application generated Routes URL doesn't work. This is the main issue I am facing.
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
I think you might have missed a step in the wizard or in the instructions. I can confirm that the scenario works as I described it above.

Please mind the captions of the screenshots above.
poornamamatha
Participant
0 Kudos
Thank you. I will follow like you described above.

 
arjun_thakur
Active Contributor
0 Kudos
Hi Marius,

Thanks for your response.

Incase I want to change approuter configuration from Managed to Standalone, which files should I be deleting, as I don't see any files related to approuter in case of managed. Please advise.

Regards,

Arjun
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
In this case you need to remove some lines of the mta.yaml. You can find a list of the respective lines in this post (in section 'Make your web apps “serverless”')
0 Kudos
Hi Mamatha

I have the same problem ,

Did I find the solution?

 

Thank you

Diego
eamarce23
Participant
0 Kudos
Hi Marius,

Thank you for the blog post and the valuable information about the Managed App router!

Could you please tell a bit about the support of the Managed App Router for Single Sign-On scenarios?

Thanks a lot in advance!

mariusobert
Developer Advocate
Developer Advocate
0 Kudos
Hi Edgar,

SSO is not a feature of the approuter per se (that depends on the IdP), so it doesn't differentiate from the standalone approuter.
Kaustubhd
Explorer
0 Kudos

Hi Marius,

We have a development scenario where we have a SAP Cloud Freestyle Portal with Ui5 applications in the Cloud Foundry Environment.

As per functionality we have to use Assertion attributes passed by Custom IDP in the ui5 applications. We have achieved this by using Standalone Approuter with User Api service and Jwt decode.

https://www.npmjs.com/package/@sap/approuter#user-api-service

https://blogs.sap.com/2020/07/24/mapping-of-saml-attributes-with-xsuaa-jwt-in-cloud-foundry/

The issue with this approach is that this is causing issues at Portal level with Custom Themes and Cross- Navigation between apps as the ui5 apps have to be deployed as Iframe objects with Dynamic URL configuration on the Portal.

We did not use Managed approuter approach as the Ui5 app did not have access to the approuter which resulted in us not getting access to assertion attributes.

Is there a way to get assertion attributes at app level using Managed Approuter?

Regards,
Kaustubh

mariusobert
Developer Advocate
Developer Advocate
0 Kudos
That's a good question. But I need to confess that I'm totally blank on this topic. I did ask a colleague and this is the response that I got:
Last week another customer asked the same.

My recommendation is to add an additional (e.g.: /user/assertions) endpoint in their backend application that is accessed via a destination with property HTML5.ForwardAuthToken = true. This endpoint would decode the forwarded token and return the assertions. Then their html5 application can call the /user/assertions endpoint via an xs-app.json route.

 

I hope this helps (as this is the only answer I can provide). But it'd be great if anyone else from the community could jump in here.
xudonny
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello Marius,

Is it possible to let Managed Approuter be the router(or proxy server) for micro-services deployed in BTP CF(like the services developed with CAP)?

Thanks & Best Regards,

Donny
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
Nice idea 🙂
Yes, that should be possible! But you need to have a (dummy) web app that contains a xs-app.json file and this file needs to reference destinations that point to your microservices.
Winklbauern
Explorer
0 Kudos
Hello Marius,

first time a nice blog and thanks for sharing!!

I have the following problem, I use the SAP-Approuter and my request to the backend is greater than 30 seconds, normally these settings are set in the destinations for the Approuter, but since this does not exist, I currently can not find a setting how I can override the attribute "timeout". Do you know a way to do this?

Thanks & Best Regards

 
mariusobert
Developer Advocate
Developer Advocate
Hi Niklas,

thanks.

Have you tried to use the destination property "timeout" (mentioned in section "environment destinations")? I haven't used this particular one but I would assume that it does the job.

If that doesn't help, you might fall in the "customization" category where you need to use the standalone approuter.
Winklbauern
Explorer
Hello Marius,

thank you for your Help.

I have solved my problem by adding the "timeout" in the mta.yaml in the subsection of my cap-service.

Best Regards

 
0 Kudos
Hello Marius,

How to run HTML 5 module with Stand alone App router locally from Business Application Studio

Regards

 

 

 

 

 
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
You usually don't run the standalone approuter in the SAP Business Application Studio but you use the Fiori Tools that start a development server that exposes the static content. The appserver is usually only run when the project is deployed.

 

That doesn't mean you cannot run the approuter as well. But in this case, you need to take care of mapping the right values in the default-env.json.
kammaje_cis
Active Contributor
0 Kudos
Hi Marius, In case our API requires an API key, we NEED a standalone approuter to set it to all API calls. Is it the right understanding?
mariusobert
Developer Advocate
Developer Advocate
Hi Krishna,

Yes.

Having said that, it is probably possible to solve that API-key-problem with SAP API Management and then you'll be able to use the managed approuter as well.
osamu_tamaki
Explorer
0 Kudos

Hi Marius,

Thanks for your good blog!

I have two questions about scalability of managed application router.

Question1:

As you know, in the case of standalone application router, it can be scaled out using autoscaler.

Can managed application router be scaled-out?

if possible, how can I do it?

 

Question2:
How can I monitor the managed application router?

Just in the case we have a performance issue, we should have the way that we can check if the standalone application router is root cause of the performance issue or not in the production system.

 

Thanks!

 

mariusobert
Developer Advocate
Developer Advocate
Hi Osamu

A1: That's the cool thing about the managed approuter. It's managed for you and you don't need to care about scaling 🙂

A2: You can use the CF CLI (or other tools) to check on the resource consumption of the standalone approuter. Or are you looking for something else?

 

Regards,

Marius
osamu_tamaki
Explorer

Thanks! Marius.

Question 2 is the question about how to check the resource consumption for the MANAGED approuter, not the STANDALONE approuter.(Sorry, It seems that I wrote "standalone" in the question2....It was my mistake..) But thanks to the A1 I could understand monitoring the managed approuter is not needed, because the managed approuter is perfectly managed like any other BTP CF services.

Here again, thanks, Marius!

Osamu

timole
Explorer
0 Kudos

Hi Marius,

We need to switch from the SAP Cloud Portal Service to SAP Launchpad Service soon.

At the moment we use standalone approuters for our apps. We need access to shell functions such as CrossApplicationNavigation and therefore integrate the apps into our launchpad via a destination to the approuter and the component name of an app. To do this, we need an FLP module for the standalone approuter, which is no longer available with the SAP Launchpad service.

We thought about to switch to managed approuter but first wanted to check if it´s still possible with our current solution. Is there a similar or even better option in the SAP Launchpad Service?

Regards

Timo

mariusobert
Developer Advocate
Developer Advocate
0 Kudos
Hi Timo,

 

I don't see why it shouldn't work but I should also say that I haven't tried this before.
timole
Explorer
0 Kudos

Hi Marius,

the problem is, that we don´t have the SAP Cloud Portal Service in the subaccount in the future. Our current solution uses, as said above, the FLP module for the standalone approuter. The flp module uses a service that is an instance of the portal service. The SAP Launchpad Service is just a subscription, therefore we can´t create the instance needed for the flp module.

Is there another way to integrate apps, that running with standalone approuter, in the launchpad with access to shell functions (CrossApplicationNavigation)?

Fyi: Other solutions like direct integration via URL or dynamic URL didn´t work unfortunately. At the moment the possibility to expose the standalone approuter as content provider via provisioning service is not an option.

mariusobert
Developer Advocate
Developer Advocate
0 Kudos
You should use a subscription, according to the way I understand it. The service instance (aka the launchpad module) was only a temporary solution and not intended for production use-cases.
timole
Explorer
0 Kudos
Yes we use the subscription of both, the SAP Cloud Portal Service (past) and the SAP Launchpad Service (now) as central Launchpad for the apps. The service instance was just the "enabler" to integrate the apps in the launchpad (subscription of the services) by using the Standalone AppRouter to provide them.
mariusobert
Developer Advocate
Developer Advocate
I see. I'm afraid I'm (as of now) not aware of another service instance that can take over the role of this "enabler" for you.

Sorry
Shashank
Advisor
Advisor
0 Kudos
Hi Marius,
I've created a Freestyle Fiori app which is using a managed app router. I am using a destination to connect this app to an iFlow developed in CPI. While I am able to invoke this destination just fine while running the application locally from within BAS, once I deployed this application to CF, I'm always getting a 401 while triggering this destination. Since the destination is working fine locally and also from postman using the same credentials I am able to reach the CPI iFlow, I do not think if auth credentials have something to do here. Can you advise what might be the problem here?
mariusobert
Developer Advocate
Developer Advocate
0 Kudos
Not sure what might cause this. Maybe it helps if you try to run this in a standalone approuter to see if it works then?
mariusobert Hi Marius,

I have created Fiori App using Managed app-router. Please let me know how to access logged in user detail from cloud foundry using managed app router.

Regards

Divye