Dynamic binding of items in sap.m.Table using JS views
HI,
I am developing a master detail page for a Purchase Order application. In master page, i display the list of Purchase Orders & on clicking the PO, i should display the detail page.
We use different ODATA models for Master & detail page. I am able to successfully list the POs in master page & i am struggling on the part where i have to pass the selected PO number to the new ODATA service URL & then display the details in a table.
Below is the code i use on TAP of Purchase order from master page:
tap: function(oEvent)
sap.ui.getCore().byId("PODetailstable_nodata_id").setVisible(false);
var oContext=oEvent.getSource().getBindingContext();
var odataModel_PO_detail = new sap.ui.model.odata.ODataModel(detailServiceUrl,false, "dev_sde", "28aug@2013");
odataModel_PO_detail.setCountSupported(false);
var tappedPONumber= oContext.getProperty("PONumber");
var path = "/POHeaderSet('"+tappedPONumber+"')/HDRtoITM";
PO_DetailsPage.setBindingContext(oContext);
sap.ui.getCore().byId("po_details_table_id").setModel(odataModel_PO_detail);
sap.ui.getCore().byId("po_details_table_id").bindContext(path);
sap.ui.getCore().byId("po_details_table_id").setVisible(true);
And below is the code of my Detail page & the table: I set the bindcontext with new path at "tap" function in master page, i also do bindaggregation for the table with the new path.
The issue is i am able to HIT the new service URL, but no data is displayed. There is also a demo application on the same, but w/o source code it doesnt help me much in resolving this issue.
var PODetailstable_nodata = new sap.m.Table("PODetailstable_nodata_id",{title : "No Data"});
var po_details_table = new sap.m.Table("po_details_table_id", {
inset: true,
headerText: "table for Detail page",
columns: [
new sap.m.Column({
header: new sap.m.Label({ text: "PO Number" }) }),
new sap.m.Column({ header: new sap.m.Label({ text: "Vendor" }) }),
new sap.m.Column({
header: new sap.m.Label({ text: "Vendor Name" }) }),
var oTemplate = new sap.m.ColumnListItem({
cells: [
new sap.m.Text({ text: "{PoNumber}" }),
new sap.m.Text({ text: "{Vendor}" }),
new sap.m.Text({ text: "{VendorName}"})
po_details_table.bindAggregation("items", {
path:"/POHeaderSet('"+"{PONumber}"+"')/HDRtoITM",
template: oTemplate
var PO_DetailsPage = new sap.m.Page("PO_DetailsPage_id",
// title : "Purchase Order Details",
title : "{PoNumber}",
content : [
PODetailstable_nodata,
po_details_table,
footer : new sap.m.Bar
contentRight: [
new sap.m.Button({
text : "Approve",
//press: oController.approve_pr,
I have modified my code by referring another forum,
on Tap, i now invoke a method from controller to update the binding i.e to pass the clicked PO number to the context.
updateBinding: function(oEvent)
alert("updatebinding");
var detailServiceUrl = "http://incas1054.ind.cldsvc.accenture.com:8000/sap/opu/odata/sap/ZPURCHASE_PAY_SRV";
var odataModel_PO_detail = new sap.ui.model.odata.ODataModel(detailServiceUrl,false, "dev_sde", "28aug@2013");
odataModel_PO_detail.setCountSupported(false);
var tableView=sap.ui.getCore().byId("po_details_table_id");
tableView.setModel(odataModel_PO_detail);
alert(tableView.getModel());
var oContext = tableView.getBindingContext();
//tableView.bindContext("/POHeaderSet");
alert(oContext);
var path= oContext.sPath + "/HDRtoITM";
var oTemplate = new sap.m.ColumnListItem({
cells: [
new sap.m.Text({ text: "{PoNumber}" }),
new sap.m.Text({ text: "{Vendor}" }),
new sap.m.Text({ text: "{VendorName}"})
tableView.bindItems(path, oTemplate);
Now, i see the PO number is set in the context, but i want to set a different context for details page as i hit different URL, Can anyone suggest on how to set a different context for details page & then pass the PO number from master to detail page?
Similar Messages
-
Dynamic binding of items in sap.m.Table using XML views
Dear SAPUI5 guru's,
Let's start by saying I'm an ABAP developer who's exploring SAPUI5, so I'm still a rookie at the time of writing. I challenged myself by developing a simple UI5 app that shows information about my colleagues like name, a pic, address data and their skills. The app uses the sap.m library and most of the views are XML based which I prefer.
The data is stored on an ABAP system and exposed via a gateway service. This service has 2 entities: Employee and Skill. Each employee can have 0..n skills and association/navigation between these 2 entities is set up correctly in the service. The data of this service is fetched from within the app using a sap.ui.model.odata.ODataModel model.
The app uses the splitApp control which shows the list of employees on the left side (master view). If a user taps an employee, the corresponding details of the employee entity are shown on the right (detail view).
Up till here everything is fine but I've been struggling with my latest requirement which is: show the skills of the selected employee in a separate XML view when the user performs an action (for the time being, I just created a button on the detail view to perform the action). After some hours I actually got it working but I doubt if my solution is the right way to go. And that's why I'm asking for your opinion here.
Let's explain how I got things working. First of all I created a new XML view called 'Skills'. The content on this view is currently just a Table with 2 columns:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="com.pyramid.Skills" xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Skills"
showNavButton="true"
navButtonPress="handleNavButtonPress">
<content>
<Table
id="skillsTable">
<columns>
<Column>
<Label text="Name"/>
</Column>
<Column>
<Label text="Rating"/>
</Column>
</columns>
</Table>
</content>
</Page>
</core:View>
The button on the Detail view calls function showSkills:
showSkills: function(evt) {
var context = evt.getSource().getBindingContext();
this.nav.to("Skills", context);
var skillsController = this.nav.getView().app.getPage("Skills").getController();
skillsController.updateTableBinding();
Within 'this.nav.to("Skills", context);' I add the Skills view to the splitApp and set its bindingContext to the current binding context (e.g. "EmployeeSet('000001')"). Then I call function updateTableBinding in the controller of the Skills view which dynamically binds the items in the table based on the selected employee. So, when the ID of the selected employee is '000001', the path of the table's item binding should be "/EmployeeSet('000001')/Skills"
updateTableBinding: function(){
var oTemplate = new sap.m.ColumnListItem(
{cells: [
new sap.m.Text({text : "{Name}"}),
new sap.m.Text({text : "{Rating}"})
var oView = this.getView();
var oTable = oView.byId("skillsTable");
var oContext = oView.getBindingContext();
var path = oContext.sPath + "/Skills";
oTable.bindItems(path, oTemplate);
Allthough it works fine, this is where I have my first doubt. Is this the correct way to bind the items? I tried to change the context that is passed to this.nav.to and wanted it to 'drill-down' one level, from Employee to Skills, but I couldn't manage to do that.
I also tried to bind using the items aggregation of the table within the XML declaration (<Table id="skillsTable" items="{/EmployeeSet('000001')/Skills}">). This works fine if I hard-code the employee ID but off course this ID needs to be dynamic.
Any better suggestions?
The second doubt is about the template parameter passed to the bindItems method. This template is declared in the controller via javascript. But I'm using XML views! So why should I declare any content in javascript?? I tried to declare the template in the XML view itself by adding an items tag with a ColumnListItem that has an ID:
<items>
<ColumnListItem
id="defaultItem">
<cells>
<Text text="{Name}"/>
</cells>
<cells>
<Text text="{Rating}"/>
</cells>
</ColumnListItem>
</items>
Then, in the updateTableBinding function, I fetched this control (by ID), and passed it as the template parameter to the bindItems method. In this case the table shows a few lines but they don't contain any data and their height is only like 1 mm! Does anyone know where this strange behaviour comes from or what I'm doing wrong?
I hope I explained my doubts clearly enough. If not, let me know which additional info is required.
Looking forward to your opinions/suggestions,
Rudy Clement.Hi everybody,
I found this post by searching for a dynamic binding for well acutally not the same situation but it's similar to it. I'm trying to do the following. I'm having a list where you can create an order. On the bottom of the page you'll find a button with which you're able to create another order. All the fields are set to the same data binding ... so the problem is if you've filled in the values for the first order and you'll press the button you'll get the same values in the second order. Is it possible to generate a dynamic binding?
I'm going to post you a short code of what I'm meaning:
<Input type="Text" value="{path: 'MyModel>/Order/0/Field1'}" id="field1">
<layoutData>
<l:GridData span="L11 M7 S3"></l:GridData>
</layoutData>
</Input>
As you can see I need to set the point of "0" to a dynamic number. Is there any possibility to reach this???
Hope you can help
Greetings
Stef -
How to select an item in sap.ui.table.Table without using index?
Hi there,
I want to select an item of a sap.ui.table.Table by finding the right item and selecting it.
Take the example at this SDK page:
SAPUI5 SDK - Demo Kit
You have first name and last name. I want to select "Mo Lester". While there is a function called setSelectedIndex, there is no function for setSelectedItem.
I have to search the items of the table for a required entry and select it (like clicking on it).
Is there a way to do this (programatically)?
I'm using aggregation binding with a JSON model.
Regards
TobiasHi Tobias,
What you could do is first find the JSON object (i.e., the table row) in your table model, and use its index in the model to set the selected index:
var matches = $.grep(array, function() {
return(this.firstName === "John" && this.lastName === "Doe");
if (matches.length) {
var index = yourTable.getModel().getData().indexOf(matches[0]); //first match
yourTable.setSelectedIndex(index); -
Dynamic binding of radiobutton's property inside table is possible ?
Hi,
As someone asked here, i am too lookig for sometime for code to bind dynamically 'keyToSelect' property of radiobutton(inside the table). someone please point out..
Thanks,
Hussian.Hi,
Have you got one radio button in a column or more than one.
Please refer this post for my reply on same -
Re: How to bind 'keyToSelect' property of Radio button dynamically ?
Regards,
Lekha. -
Populating SAP Database table using JDBC adapter
Hi Folks,
I have a requirement to populate a SAP database table say ZTABLE using XI. The Model is the table has to be populated through a file which will be processed by SAP XI. Basically this is a File to JDBC scenario. The database used is ORACLE. Kindly provide me some idea to go ahead.I tried to place the MS access table in the shared folder of the Application server system but still it seems the table is not being populated.
did you check the log in your receiver channel? (/people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn)
The requirement is to update the tables directly as those are the custom tables.
i would still say that do not update SAP tables directly from XI/ PI.....this is not a standard architecture/ solution.... -
Hi all,
How can i get tables uses uinformation in view as hiererchy order.
example.
Table name : Employee
I want to know in which view this table is using and also other view name which is using earlier view too.
Example
1. view A is created on table Employee
2. View B is created on view A
3. View C is created on View B .
output should be
view affected for employee table
A
B
C
Thanks in advance
Tnaks & regards
Debdebasishghosh wrote:
Can you please send me the querySELECT [column list] FROM ALL_DEPENDENCIES;
What to put in [column list] is left as an exercise for the student. Clues can be found be reading the very good description of ALL_DEPENDENCIES in the fine Reference Manual.
=================================================
I don't want to be flippant or rude, but if people want to be professionals in ANY field, the first knowledge they need to acquire is how to locate AND USE+ the fundamental reference materials for that profession. And the most important trait, the one for which they are really hired, is the ability to do independent research, and having a modicum of curiosity that would drive one to do that research. We don't mind helping newbies, and even the most experienced person on this board will run into something they are not familiar with, or occasionally just require a second set of eyes to look at something. But a professional+ needs, above all, a willingness and capability to check the docs. A professional isn't necessarily someone who has all the answers at their fingertips or has a full understanding about every arcane subject in their field. It certainly isn't someone who has an encyclopedia full of memorized answers but little understanding of how it all fits together. It's someone who knows where to find the answers when needed, how to recognize them when he sees them. It's less about knowing than it is about attitude. Everything you asked can be answered in the Oracle Concepts Manual at tahiti.oracle.com. You should bookmark that site. You were told the name of the view that has the information you seek. It is not an unreasonable assumption that anyone who comes to this forum knows how to write simple SQL. It is also NOT unreasonable to expect a a professional to be able to take a clue like that and use it. A professional does NOT expect to be spoon-fed everything.
=================================================
Learning how to look things up in the documentation is time well spent investing in your career. To that end, you should drop everything else you are doing and do the following:
Go to tahiti.oracle.com.
Drill down to your product and version.
<b><i><u>BOOKMARK THAT LOCATION</u></i></b>
Spend a few minutes just getting familiar with what is available here. Take special note of the "books" and "search" tabs. Under the "books" tab you will find the complete documentation library.
Spend a few minutes just getting familiar with what <b><i><u>kind</u></i></b> of documentation is available there by simply browsing the titles under the "Books" tab.
Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what <b><i><u>kind</u></i></b> of information is available there.
Do the same with the SQL Reference Manual.
Do the same with the Utilities manual.
You don't have to read the above in depth. They are <b><i><u>reference</b></i></u> manuals. Just get familiar with <b><i><u>what</b></i></u> is there to <b><i><u>be</b></i></u> referenced. Ninety percent of the questions asked on this forum can be answered in less than 5 minutes by simply searching one of the above manuals.
Then set yourself a plan to dig deeper.
- Read a chapter a day from the Concepts Manual.
- Take a look in your alert log. One of the first things listed at startup is the initialization parms with non-default values. Read up on each one of them (listed in your alert log) in the Reference Manual.
- Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files. Go to the Network Administrators manual and read up on everything you see in those files.
- When you have finished reading the Concepts Manual, do it again.
Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.
================================= -
How to maintain data in tables using maintenace view of the tables in ECC6
Hi,
I have two table SBUSPART (Business partner) and STRAVELAG (Travel agency).
SBUSPART is foreign key table while STRAVELAGE is a reference table. The relationships is :
SBUSPART-MANDANT = STRAVELAGE-CLIENT
SBUSPART-BUSPARTNUM = STRAVELAGE-AGENCYNUM
now, I create a maintenance view ZVI_HT_PARTNER in which SBUSPART is primary table and STRAVELAGE is secondary table. I have also created maintenace interfaces by generating maintenance modules in function group zht_fg. Authorization group is SUNI and maintenance type is one-step, the number maintenace screen is 100.
Now I want to maintain the data in tables SBUSPART and STRAVELAGE together in the maintenace view. If i want to enter a new partner dirctly I have to enter it in table SBUSPART first, only then could I enter the corresponding data in STRAVELAGE.
in older version I easyly do this by the way: in maintenace screen of zvi_ht_partner ( in se11) I choose: system/ services/table maintenace/Enhance.Tab.maintain.
but in ECC6 when I choose: system/ services/table maintenace, there is no Enhance.Tab.maintain instead there are two options Extended table maintenace and View cluster maintenace.
So in this case I don't know how to tackle this problem, Please help me if you have a solution.
Thanks,Hi,
I suppose 'Extended table maintenace ' would be same as 'Enhance.Tab.maintain'.
Regards,
Himanshu -
Tables used in Views, Trigger
Hi,
Please let me know the query to find the tables used for creating a view and database trigger.
Thanks and Regards.Hi,
{sorry but your question is unclear "we don't use a query to create..."
if you want to:
to create a view:
http://download.oracle.com/docs/cd/B12037_01/server.101/b10759/statements_8004.htm
to create a trigegr
http://download.oracle.com/docs/cd/B12037_01/server.101/b10759/statements_7004.htm#i2235611
to check existing views:
{code}
select * from all_views
to check existing triggers:select * from all_triggers -
How to deliver items in SAP R/3 using sap gui
Hi all,
I have created an order.I want to deliver the items contained in it. pls tell me how to do it using sap gui.
Regards,
Kiran.Hi Anil
You can create a normal ABAP report to delete or modify records from database table.
You can use statements such as delete or modify for this purpose.
First select the records from table bring them into internal table and use that table to delete the records from database.
Note: If you are trying to delete records from Z tables then this approch can be adopted but if you are dealing with Standard tables it`s not a option to directly delte the reocrds from database table .
For that purpose you can use BDC or any othe available FM/BAPI.
Note :When you are deleting records from the database table please use locking function module to lock the database entries.
Regards
Neha -
Error in Decision Table using Analytic View
Dear experts,
I am trying to create a Decision table on an Analytic view. As per the HANA document guidelines, the Analytic view has one Calc. Attribute, the Action is created from a Parameter and Conditions are created from Analytic View column.
But no luck while activationg the Decision Table and facing below errors. Has anybody gone through such scenario. Please suggest if I am missing something.
Message :
XML Parser error: ; Decision Table XML Parser Error: attribute 'ce-id-refs' of element 'av' is missing
XML Parser error: ; Decision Table XML Parser Error: actionVal is NULL
XML Parser error: ; Decision Table XML Parser Error: actionNode is NULL
HANA Version is 1.0 SPS8 Rev80
Thanks in advance,
~PapilHi,
I have resolved this issue by performing following steps.
1. Exported Decision Table Data into XL.
2. Removed the action variable.
3. Added again the same parameters as Action
4. Imported XL file of Decision table.
5. Validated and Activated. It worked.
regards,
Shweta -
Howto dynamicly bind XML element to a TextInput using BindingUtils?
The question is: Howto dynamicly bind XML element to a
TextInput component using BindingUtils?
Now I use following codes:
<!--
[Bindable] private var xml: XML =
<item><label>list1</label></item>;
// initialize code for application's initialize event
private function init(): void {
BindingUtils.bindProperty(txtDemo, "text", xml, "label");
//click event
private function test(): void {
xml.label = "something";
// txtDemo.executeBindings(); //---- no use anymore
-->
<mx:TextInput id="txtDemo"/>
<mx:Button label="Test" click="test()"/>
My really idea is when bindable xml property is changed, then
the textinput will be updated as hoped. However, no update happens
to me when I click the Test button.
But, if I make codes like that:
<mx: TextInput id="txtDemo" text="{xml.label}"/>
the text will updated when xml changs.
So, what happened, I indeed need the dynamicly bind to the
textinput compont.
Help me. thanks.You could use an ObjectProxy since all subproperties will
then be bindable:
private var _xml:XML =
<item><label>list1</label></item>;
private var _opXML:ObjectProxy = new ObjectProxy(_xml);
then in your init() function you declare _opXML as the host
object with the bindable property "label"...
// initialize code for application's initialize event
public function init(): void {
BindingUtils.bindProperty(txtDemo, "text", _opXML, "label");
//click event
private function test(): void {
_opXML.label = "something";
You'll notice that if you check your original _xml.label
property with ChangeWatcher.canWatch(), it returns false. But if
you create a dedicated object with a property that can be declared
as bindable, canWatch() returns true. You'd probably be best off to
write a lightweight class that can act as your model if you want to
work with dynamic XML binding using Actionscript. This will allow
you to use a bindable getter and setter that will give you the
dynamic functionality you're looking for.
Hope that helps. -
How to get list data and bind to data table or Grid view in share point 2010 using j query
hi,
How to bind list data in to data table or grid view using Sp Services.
How to use sp services in share point 2010 lists and document libraryHi, You can use List service, SPServices and JQuery to get your requiement done-
See here for an sample implementation -
http://sympmarc.com/2013/02/26/spservices-stories-10-jqgrid-implementation-using-spservices-in-sharepoint/
http://www.codeproject.com/Articles/343934/jqGrid-Implementation-using-SpServices-in-SharePoi
Mark (creator of SPServices) has some good documentation on how to use SPServices-
http://spservices.codeplex.com/wikipage?title=%24().SPServices
SPServices Stories #7 – Example Uses of SPServices, JavaScript and SharePoint
http://sympmarc.com/2013/02/15/spservices-stories-7-example-uses-of-spservices-javascript-and-sharepoint/
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if my reply helps you -
Query DB2 tables from oracle using normal view
This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?
thanks,
vinodhVinodh2 wrote:
This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?How can the SQL select statement via a dblink not work for a view, but the same SQL select statement work for a materialised view?
Do you think the database link or remote database care whether the select SQL that hits it, comes from a PL/SQL procedure, a view, a materialised view, a job or whatever else? It has no idea what/who is behind that select SQL - and nor does it care.
As for the benefits of a view vs. a materialised view - that depends on the requirements for needing to use that foreign database's data in the local database. -
New GL cleared items in SAP-tables
Hello experts,
our clients needs a download from his SAP-system (ECC 6.0) including all postings that are not cleared yet. What we did is a download from FAGLFLEXA including information on segment split which is important to our client. Now we need to get the information on which items are cleared and which are not cleared yet. There is no field like this in FAGLFLEXA. A download from BSEG isn't helping that much either since due to the segment split we have n document lines in FAGLFLEXA and only one in BSEG. The vendor or customer is not named in FAGLFLEXA. Using the reconciliation account to match the entries is error-prone as well since the customer and vendor accounts behind one reconciliation account may be cleared separately. Does anyone know where to find information on cleared items in the newGL-tables? This the information on segment split is relevant to the client we can not just take a download from BSEG.
Thanks in advance for your help!
Regards,
MariaHi,
The DS is to get Payments done to Vendor. So the query based on it will provide you with list of outstanding payment that are overdue and my attract interest. Mainly a Finance department concern.
Second - there is a field in the datasource that defines the status of the document. Filter your query based on the field of your requirement and you'll get what you want.
STATUSPS - Status of the FI item (O = open, C = cleared)
Hope this helps
Raj -
Dynamic binding for table column
Hi,
I am using standard application and in a table (not ALV) i want to chnage the name of a column. Already a OTR is placed in it so am planning to do a dynamic bind for the text in the header. Kindly suggest ways.
Thanks,
KoushikDATA:
l_caption TYPE string,
l_title TYPE string.
data lr_caption type ref to cl_wd_caption.
*---Get OTR Text for Value Description
CALL METHOD cl_wd_utilities=>get_otr_text_by_alias
EXPORTING
alias = 'ZPERF_MGMT_DEV/RATING'
language =
RECEIVING
alias_text = l_title.
lr_caption ?= view->get_element( 'TBL_VAL_HELP_DESCRIPTION_HEADER' ).
lr_caption->set_text( value = l_title ).
Maybe you are looking for
-
I'm using iWeb and .mac to create a video game website. I put the game reviews and description on my blog pages. Recently people have informed me that they can only see half of my review page when using Internet Explorer. I have tried 3 different PCs
-
My Hp smart print bing bar disappeare​d - I would like to know how to get it back
HP 6500A Printer - Windows 7 Where did my bing bar for smart print go & how do I get it back Thanks
-
Determining in BI or in the queries which Factory Calendar to use
Hello, Need some help? Any input would be much appreciated. Basically I am creating a query in BI 7.0 based on Utilisation for a particular business Unit. However, I need to define or incorporate somewhere, to use the GB Factory Calendar. I have done
-
Are there any known issues with Yosemite (iMac/Intel)?
I have seen reported issues with Wi-Fi, Interrnet connection, and ethernet. Are these still valid concerns at this point - or has the OS been updated?
-
Is it possible to adjust the sound level at the beginning and end of a section in FCE?