Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all 6178 articles
Browse latest View live

Get geolocation of position on SAPUI5 Googlemap ?


oData to JSON conversion - not working

$
0
0

Dear SCN,

I have tried many ways to convert oData (coming from HANA XS oData Service) in JSON format, to then save it in the application cache.

However, nothing has worked so far.

 

Below snippets of my code.

 

Please, could someone point me in the direction where it could be solved ?

 

IMPORTANT

. All the HANA XS oData part is Ok, working as expected when binding it directly to a table or chart.

. when data is created locally (see snippet 4) for placing it in the local cache, then everything works fine.

Problem is really the conversion from oData to JSON.

 

 

1. Trying via ajax code

var oModel = new sap.ui.model.json.JSONModel();

$.ajax({

  type: 'GET',       

  url : "http://172.20.152.94:8010/DevCCXSOne/Consultores.xsodata/?$format=json",

  dataType: 'json',

  success: function(data) {

  oModel.setData(data);

  }

});

 

// These last 4 lines are the same for all solutions

jQuery.sap.require("jquery.sap.storage");

var oStorage = jQuery.sap.storage(jQuery.sap.storage.Type.local);

var oBaseData = oModel.getData();

oStorage.put("BaseData", oBaseData);

 

 

2. Via URL

var oModel = new sap.ui.model.json.JSONModel("http://172.20.152.94:8010/DevCCXSOne/Consultores.xsodata/?$format=json");

oModel.setData(data);

 

jQuery.sap.require("jquery.sap.storage");

var oStorage = jQuery.sap.storage(jQuery.sap.storage.Type.local);

var oBaseData = oModel.getData();

oStorage.put("BaseData", oBaseData);

 

 

3. Via oData read function

var oModel = new sap.ui.model.odata.ODataModel(

  "http://172.20.152.94:8010/DevCCXSOne/Consultores.xsodata/",true);

var oBaseModel = new sap.ui.model.json.JSONModel();

oModel.read("/", null, null, true, function(oData, oResponse) {

  oBaseModel.setData(oData);

}, null);

 

jQuery.sap.require("jquery.sap.storage");

var oStorage = jQuery.sap.storage(jQuery.sap.storage.Type.local);

var oBaseData = oBaseModel.getData();

oStorage.put("BaseData", oBaseData);

 

 

4. Only this works (just for troubleshooting)

var data = {

  "PorBase" : [ {

  "BASE" : "A",

  "COUNTER" : "3"

  }, {

  "BASE" : "B",

  "COUNTER" : "7"

  } ]

};

var oModel = new sap.ui.model.json.JSONModel();

oModel.setData(data);

 

jQuery.sap.require("jquery.sap.storage");

var oStorage = jQuery.sap.storage(jQuery.sap.storage.Type.local);

var oBaseData = oModel.getData();

oStorage.put("BaseData", oBaseData);

 

 

Please, could someone tell me what is wrong that none of the attempts works ?

Thank you.

Regards

How to deploy a Hybrid Mobile App from Web IDE to SAP Fiori Client

$
0
0

Hi all,
basically i want to do what is in the title. Deploy a Hybrid mobile App from Web IDE to SAP Fiori Client.
My purpose is having the customer this app to his mobile phone or PDA and scan products with Kapsel BarCode.

 

Sould i follow this path of deploying it to SAP Fiori Client? Or there is an easier way for having the customer the Hybrid app to his mobile phone?

 

Thanks in advance,
Konstantinos Vogiatzakis

Why use www.w3.org/1999/xhtml in the namespace?

sapui5 List SearchField not working

$
0
0

Hi All,

 

I have a splitApp control in my sapui5 application. I am trying to search the list in master page.

 

Inside Controller

------------------------

 

 

PR_Search: function(oEvent)

{

 

  

      var tpmla = oEvent.getParameter("newValue");    

     var filters = new Array();

     var oFilter = new sap.ui.model.Filter("PoNumber",sap.ui.model.FilterOperator.Contains, tpmla);

      filters.push(oFilter);

 

     //get list created in view

     this.oList =sap.ui.getCore().byId("polist");

     this.oList.getBinding("items").filter(filters);

    },

 

 

 

Inside  view

------------------

 

 

new sap.m.SearchField(


{


placeholder: "Search",


showRefreshButton: true,


liveChange : oController.PR_Search,


search: oController.PR_Search,


tooltip: "Search for objects..",


    })

 

 

 

