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 comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 26 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 comment
    10|10000 characters needed characters exceeded

  • Jan 26 at 03:03 AM

    try to get 50546445 from url?

    Add comment
    10|10000 characters needed characters exceeded