cancel
Showing results for 
Search instead for 
Did you mean: 

Sample for Sap.m.Table item Odata binding with filter and expand (entityset) SAPUI5

Ramesh
Explorer
0 Kudos

Hi,

I am looking to bind table items for an expand set along with filter but unable to achieve it most of the examples are with respect to Sap.ui.Table looking for binding with sap.m.Table from SAP odata service. Someone point me to a sample code or link to lookup.

Thanks,
Ramesh

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member227918
Active Contributor
0 Kudos

Hello Ramesh,

as per your service response, binding should be as below, this will work-

<Text text="{POModel>NavItem/results/0/PoItem}"></Text>

or I am not sure whether response structure can be changed from backend, as per your current code (<Text text="{POModel>NavItem/PoItem}"></Text>) structure should look a like below:

              "NavItem": {

                "__metadata": {

                    "id": "*******/sap/opu/odata/sap/ZPO_SRV/ItemSet('00010')",

                    "uri": "*******/sap/opu/odata/sap/ZPO_SRV/ItemSet('00010')",

                    "type": "ZPO_SRV.Item"

                },

                "PoNumber": "4500008238",

                "PoItem": "00010",

                "Material": "",

                "NavSchedule": {

                    "__deferred": {

                        "uri": "*******/sap/opu/odata/sap/ZPO_SRV/ItemSet('00010')/NavSchedule"

                    }

                }

            }

Regards,

Akhilesh

venkatachala_ck
Active Participant
0 Kudos

Hi Ramesh,

Check out this link it may help you.

URI Conventions (OData Version 2.0) &amp;middot; OData - the Best Way to REST

Thanks

Venkat

Former Member
0 Kudos

Hi,

I have updated the Plunker for you needs, please check this - https://plnkr.co/edit/gG0uMhrqjFec2xzELCtS?p=preview

here I am expanding "Supplier" on "Product"

Odata link - http://services.odata.org/V2/OData/OData.svc/Products?$expand=Supplier

Hope this will help you

Thanks

Ramesh
Explorer
0 Kudos

Once again thanks for pointing out another example seems close but I am not able to achieve the binding please see the attached file for what I am trying to experiment the binding is not happening for expand don't know what I am doing wrong maybe you can spot it. Except that I am not dynamically doing the binding instead doing in xml view.

Thanks
Ramesh

saivellanki
Active Contributor
0 Kudos

Hi Ramesh,

It should be:


<Text text="{POModel>NavItem/PoItem}"></Text>

Regards,

Sai.

Former Member
0 Kudos

Hi Ramesh Neruganti,

As suggested by it should be -

  1. <Text text="{POModel>NavItem/PoItem}"></Text> 

Thanks,

Chandan Kalita

Ramesh
Explorer
0 Kudos

Sorry, I tried {POModel>NavItem/PoItem as well as {POModel>/NavItem/PoItem} but no luck when I copied I had the last tried one in the attached file.

Now I am suspecting if anything to do with resources version of SAPUI5 in Hana studio not able to interpret the SEGW generated ODATA service in SAP as far as binding is concerned. We are using HANA database do we need to be in particular service pack? Anyone had such version compatibility issues?

Thanks,
Ramesh

mantrishekar
Active Participant
0 Kudos

Hi Chandan,

In the Plunkr Code am able to see the below piece of code.

  oTable1.bindItems({

      path: '/Products',          

      parameters:{expand : 'Supplier'},

      template:oTemplate1

    });

In this code could you please explain "parameters:{expand : 'Supplier'}," this line.

And while binding text you are using {ID},{Description} how can we see those in the Odata.

Regards,

Shekar

Former Member
0 Kudos

try using

<Text text="{POModel>NavItem/results/PoItem}"></Text>

Former Member
0 Kudos

Sorry for the late response,

"parameters:{expand : 'Supplier'}," is for to use Expand query on the odata model.


more info on - http://www.odata.org/getting-started/basic-tutorial/#expand


Thanks and Regards,

Chandan

Former Member
0 Kudos

Hi,

A simple example is here - https://plnkr.co/edit/gG0uMhrqjFec2xzELCtS?p=preview

Odata service used - http://services.odata.org/V2/OData/OData.svc/

Note - I am using https://cors-anywhere.herokuapp.com/ to nullify the Cross Origin Issues.

Thanks,

Chandan

Ramesh
Explorer
0 Kudos

Hi Chandan, Thanks for your response, I am able to bind the sap.m table with no issues in a straight forward case but my issue is when  I use a filter and I have odata associations with expand dataset is what I am looking for.

For example if I use filter on sales order create date I want to see the header, item and schedule line details in a table. Which are odata expand entitysets. I get these details in a single call to odata service.

Thanks,
Ramesh