var po_list  = new sap.m.List("polist",{

 

inset : false,

 

});

 

 

po_list.bindItems({


path : "/HeaderSet",


template : V_List_itemtemplate,


});

 

I have implemented the code. But the search is not working. Please help in resolving this issue.

 

Thanks,

Divya

How to navigate one page to another page?what is component.js file in brief?

$
0
0

Hi Experts,

 

Please let me know how to navigate one view to another view?

And what is advantage of component.js file ?

It is possible to run my application without component.js file?ib detail?

 

Thanks & Regards,

 

Gowrishankar.

Tool bar CSS properties in XML View

$
0
0

Hi All,

 

I have created the XML view and used the Toolbar for the custom header. I would like to apply the custom css properties for the Toolbar and not able to do it.

 

I found <Toolbar design="Info"  > in the SAPUI5 sdk but do we have any different options for different colours in Toolbar design? , Can you please help me where to find out the all properties related to XML .

 

Thanks for your help in advance.

Connecting to SAP HANA cloud database

$
0
0

Hi Team,

 

Am trying to connect to SAP HANA cloud database using SAP HANA. Am getting this error while executing and i can see this error only when i press F12 in the google chrome browser

 

"

GET https://s8hanaxs.hanatrial.ondemand.com/p1941669224trial/hanainstan/helloworld/dummy.xsodata/sampletable/$count 500 (Internal Server Error)o.defaultHttpClient.request @ datajs.js:17E2 @ datajs.js:17o.request @ datajs.js:17h._request @ ODataModel.js:6c._getLength @ ODataListBinding.js:6c.resetData @ ODataListBinding.js:6L.extend.constructor @ ODataListBinding.js:6h.bindList @ ODataModel.js:6g._bindAggregation @ sap-ui-core.js:152T._bindAggregation @ Table.js:6g.bindAggregation @ sap-ui-core.js:152b.bindRows @ TreeTable.js:6(anonymous function) @ index1.html?_=Mon Nov 02 2015 12:57:14 GMT+0530 (India Standard Time):60

datajs.js:17


GET https://s8hanaxs.hanatrial.ondemand.com/p1941669224trial/hanainstan/helloworld/dummy.xsodata/sampletable?$skip=3&$top=107&$inlinecount=allpages 500 (Internal Server Error)o.defaultHttpClient.request @ datajs.js:17E2 @ datajs.js:17o.request @ datajs.js:17h._request @ ODataModel.js:6l @ ODataModel.js:6h._loadData @ ODataModel.js:6c.loadData @ ODataListBinding.js:6c.getContexts @ ODataListBinding.js:6T._createRows @ Table.js:6T.render @ TableRenderer.js:6R.renderControl @ sap-ui-core.js:152(anonymous function) @ sap-ui-core.js:152M.render @ MatrixLayoutRenderer.js:6R.renderControl @ sap-ui-core.js:152(anonymous function) @ sap-ui-core.js:152P.render @ PanelRenderer.js:6R.renderControl @ sap-ui-core.js:152R.render @ sap-ui-core.js:152U.rerender @ sap-ui-core.js:152k.renderPendingUIUpdates @ sap-ui-core.js:152k.init @ sap-ui-core.js:152k.handleLoad @ sap-ui-core.js:152(anonymous function) @ sap-ui-core.js:152l @ sap-ui-core.js:88S.finishTask @ sap-ui-core.js:88(anonymous function) @ sap-ui-core.js:152t @ sap-ui-core.js:71v.fireWith @ sap-ui-core.js:71Q.extend.ready @ sap-ui-core.js:71W @ sap-ui-core.js:71

sap-ui-core.js:88 2015-11-02 12:57:35 The following problem occurred: HTTP request failed500,Internal Server Error,{ "error": { "code": "", "message": { "lang": "en-US", "value": "Service exception: insufficient privilege."},"innererror":{"exception":"exception  1: no.71000258  (ptime\/query\/checker\/query_check.cc:2422)\n    Not authorized\nNO exception throw location recorded. Stack generation suppressed.\n"}}} -

"

in the output it shows " No Data"

 

Attached file has the sample code of files which are named after, which i have used to work on this complete process of display.

 

