Hi,
The SAP OData connector works fine for Read operations, but currently only supports modifying operations (Create, Update, Delete) against a SAP Gateway service in SP02 compatibility mode. These have /sap/opu/sdata as part of their URL.
Here is an example of a create operation against the CRM Activity service on the SAP Gateway demo system:
Code:
Ext.define('ODataTest.model.Activity', {
extend: 'Ext.data.Model',
requires: ['Ext.data.proxy.OData'],
config: {
fields: [
{ name: 'Description', type: 'string' },
{ name: 'Owner', type: 'string' },
{ name: 'ActivityLocation', type: 'string' },
{ name: 'CategoryDescription', type: 'string' },
{ name: 'PriorityDescription', type: 'string' },
{ name: 'ContactPerson', type: 'string' },
{ name: 'ActivityPartner', type: 'string' },
{
name: 'SchemeID',
type: 'string',
defaultValue: 'IWCNT~OM_CRMACTIVITY'
},
{
name: 'ProcessType',
type: 'string',
defaultValue: 'ZKF5'
},
{
name: 'Value',
type: 'string'
}
],
proxy: {
type: 'odata',
url: "HTTP://GW.ESWORKPLACE.SAP.COM:80/sap/opu/sdata/iwcnt/activity/ActivityCollection",
withCredentials: true,
useHeaderAuthentication: true, // this enforces authentication, otherwise we get an empty collection.
username: 'GW@ESW',
password: 'ESW4GW'
}
}
});
var activity = Ext.create('ODataTest.model.Activity', {
Description: 'Plan sales meeting',
Owner: '12701' // this is the userid belonging to username GW@ESW
});
activity.save(function (record) {
console.log('Record saved');
});
It requires some trial and error to find out which fields to send in the Create (=POST) operation. Check out the error messsages coming back from Gateway, they sometimes contain useful hints.
Check out the following video for a demo of the OData connector:
http://www.youtube.com/watch?v=XVCP-rFxa_s
I hope this helps. Let me know if you need further help.