cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass initialization parameters from an SAPUI5 application to an OData service

pietrom_
Explorer
0 Kudos

Hello experts,

I have made an SAPUI5 application that uses an ABAP OData service in order to performs some action over a set of tasks. This set is determined by the user that is currently logged in, i.e. the sy-uname.

Now I want that that application will be initialized with an arbitrary user, known to the SAPUI5 application when it starts.

I want to launch the UI5 app with a parameter PersonnelNumber=xxxxxxx and I want that parameter to be passed with every request made to the OData service in order to make the OData service work with the chosen PersonnelNumber.

I've seen that I could use serviceUrlParams like this:

var oModel =new sap.ui.model.odata.v2.ODataModel({ 
    serviceUrl:"http://services.odata.org/Northwind/Northwind.svc",    
    serviceUrlParams:{
        PersonnelNumber:"27161617"}}); 

https://sapui5.hana.ondemand.com/#docs/guide/6c47b2b39db9404582994070ec3d57a2.html

But I don't know how to get that number in the ABAP OData service.

Can someone kindly help me?

Thank you.

Pietro

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
Active Contributor
0 Kudos

check if this one helps

IO_TECH_REQUEST_CONTEXT->GET_SEARCH_STRING

SergioG_TX
Active Contributor
0 Kudos

your odata service may be able to receive parameters via filtering on the query string such as:

../service?$filter=COLUMN eq 'value'

please check out the odata filtering syntax for other operations

let us know if this helps you