Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

create operation in ui5 odata .

$
0
0

Hi ,

 

Building an application in sap ui 5 consuming odata servces via nw gateway.

we are trying to perform CRU and querry operation from client ie the mobile application.

 

Facing an issue while creating a record .

 

Steps Followed :-

 

- created odata model with service url set to consumption model.

- created a new variable in JS as

 

var newentry = new object();

 

Set all the parameters required and calling create as below as per ui5 documentation.

 

 

create(sPath, oContext?, oData, fnSuccess?, fnError?)

Trigger a POST request to the odata service that was specified in the model constructor.

Parameters:

{String}sPathA string containing the path to the collection where an entry should be created. The path is concatenated to the sServiceUrl which was specified in the model constructor.
{Object}oContext?, Default:If specified the sPath has to be is relative to the path given with the context.
{object}oDatadata of the entry that should be created.
{function}fnSuccess?, Default:a callback function which is called when the data has been successfully retrieved. The handler can have the following parameters: oData and response.
{function}fnError?, Default:a callback function which is called when the request failed. The handler can have the parameter: oError which contains additional error information.

 

 

It is throwing XML parser error.

1.how do we pass the new entry in above method ? any conversions to be applied ?

we tried - omodel.create ("/aggregation name",new entry,null,successfn,errofn);

2.what is the use of oContext ?

3.apart from ui5 dev tool kit , any other in depth docs available to work with oData.please share.

 

 

Thanks,

Amit Nalawade.


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>