Hi,
Below is the payLoad I am passing from WEBIDE to back-end(ECC). I want to send this date to back-end OData invoking '/IWBEP/IF_MGW_APPL_SRV_RUNTIME/CREATE_DEEP_ENTITY' but it actually triggers
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_ENTITY. Navigation property in the back-end is Ydept_Id. I have redefined both above mentioned methods (currently no code written as I want to check which method is getting invoked). May I know what mistake I am doing, ...anything with the payload in the below code ?
crtEmpRecord:function(){
var depId = this.getView().byId("deptId").getValue();
var depNam = this.getView().byId("deptname").getValue();
var empId = this.getView().byId("empId").getValue();
var empNam = this.getView().byId("empName").getValue();
var empAray = [];
var obj1 = {
"YempId": empId,
"YempName": empNam,
"YdeptId": depId
};
empAray.push(obj1);
var finData = {
"YdeptId": depId,
"YdeptNam": depNam,
"Ydept_Id": empAray
};
this.getView().getModel("local").create("/Department_1Set", finData, null, function(oData, oResponse)
{
sap.m.MessageBox.show("Employee Record Successfully Created");
}
);
}
Request clarification before answering.
Thank you all for your inputs. I am closing this thread as it looks like the reason is not the above SAPUI5 porgram but the back-end OData implementation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vekanta,
To access create deep entity you must have navigation to some other entity. If you already have then use below code.
var payload = {};
//Put value of the header entity here . In my case it is Matnr .
payload.Matnr = '12345';
var empAray = [];
var obj1 = {
"YempId": empId,
"YempName": empNam,
"YdeptId": depId
};
empAray.push(obj1);
//put your array in navigation entity.In my case name of my Navigation entity is NAVMARC
payload.NAVMARC= empAray ;
this.getView().getModel("local").create("/Department_1Set", payload , null, function(oData, oResponse)
{
sap.m.MessageBox.show("Employee Record Successfully Created");
}
);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Venkata,
The syntax you are using for .create method seems to be incorrect.
I believe you are using oData model v2.
.create method should have 3 parameters whereas your request has 4.
create(sPath, oData, mParameters?) : objecthttps://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataModel
Please check.
Thanks,
Vaibhav Maheshwari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Does your target Entity has Associations and Navigation to other entities?
Kindly check this link once.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
there are many steps to achieve deep insert.
have you done all ?
what steps/blog you are following?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Vaibhav. Just want to let you know that it actually is working fine now when I changed the OData service. Which then means that there is some issue with my OData implementation. So doens't look to be an issue with SAPUI5 OData.create.
But since you have touched the point, ..SAP site tells that create method on OData may not insert deep structure. But it actually is inserting...like in my above case. Is not this confusing or I am not following.
-----------
create
Trigger a POST request to the OData service that was specified in the model constructor.
Please note that deep creates are not supported and may not work.
----------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I know how to create a deep insert, ...I mean, I have done it in the past. But this time when I doing it my request go to Create_entity and not create_deep_entity.
May I ask you one question ....
If both the below methods are redefined, then based on what request the method gets invoked. I mean, when does the first method gets invoked and when does second method gets invoked.
1) /IWBEP/IF_MGW_APPL_SRV_RUNTIME/CREATE_DEEP_ENTITY
2) /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_ENTITY
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.