Quantcast
Channel: SCN : Popular Discussions - SAPUI5 Developer Center
Viewing all 728 articles
Browse latest View live

Navigation between two views

$
0
0

Hello All,

 

I have created a simple UI5 application with two views. And

 

1. I am trying to navigate between these views but I am not successful.

2. How to embed / call another UI5 application inside a UI5 application?

 

Could somebody please let me know whether above functionalities are  possible in UI5 and any ideas on how to achieve the same would be a great help.

 

As we all know, both the above cases are possible in WDJ and I am trying to achieve similar functionalities in UI5 as well.

 

 

Regards,

SrinivaS


Themes in SAPUI5 desktop application

$
0
0

Hello,

 

We are developing an SAPUI5 desktop application.

In the index.html file we have  script tag with themes as: data-sap-ui-theme="sap_goldreflection" ;

The theme can have four possible values "sap_platinum", "sap_highcontrastblack" and a custom theme(in the form of .css)

 

Could anyone suggest how to apply a custom theme?

 

Regards,

Jagannathan R

Binding an aggregation to Table (SAPUI5)

$
0
0

Hi all,

did somebody ever try binding an aggregation (i.e. having an analytic view with 4 attributes, 1 measure exposed via OData, but showing only 1 attribute + measure) to a table?

 

 

Lets say I have attributes (Transaction, TaskType, Program, Month) and the measure (Number of calls: Value)

Now I'd like only to look at Transactions+Number of Calls.

With OData, this is pretty easy:

../datasource.xsodata/Workload?$select=Transaction,Value

In the results there is only 1 line per transaction with the sum of calls. (pretty much like a Select distinct Transaction, SUM(Value) as "Value")

 

But when working with the ODataModel in SAPUI5, there seems to be no way of adding the $select parameter?

 

(t is a reference to the sap.ui.table.Table created in the view)

 

var oModel = new sap.ui.model.odata.ODataModel("../data/odata/performance.xsodata");
t.setModel(oModel);
t.addColumn(new sap.ui.table.Column({                                        label : "Transaction",                                        template: new sap.ui.commons.TextView().bindProperty("text", {path: "Transaction"})                                        }));
t.addColumn(new sap.ui.table.Column({                                        label : "Calls (Period)",                                        template: new sap.ui.commons.TextView().bindProperty("text", {path: "Value"})                                        }));
t.bindRows("/Workload");

 

When I try this, i have a lot of duplicate transactions (because they have been called in different months or with a different task type). There is no aggregation.

 

My "best" try so far was adding a

 

oModel.createBindingContext("/Workload", null, {select: "Transaction,Value"},function(a){});

 

which actually triggers the right OData Request. It also updates the values in the Table, BUT:

The number of Rows is kept :-(

Lets say with duplicates the result is 100 rows.

Without duplicates its only 40.

So with the createBindingContext, the first 40 rows are overwritten with the new (right!) results, but the other 60 rows are not deleted - which makes this not a viable solution.

 

I tried a lot of stuff - like using bindAggregation for the TextView instead of bindProperty - or supplying the parameters in these functions - but nothing works.

 

Did anybody do this before? Doesn't look like something special...

 

BTW: Whiling searching in the code I found an error in the SAPUI5 libraries:

in resources/sap/ui/core/Element-dbg.js Line 123 it says:

this.mBindingParametes = null;

Actually it should be

this.mBindingParameters = null;

 

 

Thanks for your help.

Fabian

Simple OData Binding with SAPUI5

$
0
0

Hi SAPUI5-experts,

 

I'm just going to learn the basics of OData & SAPUI5. I currently stand at a very simple problem, because i am only able to find OData SAPUI5 examples with charts or tables.

 

I want to code an simple OData HTML file. I want to load an OData Sservice (var oModel = new oModel .... ("http:// ....")) and then show the individual values of the Service ​​without a table or chart. For example, the OData Channel "ItemID" and contains "sales", this I would now like to show individually in HTML or saved into variables.

 

I have been trying to come up with "oModel.getProperty", but it doesnt work for me - if i am using code example with table and replacing the URL with my OData Service, it works, but i don't know how to show the values of the Service individually.

 

Its a very simple problem, but i hope you can help me! A small example of code would be the best way.

Bind a single OData entry to table

$
0
0

Hi friends,

 

I want to know how to bind a single read output (not a collection) of an OData service into a table. If I use table.bindRows it doesn't work.

 

Thanks

Krishna

System expected the element '{http://www.w3.org/2005/Atom}entry

$
0
0

hi,

 

i am trying to consume the Netweaver Gateway service via $.ajax().

the GET (Read) operation is successful, but when i am trying to create a new record i.e. POST, i am getting the following error:

System expected the element '{http://www.w3.org/2005/Atom}entry.

 

Following is the approach i am following :

1) using $.ajax() & type= 'GET' to fetch the X-CSRF-Token.

