Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 07, 2017 at 06:51 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 07, 2017 at 07:36 PM

    check if this one helps

    IO_TECH_REQUEST_CONTEXT->GET_SEARCH_STRING

    Add comment
    10|10000 characters needed characters exceeded