Skip to Content
Author's profile photo Narashimman K S

How to open a report on SAPBI App and on Browser with single URL

Hello Everyone,

There will be situations where we would like to hyperlink to a report from an email or pdf. In case if your users use both mobile app as well as browsers,

you need to make sure you put both these links in all your communications to make it easy for the user.

Here is a simple method to overcome the issue with a single URL for both mobile and laptop/desktop. When the user clicks on the link depending on the device the URL is accessed from he/she is redirected appropriately.

Developed the script in simple asp format(on IIS server of course), but with this logic you should be able to develop script in any language of your choice.

Replace the following with your server details.




Example URL with Parameters:



Save the below code in an asp file and host is on an IIS server after replacing the text as mentioned above.


Option Explicit

Dim user_agent, mobile_browser, Regex, match, mobile_agents, mobile_ua, i, size

Dim report_cuid

Dim report_type

Dim viewSetId

Dim url_mobile_redirect

Dim url_pc_redir

report_cuid = Request.QueryString(“report_cuid”)

report_type =Request.QueryString(“report_type”)

viewSetId =Request.QueryString(“viewSetId”)

user_agent = Request.ServerVariables(“HTTP_USER_AGENT”)

url_mobile_redirect =”sapbi://OpenDoc/?authType=secEnterprise&connection_name=<<YOUR_CONNECTIONNAME>>&server_url=http://<<YOUR_SERVER>>:<<YOUR_PORT>>&ConnectionType=BOEConnection&cms=<<YOUR_CMS>>&type=”&report_type&”&iDocID=”& URLDecode(report_cuid)

If report_type=”album” Then

  url_pc_redir =”http://<<YOUR_SERVER>>:<<YOUR_PORT>>/explorer/index.jsp?application=portal&viewSetId=”& viewSetId

  url_mobile_redirect=url_mobile_redirect&”&explorerID=”& URLDecode(viewSetId)


  url_pc_redir =”http://<<YOUR_SERVER>>:<<YOUR_PORT>>/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=”&report_cuid


mobile_browser = 0

Set Regex = New RegExp

With Regex

   .Pattern = “(up.browser||mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm)”

   .IgnoreCase = True

   .Global = True

End With

match = Regex.Test(user_agent)

If match Then mobile_browser = mobile_browser+1

If InStr(Request.ServerVariables(“HTTP_ACCEPT”), “application/vnd.wap.xhtml+xml”) Or Not IsEmpty(Request.ServerVariables(“HTTP_X_PROFILE”)) Or Not IsEmpty(Request.ServerVariables(“HTTP_PROFILE”)) Then

   mobile_browser = mobile_browser+1

end If

mobile_agents = Array(“w3c “, “acs-“, “alav”, “alca”, “amoi”, “audi”, “avan”, “benq”, “bird”, “blac”, “blaz”, “brew”, “cell”, “cldc”, “cmd-“, “dang”, “doco”, “eric”, “hipt”, “inno”, “ipaq”, “java”, “jigs”, “kddi”, “keji”, “leno”, “lg-c”, “lg-d”, “lg-g”, “lge-“, “maui”, “maxo”, “midp”, “mits”, “mmef”, “mobi”, “mot-“, “moto”, “mwbp”, “nec-“, “newt”, “noki”, “oper”, “palm”, “pana”, “pant”, “phil”, “play”, “port”, “prox”, “qwap”, “sage”, “sams”, “sany”, “sch-“, “sec-“, “send”, “seri”, “sgh-“, “shar”, “sie-“, “siem”, “smal”, “smar”, “sony”, “sph-“, “symb”, “t-mo”, “teli”, “tim-“, “tosh”, “tsm-“, “upg1”, “upsi”, “vk-v”, “voda”, “wap-“, “wapa”, “wapi”, “wapp”, “wapr”, “webc”, “winw”, “winw”, “xda”, “xda-“)

size = Ubound(mobile_agents)

mobile_ua = LCase(Left(user_agent, 4))

For i=0 To size

   If mobile_agents(i) = mobile_ua Then

      mobile_browser = mobile_browser+1

      Exit For

   End If


If mobile_browser>0 Then

    ‘This means that the link was accessed from a mobile device

            Response.redirect(url_mobile_redirect )


   ‘This means that the link was accessed from laptop/desktop


End If

Function URLDecode(sConvert)

          Dim aSplit

          Dim sOutput

          Dim I

              If IsNull(sConvert) Then

                      URLDecode = “”

                      Exit Function

              End If

    ‘ convert all pluses to spaces

         sOutput = REPLACE(sConvert, “+”, ” “)

    ‘ next convert %hexdigits to the character

         aSplit = Split(sOutput, “%”)

         If IsArray(aSplit) Then

                sOutput = aSplit(0)

                For I = 0 to UBound(aSplit) – 1

                  sOutput = sOutput & _

                    Chr(“&H” & Left(aSplit(i + 1), 2)) &_

                         Right(aSplit(i + 1), Len(aSplit(i + 1)) – 2)


         End If

    URLDecode = sOutput

End Function



Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.