2) in the success of $.ajax (), trying to consume the type='POST' & sending the above fetched CSRF token, so as to create a new record.

 

the token is successfully fetched, but thereafter the above mentioned error comes.

 

following are the 2 headers i am using :

 

headers : {

                    "X-Requested-With" : "XMLHttpRequest",

                    "Content-Type" : "application/atom+xml",

                    "DataServiceVersion" : "1.0",

                    "X-CSRF-Token" : "Fetch",

                    "xmlns" : "http://www.w3.org/2005/Atom"

                },

                

                    type: 'GET',

                    url : oDATA_URL,

                    dataType : 'json',

                    username : uId,

                    password : pWd,

 

& once the token is fetched :

 

   headers : {
   "X-Requested-With" : "XMLHttpRequest",
   "Content-Type" : "application/atom+xml", //application/json ,application/atom+xml;type=entry
   "DataServiceVersion" : "2.0",
   "Accept" : "application/atom+xml,application/xml,application/atomsvc+xml",
   "X-CSRF-Token" : header_xcsrf_token,
  
  
   },
    
   type: "POST",
   url : oDATA_URL,
   dataType : "json",
   username : uId,
  

password : pWd,

 

the exact error message is :

 

"<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>CX_ST_MATCH_ELEMENT/544FAE4641562346A1372144E7396586</code><message xml:lang="en">System expected the element '{http://www.w3.org/2005/Atom}entry'</message><innererror><transactionid>CC5966E34FB8F166A726001F29E5DD9A</transactionid><errordetails/></innererror></error>"


Please help !!


regards,

Viren

Conditional data binding?

$
0
0

Hi,

 

As part of my blog on sapui5 vs phonegap, I wanted to do data binding between phonegap exposed api and a sapui5 table view.

 

I looked at the contacts api, for which Phonegap returns the data in JSON format in a similar structure as the test case below.

 

var contacts = {          modelData:          [                    {                              displayName:"Dagfinn Parnas",                              nickname:"Dagi",                              phoneNumbers: [                                        {type:"mobile", number:"9364xxxx"},                                        {type:"home", number:"5165xxxx"},                                        ],                    },                    {                              displayName:"John Doe",                              nickname:"Doh",                              phoneNumbers: [                                        {type:"mobile", number:"952xxxxx"},                                        {type:"other", number:"5165xxxx"},                                        ],                    },                    {                              displayName:"Jane Doe",                              nickname:"Doh",                              phoneNumbers: [                                        {type:"mobile", number:"12hxxxxx"},                                        ],                    },          ]
};

 

As you can see, each contact has an array of phone numbers with varying type.

 

What I wanted to do is to bind the phoneNumbers which has type "mobile" to one sap.ui.table.Column, and those with type "home" to another one.

 

Unfortunately, I was not able to do this.

Is it possible to achieve it with sapui5 beta?

 

 

The closest I came is this test case.

It bind the first number to the first column and the second number to the second column.

 

