Hi,
Assume you want to add document number 123 into SAP table and you have GW service ready with entity having that field and corresponding entity set of it. and also you have instantiated model as
var sURI = getUrl( '/sap/opu/odata/sap/YOUR_GW_SRV/');
oModel = new sap.ui.model.odata.ODataModel(sURI, false),
sap.ui.getCore().setModel(oModel);
then you need to add below code on your button press event.
var oEntry = {};
oEntry.your_property_name = "123";
oModel.create('/YourCollection', oEntry, null, function(oResponse){
alert("Create successful");
console.log(oResponse);
},function(){
alert("Create failed");});
now in the success callback function, oResponse will have response payload information that you will fill into create_entity method of DPC_EXT class of OData service. Refer Create operation details in the blog Let’s code CRUDQ and Function Import operations in OData service!
Regards,
Chandra