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

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


getting row,col of a sap.ui.commons.Table upon a cell click

$
0
0

Hi,

 

I have a table. When I click a cell I want to know the row and column number of the cell. How do I do it?

 

Thanks,

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

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

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

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

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


How to bind the data to the table in mobile?

$
0
0

HI,

 

I want to display Sales Order details in table format when click on Business Partner Collection and initially I want to get the first Business Partner Collection id  sales  when run that application by default.

 

I am using below service.

 

https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?sap-ds-debug=true

 

 

I am using the below code to get the table in mobile.

 

var table = new sap.m.Table({

                                 columns : [new sap.m.Column({

                                                                   header : new sap.m.Label({text : "BuyerId"}) }),

                                                  new sap.m.Column({

                                                                   header : new sap.m.Label({ text : "BuyerName" }) }),

                                                  new sap.m.Column({

                                                                    header : new sap.m.Label({ text : "Note" }) }),

                                                  new sap.m.Column({

                                                                   header : new sap.m.Label({ text : "CreatedBy" }) })

                                 ]

                            });

 

My output is like this.

 

salesorderlist.jpg

 

To bind the data to the table I am using

 

table.bindItems("/SalesOrders");

 

Then I am getting the following error message in console.

Uncaught Error: Missing template or factory function for aggregation items of Element sap.m.Table#__table0 !

 

How can I add template to the table in mobile.

 

Is there any wrong in my code when I am binding data or displaying data?

 

Please suggest me.

 

Thanks&Regards

Sridevi

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

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

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

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!

 

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

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


SAPUI5 application calling RFC directly

$
0
0

Is there a way for an SAPUI5 application to consume an RFC directly? if not perhaps a SOAP web service? 

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

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!

 

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

How to bind the data to the table in mobile?

$
0
0

HI,

 

I want to display Sales Order details in table format when click on Business Partner Collection and initially I want to get the first Business Partner Collection id  sales  when run that application by default.

 

I am using below service.

 

https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZGWSAMPLE_SRV/BusinessPartnerCollection?sap-ds-debug=true

 

 

I am using the below code to get the table in mobile.

 

var table = new sap.m.Table({

                                 columns : [new sap.m.Column({

                                                                   header : new sap.m.Label({text : "BuyerId"}) }),

                                                  new sap.m.Column({

                                                                   header : new sap.m.Label({ text : "BuyerName" }) }),

                                                  new sap.m.Column({

                                                                    header : new sap.m.Label({ text : "Note" }) }),

                                                  new sap.m.Column({

                                                                   header : new sap.m.Label({ text : "CreatedBy" }) })

                                 ]

                            });

 

My output is like this.

 

salesorderlist.jpg

 

To bind the data to the table I am using

 

table.bindItems("/SalesOrders");

 

Then I am getting the following error message in console.

Uncaught Error: Missing template or factory function for aggregation items of Element sap.m.Table#__table0 !

 

How can I add template to the table in mobile.

 

Is there any wrong in my code when I am binding data or displaying data?

 

Please suggest me.

 

Thanks&Regards

Sridevi

Viewing all 728 articles
Browse latest View live