Skip to Content

SAPUI5 getting URI Parameters

Hi,

I am looking to capture URI parameters using my SAP UI5 application.

I am navigating to this URI
http://someurl.uk.incorg.net:8000/GDMI_N/0RPO/XSAPPS/CORE_KPI/index.html#/em_202_Long_Job_Exceptions/50546445

50546445 = payroll

I want to capture that payroll to then use in a query, how do I do this please?

Any help much appreciated!

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 26, 2018 at 06:00 AM

    Hi! If inside your app this hash (/em_202_Long_Job_Exceptions/50546445) defined as route, you can use attachRouteMatched of your Router.

    manifest.json

    ...
    "routes": [{
                "pattern": "em_202_Long_Job_Exceptions/{payroll}",
                "name": "jobExceptions",
                "target": "jobExceptions"
             }],
    "targets": {
                "jobExceptions": {
                   "viewName": "jobExceptions",
                   "viewLevel" : 1
                }
    ...
    

    jobExceptions.controller.js

    onInit: function () {
    		var oRouter = this.getRouter();
    		oRouter.getRoute("jobExceptions").attachMatched(this._onRouteMatched, this);
    	},
    
    _onRouteMatched : function (oEvent) {
    		var oArgs, oView;
    		oArgs = oEvent.getParameter("arguments");
                    var sPayroll = oArgs.payroll;   
    
                    //use your payroll;
    }


    Or you can use rough way (not recommended):

    var sPayroll = window.hasher.getHashAsArray()[1]; 
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 26, 2018 at 03:03 AM

    try to get 50546445 from url?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.