on 05-26-2015 3:15 PM
Hi Friends,
It is an OData binding issue.
I am trying to display data of salesorderitems in the sap.m.table but was not able to bind using bind aggregation.
what i am trying to achieve is , for a given business partner there will be multiple sales order and each order will have multiple sales order items i want to bind those items in the sap.m.table using bind aggregation.
i have attached a screenshot in which i have marked the section which contains the data i need to read. that will be available in the above link.
code snippet for binding :
var model =sap.ui.model.odata.ODataModel("proxy/https/sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV/",true,'username','password');
App.setModel(model);
pastOrder_S3.bindAggregation("items","/BusinessPartners('"+businessPartnerId+"')/SalesOrders?$expand=SalesOrderItems",oTemplate_S3);
new sap.m.Text({
text:"{SalesOrderItems\ProductName} \n {SalesOrderItems\ProductId}"
}),
new sap.m.Text({
text:"OrderId: {SalesOrderID} \n {DeliveryDate} \n {TotalSum}{Currency}"
}),
new sap.ui.core.Icon({
src :"sap-icon://slim-arrow-right",
size:'15px',
color:'gray'
})
]
});
It will be helpful if any one can guide me.
Regards, Santosh.
Yes, we tried to fetch the details of the sub structure by using expand and by making an ajax call but was not able to get the solution.
can you share your ideas on how can we fetch the sub structure or any other way that we can solve this issue.
Regards,
Santosh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sakthivel Elango,Sergio Guerrero,
Thanks for the reply.
The code is not breaking and the data is also displaying, but it is not displaying the exact data which i need.
Sergio Guerrero : and the two text and one icon are inside a template which is binded to table and table is added to pages content.
code snippet:
var oTemplate_S3= new sap.m.ColumnListItem({
type: sap.m.ListType.Active,
cells: [
new sap.m.CheckBox("chkValue",{
select: function(e) {
debugger;
if (e.getParameters().selected) {
var row = e.getSource().getBindingContext().sPath;
var data=row.lastIndexOf("/");
var iDvalue= row.substring(data+1);
idData.data.push(iDvalue);
}
else {
var row = e.getSource().getBindingContext().sPath;
var data=row.lastIndexOf("/");
var iDvalue= row.substring(data+1);
for(var i=0;i<idData.data.length;i++)
{
var temp =idData.data[i];
if(temp==iDvalue)
{
idData.data.splice(i,1);
}
}
}
}
}),
new sap.m.Text({
text:"{SalesOrderItems/ProductName} \n {Note}"
}),
new sap.ui.core.Icon({
src :"sap-icon://drill-up",
size:'15px',
color:'gray',
press: function(oEvent) {
/*var myView1 = sap.ui.view({
type:sap.ui.core.mvc.ViewType.JS,
viewName:"my.own.view"
});
var myView2 = sap.ui.view({
type:sap.ui.core.mvc.ViewType.JS,
viewName:"my.own.view2"
});*/
// extend the Dialog instance with an individual function
oDialog.changeView = function() {
debugger;
this.removeAllContent();
}
oDialog.open();
}
}),
new sap.m.Text({
text:"OrderId: {SalesOrderID} \n {DeliveryDate} \n {TotalSum}{Currency}"
}),
new sap.ui.core.Icon({
src :"sap-icon://slim-arrow-right",
size:'15px',
color:'gray'
})
]
});
pastOrder_S3.bindAggregation("items","/BusinessPartners('"+businessPartnerId+"')/SalesOrders?$expand=SalesOrderItems",oTemplate_S3);
url for json format : https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV/BusinessPartners('0100000000')...
here we are trying to get all sales order items of all sales order of business partner whose id is 0100000000.
json structure:
"SalesOrderID":"0500000000",
"NetSum":"21737.00",
"Tax":"0.00",
"Currency":"EUR",
"ChangedAt":"\/Date(1432623600000)\/",
"Note":"EPM DG: SO ID 0500000000 Deliver as fast as possible",
"CreatedAt":"\/Date(1432623600000)\/",
"TotalSum":"25867.03",
"Status":"N",
"CustomerName":"SAP",
"BusinessPartnerID":"0100000000",
"QuantityUnit":"EA",
"Tax":"181.64",
"NetSum":"956.00",
"TotalSum":"1137.64",
"ProductName":"EPM DG: SO ID 0500000000 Item 0000000010",
"ProductID":"HT-1000",
"Position":"0000000010",
"SalesOrderID":"0500000000",
"Currency":"EUR",
"Quantity":"1.000",
"DeliveryDate":"\/Date(1433228400000)\/",
}
},
"SalesOrderHeader":{
}
]
}
if you see the above json structure, i am able to read child nodes like Notes , SalesOrderId etc. but there is a node named SalesOrderItems
which has sub child elements like "QuantityUnit":"EA". these are the elements which i want to display but not able to do.
i am missing out in reaching the sub child element as i am able to display the child element for "d".
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you check your console for any errors & post it ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.