<html><head>  <meta http-equiv="X-UA-Compatible" content="IE=edge" />  <title>sapui5 databinding</title>                    <script src="/sapui5/resources/sap-ui-core.js"                              type="text/javascript"                              id="sap-ui-bootstrap"                              data-sap-ui-libs="sap.ui.commons,sap.ui.table"                              data-sap-ui-theme="sap_goldreflection">                    </script><script>
jQuery.sap.log.setLevel(jQuery.sap.log.LogLevel['DEBUG']);
var contacts = {          modelData:          [                    {                              displayName:"Dagfinn Parnas",                              nickname:"Dagi",                              phoneNumbers: [                                        {type:"mobile", number:"9364xxxx"},                                        {type:"home", number:"5165xxxx"},                                        ],                    },                    {                              displayName:"John Doe",                              nickname:"Doh",                              phoneNumbers: [                                        {type:"mobile", number:"952xxxxx"},                                        {type:"other", number:"5165xxxx"},                                        ],                    },                    {                              displayName:"Jane Doe",                              nickname:"Doh",                              phoneNumbers: [                                        {type:"mobile", number:"12hxxxxx"},                                        ],                    },          ]
};
var oTable = new sap.ui.table.DataTable();
//two columns with simple binding
oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "Name1"}),  template: new sap.ui.commons.TextView().bindProperty("text", "displayName"),  sortProperty: "displayName"
}));
oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "Name2"}),  template: new sap.ui.commons.TextView().bindProperty("text", "nickname"),  sortProperty: "nickname",
}));
var oTVNumber1 = new sap.ui.commons.TextView();
oTVNumber1.bindProperty("text","phoneNumbers/0/number");
oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "Number1"}),  template:oTVNumber1,  sortProperty: "id",
}));  
var oTVNumber2 = new sap.ui.commons.TextView();
oTVNumber2.bindProperty("text","phoneNumbers/1/number");
oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "Number2"}),  template:oTVNumber2,  sortProperty: "id",
}));
var oItemTemplate2 = new sap.ui.core.ListItem();
oItemTemplate2.bindProperty("text", "type").bindProperty("additionalText", "number");
var oListTemplate = new sap.ui.commons.ListBox("myLb3", {displaySecondaryValues:true, height:"200px"});
oListTemplate.bindAggregation("items", "phoneNumbers", oItemTemplate2);
oTable.addColumn(new sap.ui.table.Column({  label: new sap.ui.commons.Label({text: "Phone"}),  //template: new sap.ui.commons.ComboBox().bindItems("phoneNumbers", oListItemTemplate),  template:oListTemplate,  sortProperty: "id",
}));
//create model
var oModel = new sap.ui.model.json.JSONModel();
//set model with a new root element
oModel.setData(contacts);
//bind model to table
oTable.setModel(oModel);
//bind table to the root element in the model
oTable.bindRows("modelData");
oTable.placeAt("dataTable");
//list test 1
var oLB = new sap.ui.commons.ListBox("myLb", {displaySecondaryValues:true, height:"200px"});
oLB.setModel(oModel);
oLB.bindContext("/modelData/1");
var oItemTemplate = new sap.ui.core.ListItem();
oItemTemplate.bindProperty("text", "type").bindProperty("additionalText", "number");
oLB.bindAggregation("items", "phoneNumbers", oItemTemplate);
oLB.placeAt("list1");
//TextView test</script></head><body class="sapUiBody">  <h1>sapui5 databinding</h1>  <div id="dataTable"></div>  <div id="singleproperty"></div>  <div id="list1"></div>  <div id="list2"></div></body></html>

neptune for UI development Pros and Cons

$
0
0

Hi ,

 

we are evaluating neptune for UI development for what are the pros and cons of using neptune.

 

i see only that webdynpro abap developer can be easily moved to neptune , some javascript knowledge is still required.

 

some question

 

1) can neptune make calls to odata services ? do that requires code in javascript or ABAP

 

2) any accelerators provided by neptune  like for workflow scenarios , list and details .

 

3) can sap standard fiori apps extensibility  or modification is possible through neptune

 

4) security if its accessing business functionality directly

 

 

regards

 

Yashpal


How to read the data from selected SAPUI5 table row

$
0
0

Hi,

 

I would like to read the data from the selected row in SAPUI5 table. I have defined a table in JS view as:

 

var

sysTable = new DataTable({

     title:

"SAP System List",

     visibleRowCount: 10,

     selectionMode: SelectionMode.Single,

     editable : true

});

 

 

The table is binded to JSON data

sysTable.bindRows("/SystemDetails");

 

I have also used the attachRowSelect function to get the selected row indices.

sysTable.attachRowSelect(function(oEvent){

                  oSystemDetailsML.bindContext(

"/SystemDetails/" + sysTable.getSelectedIndices());  

             });

 

Lets say the table has two columns as "SysID" and "Description". I am not able to read the data for the selected row.

Tried using the command  alert(sap.ui.getCore().byId("SysID").getValue());   but not sure how this will read the data from selected row.

 

Thanks,

Yomesh

Themes in SAPUI5 desktop application

$
0
0

Hello,

 

We are developing an SAPUI5 desktop application.

In the index.html file we have  script tag with themes as: data-sap-ui-theme="sap_goldreflection" ;

The theme can have four possible values "sap_platinum", "sap_highcontrastblack" and a custom theme(in the form of .css)

 

Could anyone suggest how to apply a custom theme?

 

Regards,

Jagannathan R

Simple OData Binding with SAPUI5

$
0
0

Hi SAPUI5-experts,

 