When i try to connect to SYS.DUMMY it works fine and shows value  as expected but it will not work.

 

Suggest how to display values which connects to SAP HANA database and pulls values.

 

 

Regards,

Pallavi.


refresh detail page in splitApp

$
0
0

Hi,

 

I have a split app with a master and a detail controller.  It works just fine on initial load and on the item click.

On the detail page there is a button which completes the notification.

Once the notification is complete it updates the model and the completed notifications are removed from the master list.

 

The master refreshes with the updated list. However the detail page still shows the old notification ( which is no more in the master list ).

There is a url parameter which displays the details of the selected notification. ( /EntitySet("<notifcation_no>")).

This notification_no is not getting updated in the url even if the model is updated.

I tried model.refresh it did not work. I also tried to call custom methods via subscribe and publish events between the master and controller and tried to rebind the context. However the model gets updated much later in the framework cycle.

I also tried to force navigate again to the same page.

None of the above works.

 

Please suggest if I am missing anything.

Thanks,

Veena.

SAPUI5 'create' method get error with a status of 403(Forbidden)

$
0
0

Hello everyone,

 

I'm coding an sapui5 application with odata in eclipse that contain ‘create’,'update','delete' method.

But when I post the request,it show me the error:Failed to load resource: the server responded with a status of 403 (Forbidden)

 

Here are my code:

 

var      requestObj= {
   requestUri: "",
   method: "",
   headers: {
   "X-Requested-With": "XMLHttpRequest",
   "Content-Type": "application/atom+xml",
   "DataServiceVersion": "2.0",
   "MaxDataServiceVersion": "2.0",
   "Accept": "application/atom+xml"
   }
   };
   var newData = {
   "odata.type": "ZSFLIGHT_DETAIL_SRV.sflight",
   "Mandt": $("#mandt").val(),"Carrid": $("#carrid").val(),"Connid": $("#connid").val(),"Fldate": $("#fldate").val(),
  
   };
    
  
  
   var url = "proxy/http/DEWDFLSSC5445.emea.global.corp.sap:8000/sap/opu/odata/SAP/ZSFLIGHT_DETAIL_SRV/sflightSet";
  
  
   var method = "POST";
  
   var user = "****";
   var password = "*****";
   requestObj.requestUri = url;
   requestObj.method = method;
   requestObj.data = newData;
   requestObj.user = user;
   requestObj.password = password;
  
  
   OData.request(requestObj,function(){
  
sap.ui.getCore().getModel().refresh();
        $("#formId").slideUp();
   });
  
  
  
   }

    }

How add another master-details view in fiori full screen template??

$
0
0

Hi Experts,

   

               I have a requirement to display two tables one in each view and when i click on arrow in a row(i.e onLineItemPressed)  it should navigate to next page and display remaining fields.

             So i have used Fiori Full Screen template in wbide to display one table  using master and details views,now i added another view(X) to display another table .I have created one more view(Y) so that remaining fields should display in that view upon clicking arrow.

        But when i click on arrow in 'X' view it is navigating to details view instead of 'Y' view.Please help me how to navigate from 'X' view to 'Y' view upon click arrow in table

SAP Web IDE: plugin name is not shown under Optional Plugins

$
0
0

Hi,

 

In my trial developer account I implemented 2 sample menu plugins

and deployed plugin repository to SAP HANA Cloud:

apps.JPG

 

I can see my plugin repository under Optional Plugins, but enabled plugins list is empty:

list.JPG

 

Can you assist please?

WebIDE Deployment Error

$
0
0

Hi

 

I am trying to deploy a change to a custom UI5 app, to our ABAP Repo, but getting the error below.

 

Please can anyone advise?

 

snip.PNG

 

Kind Regards

Chantele

Using Camera of mobile Phone in SAPUI Application

$
0
0

Hi Experts,

 

I am working on a customer need that relies on a "fiori like" (master-detail) application.

 

In this application, the user needs to be able to add an attachement from the camera of the mobile device. He clicks on a button, camera appears, he takes picture and it is added to odata model to be sent back to back-end for update.

 

Is there a way of achieving this without HAT ?

 

I tried using Fiori client from SAP but could not get the functionality working.

 

Regards,

 

Nicolas

Get specific amount of data from OData

$
0
0

Hello,

 

I consume data from my OData service which I would like to store into JSON. It looks like this:

