Skip to Content

SAPUI5 and NW Portal

I have an SAPUI5 application deployd on my portal.
I am trying get the user login logged on portal in my SAPUI5.

But when I run my application it is not get any data.

Bellow is my code

#controller

sap.ui.define([ 'jquery.sap.global', 'sap/ui/core/Fragment', 'sap/ui/core/mvc/Controller', 'sap/ui/model/Filter', 'sap/ui/model/json/JSONModel' ], function(jQuery, Fragment, Controller, Filter, JSONModel) { "use strict"; var CController = Controller.extend("sap.m.ZHRUI001.C", { inputId: '', valueHelpRequest: function(oController) { this.inputId = oController.oSource.sId; var sServiceUrl = "“http://<my server host>:<my server port>/sap/bc/ui2/start_up";
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true, "username", "password"); var oJsonModel = new sap.ui.model.json.JSONModel(); oModel.read("/?", null, null, true, function(oData, response) { oJsonModel.setData(oData); }); sap.ui.getCore().setModel(oJsonModel); // Handling of both confirm and cancel; clear the filter var that = this; var handleClose = function(oEvent) { var oSelectedItem = oEvent.getParameter("selectedItem"); if (oSelectedItem) { that.byId(that.inputId).setValue(oSelectedItem.getTitle()); } oEvent.getSource().getBinding("items").filter([]); }; // Create a SelectDialog and display it; bind to the same // model as for the suggested items if (!this._valueHelpSelectDialog) { this._valueHelpSelectDialog = new sap.m.SelectDialog("valueHelpSelectDialog", { title: "{fullName}", items: { path: "", template: new sap.m.StandardListItem({ title: "{fullName}", active: true }) }, search: function(oEvent) { var sValue = oEvent.getParameter("value"); var oFilter = new sap.ui.model.Filter( "name", sap.ui.model.FilterOperator.Contains, sValue ); oEvent.getSource().getBinding("items").filter([oFilter]); }, confirm: handleClose, cancel: handleClose }); this._valueHelpSelectDialog.setModel(oJsonModel); } else { this._valueHelpSelectDialog.setModel(oJsonModel); } this._valueHelpSelectDialog.open(); } }); return CController; });
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 05, 2017 at 08:03 AM

    Hi Rubens,

    Can you check this blog for getting the logged-in user details.

    Regards

    Arun

    Add comment
    10|10000 characters needed characters exceeded