I'm just going to learn the basics of OData & SAPUI5. I currently stand at a very simple problem, because i am only able to find OData SAPUI5 examples with charts or tables.

 

I want to code an simple OData HTML file. I want to load an OData Sservice (var oModel = new oModel .... ("http:// ....")) and then show the individual values of the Service ​​without a table or chart. For example, the OData Channel "ItemID" and contains "sales", this I would now like to show individually in HTML or saved into variables.

 

I have been trying to come up with "oModel.getProperty", but it doesnt work for me - if i am using code example with table and replacing the URL with my OData Service, it works, but i don't know how to show the values of the Service individually.

 

Its a very simple problem, but i hope you can help me! A small example of code would be the best way.

Use of Icons in SAPUI5

$
0
0

Hi there,

 

today I've tryed to use the iconset (icon font) that comes with SAPUI5, but it gives me some error. I Tryed the following:

 

var aNames = sap.ui.core.IconPool.getIconNames();

 

aNames is "sap-icon://accidental-leave".

 

Now I tryed to use this in a button:

 

new sap.ui.core.Icon( {                        src : sap.ui.core.IconPool.getIconURI( aNames[0] ),                        size : "32px",                        color : "#333333",                        activeColor : "white",                        activeBackgroundColor : "#333333",                        hoverColor : "#eeeeee",                        hoverBackgroundColor : "#666666",                        width : "60px",                    } ).addStyleClass( "fontIcon" ),                    tooltip : oBundle.getText( 'quotationsView.quotationsTable.toolbar.delete' ),                    press : oController.deleteQuote                } )

 

But this gives me an error:

 

 

sap-ui-core.js (Zeile 55)

 

Error: "Element sap.ui.core.Icon#__icon0" is of type object, expected sap.ui.core.URI for property "icon" of Element sap.ui.commons.Button#__button0
Any sugesstions?
Thanks in advance!

 

Themes in SAPUI5 desktop application

$
0
0

Hello,

 

We are developing an SAPUI5 desktop application.

In the index.html file we have  script tag with themes as: data-sap-ui-theme="sap_goldreflection" ;

The theme can have four possible values "sap_platinum", "sap_highcontrastblack" and a custom theme(in the form of .css)

 

Could anyone suggest how to apply a custom theme?

 

Regards,

Jagannathan R

How to read the data from selected SAPUI5 table row

$
0
0

Hi,

 

I would like to read the data from the selected row in SAPUI5 table. I have defined a table in JS view as:

 

var

sysTable = new DataTable({

     title:

"SAP System List",

     visibleRowCount: 10,

     selectionMode: SelectionMode.Single,

     editable : true

});

 

 

The table is binded to JSON data

sysTable.bindRows("/SystemDetails");

 

I have also used the attachRowSelect function to get the selected row indices.

sysTable.attachRowSelect(function(oEvent){

                  oSystemDetailsML.bindContext(

"/SystemDetails/" + sysTable.getSelectedIndices());  

             });

 

Lets say the table has two columns as "SysID" and "Description". I am not able to read the data for the selected row.

Tried using the command  alert(sap.ui.getCore().byId("SysID").getValue());   but not sure how this will read the data from selected row.

 

Thanks,

Yomesh

Issues while installing SAPUI5 on HANA Studio

$
0
0

Hi,

We are facing below mentioned  issue while installing SAPUI5 on HANA studio(SP5 version 45):


Cannot complete the install because one or more required items could not be found.
  Software being installed: SAPUI5 Application Development 1.8.4 (com.sap.ide.ui5.app.feature.external.feature.group 1.8.4)
  Missing requirement: SAPUI5 Metamodel 1.8.4 (com.sap.ide.ui5.ctrl.metamodel 1.8.4) requires 'bundle org.eclipse.wst.xml.core [1.0.0,2.0.0)' but it could not be found
  Cannot satisfy dependency:
    From: SAPUI5 Application Development 1.8.4 (com.sap.ide.ui5.app.feature.external.feature.group 1.8.4)
    To: com.sap.ide.ui5.ctrl.metamodel [1.8.4]


Could you please suggest on the same.

Regards


Binding an aggregation to Table (SAPUI5)

$
0
0

Hi all,

did somebody ever try binding an aggregation (i.e. having an analytic view with 4 attributes, 1 measure exposed via OData, but showing only 1 attribute + measure) to a table?

 

 

Lets say I have attributes (Transaction, TaskType, Program, Month) and the measure (Number of calls: Value)

Now I'd like only to look at Transactions+Number of Calls.

With OData, this is pretty easy:

../datasource.xsodata/Workload?$select=Transaction,Value

In the results there is only 1 line per transaction with the sum of calls. (pretty much like a Select distinct Transaction, SUM(Value) as "Value")

 

But when working with the ODataModel in SAPUI5, there seems to be no way of adding the $select parameter?

 

(t is a reference to the sap.ui.table.Table created in the view)

 

var oModel = new sap.ui.model.odata.ODataModel("../data/odata/performance.xsodata");
t.setModel(oModel);
t.addColumn(new sap.ui.table.Column({                                        label : "Transaction",                                        template: new sap.ui.commons.TextView().bindProperty("text", {path: "Transaction"})                                        }));
t.addColumn(new sap.ui.table.Column({                                        label : "Calls (Period)",                                        template: new sap.ui.commons.TextView().bindProperty("text", {path: "Value"})                                        }));
t.bindRows("/Workload");

 

When I try this, i have a lot of duplicate transactions (because they have been called in different months or with a different task type). There is no aggregation.

 

My "best" try so far was adding a

 

oModel.createBindingContext("/Workload", null, {select: "Transaction,Value"},function(a){});

 

which actually triggers the right OData Request. It also updates the values in the Table, BUT:

The number of Rows is kept :-(

Lets say with duplicates the result is 100 rows.

Without duplicates its only 40.

So with the createBindingContext, the first 40 rows are overwritten with the new (right!) results, but the other 60 rows are not deleted - which makes this not a viable solution.

 

I tried a lot of stuff - like using bindAggregation for the TextView instead of bindProperty - or supplying the parameters in these functions - but nothing works.

 

Did anybody do this before? Doesn't look like something special...

 

BTW: Whiling searching in the code I found an error in the SAPUI5 libraries:

in resources/sap/ui/core/Element-dbg.js Line 123 it says:

this.mBindingParametes = null;

Actually it should be

this.mBindingParameters = null;

 

 

Thanks for your help.

Fabian

Simple OData Binding with SAPUI5

$
0
0

Hi SAPUI5-experts,

 

I'm just going to learn the basics of OData & SAPUI5. I currently stand at a very simple problem, because i am only able to find OData SAPUI5 examples with charts or tables.

 

I want to code an simple OData HTML file. I want to load an OData Sservice (var oModel = new oModel .... ("http:// ....")) and then show the individual values of the Service ​​without a table or chart. For example, the OData Channel "ItemID" and contains "sales", this I would now like to show individually in HTML or saved into variables.

 

I have been trying to come up with "oModel.getProperty", but it doesnt work for me - if i am using code example with table and replacing the URL with my OData Service, it works, but i don't know how to show the values of the Service individually.

 

Its a very simple problem, but i hope you can help me! A small example of code would be the best way.

How to add rows to the table in SAPUI5?

$
0
0

Hi,

 

I want to display a table which is having both columns and rows as headers.

 

I can add the columns by using

 

oTable.addColumn(new sap.ui.table.Column({

                                  label: new sap.ui.commons.Label({text: "Gender"})

                        }));


It's working fine.

 

When I want to add the Row by using


oTable.addRow(new sap.ui.table.Row({

                                label: new sap.ui.commons.Label({text: "Name"})

                      }));


It's showing error in console that

The control manages the rows aggregation. The method "addRow" cannot be used programmatically! -

 

But in my table I need both columns and Rows with Headers  like below


Column1Column2Collumn3
Row1


Row2


Row3






 

so, Please help me to solve this issue.

 

Thanks&Regards

Sridevi

FileUploader and X-CSRF-Token?

$
0
0

Hi,

 

I have a SAPUI5 FileUploader that should post the file to a (NetWeaver Gateway) OData service - which requires that the request has an X-CSRF token. How can I make this happen?

Currently, prior to starting the upload I already did a refreshSecurityToken() on the OData model. But the FileUploader does not pick up this value. How can I proceed here?

 

Thank you for your help!

How to fetch X-CSRF-Token

$
0
0

Hi,

 

I am trying to read the X-CSRF-Token from GW read service without success. Any idea? As far as I know sap.ui.model.odata.ODataModel does not have the provision to pass the header data. So I tried with OData from datajs library, but the response header is always blank. I am able to get the X-CSRF-Token when I run the service uisng firefox REST client.

 

Here is the code I am using.

headers:

{

"Content-Type": "application/x-www-form-urlencoded",

"X-CSRF-Token":"Fetch"

}

 

Thanks

Abhilash

Viewing all 728 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>