var oModel = new sap.ui.model.json.JSONModel();
var url = "/Service-url/EntitySet";
oModel.loadData(url,"",false);

But because I'm consuming a huge amount of data I get a Time-Out error.



1. How can I say just give me only 100 fields? How does the code look like for this approach?



Thank you in advance.



Uncaught TypeError: Cannot read property 'getcontroller' of undefined

$
0
0

Hello,

 

I am trying to replicate an app from Eclipse (running fine) in webide using template "SAPUI5 Master Detail Kapsel Application" and works fine in bringing the data from the on premise system but I have an error with the Approve button.

 

I receive the error: Uncaught TypeError: Cannot read property 'getcontroller' of undefined - in Detail controller.

 

I have copy pasted the same code as in Eclipse but I do not know why is not working with the new app.

 

Please find bellow the code and the controller definition:

handleApprove : function() {

// show confirmation dialog

var bundle = this.getView().getModel("i18n").getResourceBundle();

  1. sap.m.MessageBox.confirm(
  2. bundle.getText("ApproveDialogMsg"),

function (oAction) {

if (sap.m.MessageBox.Action.OK === oAction) {

// notify user

var successMsg = bundle.getText("ApproveDialogSuccessMsg");

 

var oModel = sap.ui.getCore().byId("Detail").getcontroller().getView().getModel();

var po = sap.ui.getCore().byId("Detail").getController().getView().getBindingContext();

                                                                                                               

var oEntry = {};

var oParams = {};

  • oEntry.approved = "X";
  • oParams.fnSuccess = function (){

     sap.m.MessageToast.show(successMsg);

     sap.ui.getCore().byId("Detail").getController().nav.to("NotFound");

     sap.ui.getCore().byId("Detail").getController().nav.back("Master");

};

     oParams.fnError = function () {sap.m.MessageToast.show("Error during update");};

     oParams.bMerge = true;

     oModel.update(po.toString(), oEntry, oParams);

}

},

  1. bundle.getText("ApproveDialogTitle")

);

},


Thank you,

Nicu

update control data

$
0
0

Hi,

 

I want to create a new control which have a one button above  the text fields and ddb

that when you click on the button (add) it will add new entry(row) of the text field and the drop down box

(like a template every time you click you get new row with ddb and tf ) .

if you have already binding to two entries for examples (rows) it will open them in the beginning,how I can do that ?

 

Thanks

I did some example but not sure how to bind the button to the event and how to add new entries

 

 

 

JS Bin - Collaborative JavaScript Debugging

Preloading flower gif in fiori launch pad

$
0
0

Hi Experts,

 

Is there any flower gif file just similar to fiori launchpad for the preloading of the screen ?

 

thanks,

Sanjo

Variant Management - Save option

$
0
0

Hello All,

 

I'm currently developing a variant management system with persistence in an AS ABAP system . So far so good, no issues , I have my CRUDQ oData services working with the variant management control and all is fine.

 

However, I notice that the 'Save' option is disabled even after selecting an existing variant. I can see only the 'Save As' option at all times. This is the same situation even with the 'Explored" example -SAPUI5 Explored. I would appreciate if someone could explain or clarify me on the inner workings of the control or Correct me if my  understanding of the functionality is wrong.

 

The UI5 library version I am using is - 1.26.1

 

 

Regards.

Venkat.

View doesn't reloads according to different data in Routing!!

$
0
0

HI experts,

 

I am implementing routing in dealer management application, I am facing one issue, let me just explain the scenario.

Suppose I have page A and B and  I can select a customer, in page A, and based on that customer I am able to see sales order(which is page B), i.e I am able to navigate from page A to B and back to page A again.

 

Now the problem is when I return to page A and try to select some other customer and then try to navigate to page B, then it is not showing me the sales order of 2nd customer, but the 1st customer's sales order itself.

 

Code for navigation

var router = sap.ui.core.routing.Router.getRouter("appRouter"); // Get instance of router 

router.navTo("Page B");

 

Now, what I think is, the first time when I am trying to navigate from page A to B, it is taking some time to navigate, but when I am trying the same second time, it doesn't even take a second to load. ie. is there anyway to load the page B again ??

I tried deleting history, but in vain.

 

Waiting for any suggestions,

 

Thanks,

Sanjo

Viewing all 6178 articles
Browse latest View live