Method Not Allowed in sapui5

2.1k Views Asked by At

I followed step by step the following guide to build a simple master-detail app using Northwind ODATA service.

https://developers.sap.com/israel/tutorials/hcp-template-mobile-web-app.html

When I tried to run the app I got the following errors :

enter image description here

Browser console Error

I am running this app in --disable-web-security --user-data-dir mode. What could be the problem? How should I proceed?

2

There are 2 best solutions below

1
On

the tutorial is showing a form, but the template ist creating a table. I just replaced the table with the form (+ namespace ) and it worked.

use this code for your Detail.view.xml:

<mvc:View controllerName="north2.north2.controller.Detail" xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:semantic="sap.m.semantic"
    xmlns:f="sap.ui.layout.form">
    <semantic:DetailPage id="page" navButtonPress="onNavBack" showNavButton="{device>/system/phone}" title="{i18n>detailTitle}"
        busy="{detailView>/busy}" busyIndicatorDelay="{detailView>/delay}">
        <semantic:content>
            <ObjectHeader id="objectHeader" title="{ProductName}" number="{ path: 'UnitPrice', formatter: '.formatter.currencyValue' }"
                numberUnit="{QuantityPerUnit}"></ObjectHeader>
            <IconTabBar id="iconTabBar" class="sapUiResponsiveContentPadding">
                <items>
                    <IconTabFilter id="iconTabBarFilter1" icon="sap-icon://hint" tooltip="{i18n>detailIconTabBarInfo}"></IconTabFilter>
                    <IconTabFilter id="iconTabBarFilter2" icon="sap-icon://attachment" tooltip="{i18n>detailIconTabBarAttachments}"></IconTabFilter>
                </items>
            </IconTabBar>
            <f:SimpleForm columnsL="1" columnsM="1" editable="false" emptySpanL="4" emptySpanM="4" labelSpanL="3" labelSpanM="3"
                layout="ResponsiveGridLayout" maxContainerCols="2" minWidth="1024" title="{i18n>tab_product_sub_title}">
                <f:content>
                    <Label text="{i18n>label_CategoryID}"/>
                    <Text text="{CategoryID}"/>
                    <Label text="{i18n>label_ReorderLevel}"/>
                    <Text text="{ReorderLevel}"/>
                    <Label text="{i18n>label_Discontinued}"/>
                    <Text text="{Discontinued}"/>
                </f:content>
            </f:SimpleForm>
        </semantic:content>
        <semantic:sendEmailAction>
            <semantic:SendEmailAction id="shareEmail" press="onShareEmailPress"/>
        </semantic:sendEmailAction>
    </semantic:DetailPage>
</mvc:View>

regards

0
On

I found the correct answer on SCN. https://answers.sap.com/questions/653830/sapui5-odata-method-not-allowed-problem.html

you should disable batch for that OData model in your manifest.json like this

"models": { "yourModel": { "dataSource" : "yourDataSource", "settings" : { "useBatch" : false } } }