Skip to main content
SAPUI5

Dev Tip: Create a Google Maps link in SAPUI5

DF Dan Flesher
2 min read
Dev Tip: Create a Google Maps link in SAPUI5
In case you’ve missed our dev tips in past weeks, we will be posting them in the blog moving forward. To sign up and get your dev tips delivered to your inbox each week, click here!

Tip of the Week

Create a Google Maps link in SAPUI5

With UI5 applications being accessed by web on computers, laptops, and tablets, one easy feature to implement that helps take advantage of the benefits of being web-enabled is to create links from addresses. You can also create links from phone numbers and emails, making it easier to contact people from UI5 applications than with traditional GUI screens.

It turns out, creating a link to Google Maps is quite easy. Take a look at the code snippet below.

That’s all it takes! On line 7 we specify a “Link” in our view. The “text” property will control the link text that’s displayed in the app. The “href” property is the URL we want to go to. For Google Maps searches, the pattern is “https://maps.google.com/?q=<term>” where <term> represents your search term. This could be an address, or in our example, a building name. The “target” property being set to “_blank” opens the link in a new tab. Below we see our app, and the Google Maps window we opened.

For more on links, check out the API reference documents, and help make your UI5 apps actionable!

https://sapui5.hana.ondemand.com/#/api/sap.m.Link

 

If you have an interest in viewing similar content, visit our blog, here

View our LinkedIn, here

Related posts