Skip to Content
avatar image
Former Member

Calling POST method from UI5

Hello,

I have an issue while calling my back end code via POST method from UI5(WebIDE).

My requirement is to create a sales order at back end while clicking button from UI5 App.

I have gone through lot of blogs and link, but unable to find what could be the issue.

Steps followed

(1) Created Odata service in back end and working fine as expected

(2) Create data source, models (in manifest.json file) and mapped the respective Odata service URI

(3) Created one button and assign the event

(5) Below code has been kept in that button event (Ref.Blogs:https://blogs.sap.com/2014/03/27/create-a-sales-order-using-the-deep-insert-create-request-with-odatamodel/).

(6) When i test this App, i get an alert " Call service creation failed".

(7) I tried checking errors in browser(F12), and i see 404 errors for $metadata, entityset, odataservice.

I kept external break point in my back end code too, but it did not stop. Hence i am not really sure whether this code is actually triggering my code or not.

Appreciate if you could check and provide me your concerns.

Thanks

ui5-odata-1.png (25.5 kB)
ui5-odata-2.png (16.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 26, 2017 at 05:47 PM

    Hello ,

    I got it, i found a small mistake while declaring service as shown below.

    It should be

    var serviceuri = "/S4H-COIL/sap/opu/odata/SAP/ZCOIL_PROCESS_SRV_01"-->Copied from manifest file

    Earlier it was

    var serviceuri = "/sap/opu/odata/SAP/ZCOIL_PROCESS_SRV_01"-->Destination(S4H-COIL) is missed.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded