Skip to Content
1
Jan 21, 2021 at 12:54 PM

OData v4 binding to SAPUI5 view table / SAP CAP

1981 Views

Dear experts,

I am using SAP CAP model to develop an application with Business Application Studio. I have CDS defined and data is being published as oDatav4 format.

This is my manifest.json file. Also default model is defined

    "dataSources": {
      "mainService": {
        "uri": "/srv-api/rooms/",
        "type": "OData",
        "settings": {
          "odataVersion": "4.0"
        }
      }
    }

.
.
.

    "models": {
     
      "": {
        "dataSource": "mainService",
        "preload": true,
        "settings": {
          "operationMode": "Server",
          "groupId": "$direct",
          "synchronizationMode": "None",
          "autoExpandSelect": true
        }
      }
    },

This is also my CDS odata

and here is my view.

                <Table
                    id="productsTable"
                    inset="false"
                    items="{
                        path: '/Rooms' 
                        
                    }"
                    class="sapFDynamicPageAlignContent"
                    width="auto">
                    <columns>
                        <Column width="12em">
                            <Text text="Office Area"/>
                        </Column>
                        <Column hAlign="End">
                            <Text text="Availability"/>
                        </Column>
                    </columns>
                    <items>
                        <ColumnListItem type="Navigation" press=".onListItemPress">
                            <cells>
                                <ObjectIdentifier title="{roomName}" text="{roomCountry} - {roomCity}"/>
                                <ObjectNumber
                                    unit="{roomSeatNumber}"/>
                            </cells>
                        </ColumnListItem>
                    </items>
                </Table>

Could you tell me where I am making a mistake while binding data in XML view? There is no data being transferred to view with this method. I am sure I am making some newbie mistake somewhere but still I'm not able to figure out.

I know that oDatav4 is not supporting direct access and i dont want to use jQuery/ajax get method to bind my data to view.

Thank you in advance.

Regards,

Erkan

Attachments