Fiori - Bind oData to SAPUI5 - Table
Dear All Gurus,
Need your expert knowledge on solving below simple matter..
I have created an oData(for customized app - Purchase Order Header and Line Items for MIGO transaction) and I am getting data successfully from oData but I am bit stuck in how to bind these Line Items Values to SAPUI5 table.
and below is a snapshot of Chrome Developer tool.
Code
var serviceURI = "proxy/http/--/sap/opu/odata/sap/ZMIGO_SRV/MIGOSet(GmCode='01',DocumentInput='2000006954')?$expand=MIGO_Navigation";
OData.request({ requestUri: serviceURI,
headers:{"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token":"Fetch" },
method : "GET",
user: "ABC",
password: "PW" ,
recognizeDates: true,},
Plz help.....
in the controller file of your view pls add this code where you have a reference of the Table that you want to show the data from the oData Service.
oTable.setModel("<yourModelName>");
oTable.bindRows("/Migo_Navigation/results", null, null,[ filter ]);
this is what I am seeing from the screen shot. you need to bind to the Item Collection or the entity set that is being returned for Line Items.
thanks
A
Similar Messages
-
Fiori getContext Detail page SAPUI5
Hello all
I am currently workign on Fiori like App using SAPUI5. I have successfully built the Master page, and on item click I set the context and navigate to Detail page.
The context path from Master page is something like "/SUPPLIER("NAME")". The function in App.controller.js is as follows:
handleListItemPress : function (evt) {
var context = evt.getSource().getBindingContext();
this.nav.to("Detail", context);}
But I would like to know how can I access this context in the deatil page. I need this because I need to use $expand to build the url and bind the items to a table.
Here is my Detail.view.js
sap.ui.jsview("sap.ui.demo.myFiori.view.Detail", {
getControllerName: function () {
return "sap.ui.demo.myFiori.view.Detail";
createContent: function (oController) {
var page2 = new sap.m.Page({
title:"Supplier",
class:"sapUiFioriObjectPage",
showNavButton:true,
navButtonPress: [oController.handleNavButtonPress,oController],
content:[list]});
var list = new sap.m.List("list2");
var itemTemplate = new sap.m.ObjectListItem({
title : "{NAME}",
type: sap.m.ListType.Active,
number : "{LIFNR}",
numberUnit : "ID",
attributes : new sap.m.ObjectAttribute("attr2",{text:"{CITY}"}),
press: [oController.handleListItemPress, oController],});
var test = this.getBindingContext();
list.bindItems(test.getPath()+"/MASTERDATA",itemTemplate);
Any suggestions would be highly appreciated.
ThanksHello Sakthivel,
You are absolutely right. Logically thinking, I could just bind the items to the list in the "to" function. Better said, I may not have understood the concept behind beforerendering. BUt, as you mentioned earlier, I paste the
console.log(oODataJSONModel); result here below:
F {mEventRegistry: Object, oData: Object, aBindings: Array[0], mContexts: Object, iSizeLimit: 100…}
aBindings: Array[1]
0: f
length: 1
__proto__: Array[0]
bCache: true
bLegacySyntax: false
iSizeLimit: 100
mContexts: Object
mEventRegistry: Object
mSupportedBindingModes: Object
oData: Object
CITY: "HAAKSBERGEN"
LIFNR: "0003100082"
MASTERDATA: Object
NAME: "CONCEPT In Flames B.V"
POSTZAHL: "5600 JZ"
STREET: "METAALSTRAAT 3A/C"
__metadata: Object
__proto__: Object
sDefaultBindingMode: "TwoWay"
__proto__: F
I also tried adding this line in the "to" function
var template = page.byId("STOREINFO");
list2.setModel(oODataJSONModel);
list2.bindItems("/d/MASTERDATA/results",template);
But, this time I get an error saying "Uncaught Error: Missing template or factory function for aggregation items of Element sap.m.List#Detail--test2 ! . Any ideas. -
Binding a column of table to column of rowset separately
when I binding a acolumn of table to the rowset ,if my table in database dosen't have any row to disply ,in this case happened an exception.
whate can i do for this problem?thanks for your attention,
the error is "Exception Details: org.apache.jasper.JasperException
javax.faces.FacesException: java.sql.SQLException: Invalid cursor position".
i think the reason is that,i want to get a value directly from the field of rowset .isn't it ? -
Passing value to bind variable of another table from one table
hi,
I have a multi select table. When one row is selected from this table (no button is clicked, only selection is done), an attribute from that selected row (say userid) should be passed to the bind variable of another table and the corresponding details of that particular userid should be displayed in the other table. When more than one row is selected, the other table should display no rows.
My main problem is what code has to be written to pass value to bind variable and where it should be written.
Please give me a detailed explaination as soon as possible.
Thank you.Sorry, didnot add this. The table is multi select table.
-
Upload excel file and display content in sapui5 table
hi:all
how to upload excel files and display its contents in the view of sapui5 table ,then 'create ' these data into the abap database using odataservice.
Do you have any solutions ? I appreciate for your help.Two possible way come to mind.
1. ADF DI (desktop integration): sorry, don't know enough about it to give a how to :-(
2. POI (http://poi.apache.org/) : open source project to read and write excel file with java. Using POI you can open the .xsl file, read it's contents and display it as af:table. For this you need to read the xsl into a data structure (this can be a temporary db table or a list of POJOs) and build a data control out of it. This you can drop on a page as table.
Timo
Edited by: Timo Hahn on 15.02.2010 13:59 -
Getting problem in binding DropDown List with table data in visual JSF
Hi All,
I am new to visual JSF.
I am getting few problems while working over components.
I have succeeded in binding data of Person table in a drop down list .
By just drag drop ..it worked.
But while connecting to external DB this drag drop mechanism didn't work for me .
1st problem that i faced was by dragging method columns are not visible when i did right click-> bind to Data -> DataProvider window .
But i am successfully printed table Data in backend ie: by putting
for(int i=0; i<xn_white_listDataProvider.getAllRows().length;i++){
System.out.println(" value :"+xn_white_listDataProvider.getValue("SUB_ID",xn_white_listDataProvider.getRowKey(Integer.toString(i))));
}I am not getting how to set Items in dropdown1
I tried putting
HelloSh.xn_white_listDataProvider.options['XNODE.XN_WHITE_LIST.SUB_ID, XNODE.XN_WHITE_LIST.SUB_ID'but it didn't work while for person data table
items="#{HelloSh.personDataProvider.options['PERSON.PERSONID,PERSON.NAME']}"it is working
when i am writting items="24,28" in dropdown1 box
& printing its value in static text Like
<webuijsf:staticText id="staticText3" style="position: absolute; left: 72px; top: 120px" text="#{HelloSh.dropDown1.items}"/> it is printing fine .
Plz help me in this regard.
Any clarification if needed plz let me know.
Thanks in advance.<h:selectOneMenu id="menu1" styleClass="selectOneMenu">
<f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList}*" />
</h:selectOneMenu>When we bind the list to the h:selectOneMenu the code in the JSP will be as given above.
My doubts here are
1) But when i tried to bind the list to a selectonemenu the code in the JSP is looking like this one
<h:selectOneMenu id="menu1" styleClass="selectOneMenu">
<f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList.regList.toArray}*" />
</h:selectOneMenu>2) Also in the runtime instead of displaying the values in the dropdown, i am getting the object names (javax.faces.model.SelectItem@680d0ccc) in the drop down.
What am I doing wrong? Any help here would be usefull for me.
BTW,
the code in the backing bean for setting the values is like this
List dropListValue = new ArrayList();
for (int x=0; x<result.length; x++){ //where result is array of string values
SelectItem tempSelect = new SelectItem();
tempSelect.setLabel(result[x]);
tempSelect.setValue(result[x]);
dropListValue.add(result[x]);
this.setRegList(dropListValue );The bean is in request scope only. -
Have problems creating the following SAPUI5 table
Have problems creating the following SAPUI5 table. Please see attached screenshot.
What have you tried so far?
can sure your code?
thanks
-D -
View with Bind Variable and ADF table
Hi all,
Please note what i have noticed. I created a view with a bind parameter, overriden the prepareSession of my Application Module to set the bind parameter and execute the query. I then created a simple jsf page and included the view as an adf read-only table. When i run the page, the prepareSession is called, sets the bind parameter, however the selected record of the table is always the second record (Not the first record).
This behaviour can be reproduced with the HR schema. Please follow the below instructions for reproducing the problem.
1. Create a Fusion Web Application (ADF).
2. Create business components from tables.
3. Create a new connection with the HR schema.
4. Import the Departments table as an entity and then click finish.
5. Create a view based on the Departments entity.
6. Modify the Query to include a where clause (where DDepartmentsEO.DEPARTMENT_NAME LIKE :BindParam)
7. Provide an order by clause (DepartmentsEO.DEPARTMENT_ID DESC)
8. Creata a bind variable named "BindParam" of type string.
9. Create an Application Module and include the view object.
10. Open the Application Module Class and override the prepareSession method
11. include the following code after super.prepareSession(session):
ViewObject myView = this.getDepartments1();
myView.setNamedWhereClauseParam("BindParam", "%");
myView.executeQuery();
12. Create a jsf page
13. Drag the view object on the page as an adf read-only table, selecting the Row Selection, Sorting and Filtering
14. Run the page.
You will see that instead of the first record being selected, the second record in the table is selected.
Can anyone please help me?
Thank youFirst of all i would like to thank you for replying to my thread.
Secondly, i would like to inform you that the example that i have provided is just for REPRODUCTION purposes.
The real scenario has to do with setting the where clause with the authenticated user so that the view will query for data only associated with the authenticated user.
The only way to overcome this behaviour is to include a view action (namedWhereClause in the page definition)
However, this is not how i want to implement this. This was working properly in 10g -
LOV(af:selectOneChoice) with bind variable in af:table
Hi All,
I have a table where a column is defined as dropdown(af:selectOneChoice). The query for selectOneChoice has a bind variable which needs to be set as a value from the base view Object corresponding row.
Suppose a table Employee
EmpId EmpName EmpType Authorization
101 John Temp No
The above table is created as af:table and 'Authorization' is implemented as dropdown(af:selectOneChoice) . The selectOneChoice has a query(AuthorizationLovVVO) with bind variable . For each row of af:table(EmployeeVO) , af:selectOneChoice query(AuthorizationLovVVO) requires
the corresponding row(EmployeeVO) 'EmpType' to be set as value of bind variable.
Can you please suggest how can we achieve this functionality.
Edited by: 907302 on Oct 17, 2012 7:22 AM
Edited by: 907302 on Oct 17, 2012 7:22 AMI have checked the following post where it has been suggested to access the the current row value as groovy expression.
groovy for bind variable
Suppose my AM name is 'TestAM' , i have tried the below expressions for value of bind variable but it does not work :
1) adf.object.TestAM.findViewObject('EmployeeVO1').currentRow.EmpType
2) adf.object.TestAMDataControl.findViewObject('EmployeeVO1').currentRow.EmpType
None of the above expressions work and i get the error while running the page as 'Variable NotesAM is not recognized.' / 'Variable NotesAMDataControl is not recognized.' .
Can you please suggest if we can achieve the functionality using this approach . Also let me know if i am missing something in the above expression. -
How to display(binding) values in the table from more than one node?
Hi,
I have two nodes (TRIPS & AMOUNTS)in the context. How to bind these values into the table control?
When i bind second one, first one is getting replaced.Hi Mog,
Of course it is possible to create a table from attributes of more than one node, and in some cases this is still necessary, but you have to do this the hard (manual) way.
If you have a table control, have a look at the properties and the elements belonging to it.
First of all, there is the property "dataSource", which binds to a multiple node (let's name it TableRootNode). This means that for each element of THIS node, one row is created. In each row the data of exactly one element of this TableRootNode is displayed.
Then you have columns in this table. Inside of the columns there is a header and an editor. The editor is the interesting part.
Normally the primary property of this editor is bound to an attribute of the TableRootNode. Then everything works as expected. If it binds to an attribute of a subnode (SUB) of TableRootNode, then in row i the data of the subnode of the i-th element of TableRootNode is displayed. There is no need for SUB to be a multiple node, but it must not be a singleton.
If you bind a property of the editor to an attribute, which does not lie in the subtree of TableRootNode, then you will see the same value in each row.
Now it depends on the structure of your context. Take the node, which is relevant for the change in each row (I assume it is TRIPS) and bind the table to the node as you are used to. Then for each additional column, you have to create a new column in the tree, create a new header element with a title and a new editor (e.g. textview or inputfield) and then bind the right property of the editor to the corresponding attribute in node AMOUNTS).
If these 2 nodes do not have parent-child-relationship, the tip to create a new node, which consists of the attributes of both nodes is the only solution.
Ciao, Regina -
How to use bind variable value for table name in select statement.
Hi everyone,
I am having tough time to use value of bind variable for table name in select statement. I tried &p37_table_name. ,
:p37_table_name or v('p37_table_name) but none worked.
Following is the sql for interactive report:
select * from v('p37_table_name') where key_loc = :P37_KEY_LOC and
to_char(inspection_dte,'mm/dd/yyyy') = :P37_INSP_DT AND :p37_column_name is not null ;
I am setting value of p37_table_name in previous page which is atm_state_day_insp.
Following is error msg:
"Query cannot be parsed, please check the syntax of your query. (ORA-00933: SQL command not properly ended) "
Any help would be higly appreciated.
RajInterestingly enough I always had the same impression that you had to use a function to do this but found out from someone else that all you need to do is change the radio button from Use Query-Specific Column Names and Validate Query to Use Generic Column Names (parse query at runtime only). Apex will substitute your bind variable for you at run-time (something you can't normally do in pl/sql without using dynamic sql)
-
How to use a bind variable in a table-validated flexfield
Hi,
I want to prepare a table-validated descriptive flexfield, which uses as source a select statement.
So, in the form "Validation table information" I use as table name the statement:
(SELECT my_procedure('test_value') FROM DUAL)
Up to here it works fine.
But instead of 'test_value' I want to use the value of a field in the form or a value of another flex (using $FLEX$ bind variables).
Please advice if it is possible to perform this in "table name" statement. I use it in "where/order by" clauses and it works fine.
Thank you.Hi,
I have posted in the place where you did advise,
https://forums.oracle.com/thread/2560192
but they reply there that this is an EBS question, with no much relation to dev tools in general.
Please, can I continue in this place with this question?
Thank you. -
Can not Update/Execute Bind Variable in af:Table or items
Hi Experts,
it will be very helpfull if any one can help me regarding following issues.
I am using JDeveloper/ADF11g . created af:Table in jsx page and want to be executed by passing/assigning Bind Variable as runtime backing bean by any event or during form loading event.
I had write code as below to execute , it works error free but not execute in af:Table .
Please HELP me.
public void mtBindAss() {
String amDef = "CPS.model.CPSAppModule";
String config = "CPSAppModuleLocal";
ApplicationModule am =
Configuration.createRootApplicationModule(amDef, config);
ViewObject vo = am.findViewObject("EmpBranchView1");
// Set the two design time named bind variables
//vUSERID is Bind variable
vo.setNamedWhereClauseParam("vUSERID", null);
vo.setNamedWhereClauseParam("vUSERID", "value");I have tried to execute by this way
vo.executeQuery();// it returns executed amount of row counted value
System.out.println("Executed Row"+vo.getRowCount());Also I have tried to execute by this way
oracle.binding.BindingContainer bc;
bc = BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding op = bc.getOperationBinding("Execute");
op.execute();
}VO query
SELECT VwEmpbank1.ADDR1,
VwEmpbank1.BANK_NO,
VwEmpbank1.BRANCH_NAME,
VwEmpbank1.ROWID,
VwEmpbank1.RT_NO,
VwEmpbank1.USER_ID
FROM VW_EMPBANK VwEmpbank1
WHERE USER_ID=:vUSERIDThanks.
zakir
=======
Edited by: Zakir Hossain on May 14, 2009 11:21 AMZakir,
Some brief comments:
1). Doing this via the binding layer is the "better" way if you can (instead of instatiating an AM like that). However, you need to create a binding for ExecuteWithParameters, not Execute. If you're not able to specify the actual parameter values in the pagedef, you can also get the parameter map from the operation binding and set the values that way.
2). If you want the query to execute on page load, you can create an invokeAction binding in the page definition to invoke the ExecuteWithParameters action. Just set the proper refreshCondition.
Hope this gets you going in the right direction. -
Support for Array Binding and PL/SQL tables (IN, INOUT, or OUT)
I have attempted, unsuccessfully, to use array binding in stored procedure/function calls where the sp/sf has parameters that are PL/SQL tables. I have seen the topic floating around in this forum, but I have not seen the explicit questions:
- Does ODP.NET support PL/SQL tables as IN, INOUT or OUT parameters to stored procedures/functions?
- Will any planned ODP.NET release support PL/SQL tables as IN, INOUT or OUT parameters to stored procedures/functions?
I am aware that I can use REF CURSORS to handle the OUT situation, but I need to make a design decision concerning supporting parameters of IN and INOUT PL/SQL tables.
Thanks.
JamesYou really MUST do this!! - i.e. include support for PL/SQL table parameters (IN INOUT and OUT) in a future release of ODP.NET.
PL/SQL tables are a fundamental type in Oracle stored procedures and you will be preventing a huge number of existing projects from migrating to .NET if you don't acknowledge them as part and parcel of Oracle programming.
I sincerely hope support for PL/SQL table parameters is treated as a serious issue.
Think what a coup it would be for you over Microsoft (who don't currently support PL/SQL tables with their .NET native provider for Oracle and don't look as if they will at least in the short term)!
Please, please, please! -
Can we bind a single external table with multiple files in OWB 11g?
Hi,
I wanted to ask if it is possible to bind an external table with multiple source files at same or different locations? Or an external table has to be bound to a single source file and a single location.
Thanks in advance,
Ann.
Edited by: Ann on Oct 8, 2010 9:38 AMHi Ann,
Can you please help me out by telling me the steps to accomplish this. Right click on the external table in project tree, from the menu choose Configure,
then in opened Configuration Properties dialog window right clock on Data Files node and choose from menu Create -
you will get new record for file - specify Data File Name property
Also link from OWB user guide
http://download.oracle.com/docs/cd/B28359_01/owb.111/b31278/ref_def_flatfiles.htm#i1126304
Regards,
Oleg
Maybe you are looking for
-
Sender Mail adapter configuration with attachment
Hi, I read the below blog regarding the mail adapter /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step I have the same requirement but the attachment file is not an XML, it is CSV file so in the module tab
-
Thought something was wrong with my iMac, but found that the new OS will no longer allow me to sync contacts and my calendar with my iPhone unless I do it with iCloud. Do not want to sync remotely and am disappointed that there seems to be no option
-
Dual Layer DVD...
I want to burn my movie onto a dual layer DVD. There is a selection in DVDSP4 for dual layer, but how do I prep it for a lower compression/dual layer option in Compressor?
-
Full backup of the KM without backing all the SAP EP 7.0
Hello, I want to know how can I do a Full backup of the KM without backing all the SAP EP 7.0 Thank you in advance. Pablo Mortera.
-
HP Pavilion 15 Notebook PC charger
Hi My laptop charger randomly stopped working it used to be fine, now whenevr i plug it into my laptop it says its plugged in but not charging? i have only had this laptop for 5 months and the charger is playing up. If anyone knows what action i sho