56 Views
Put cursor on UPDATE_ENTITY and click on redefine method.

Below screen will appear.

Write below code.

DATA :wa_emp TYPE ZCL_ZTEST_ODATA2_MPC=>TS_EMPLOYEE.
* Capture input value from Frontend into workarea wa_emp
CLEAR : wa_emp.
io_data_provider->read_entry_data( IMPORTING es_data = wa_emp ).
* Here we can use UPDATE or MODIFY depending on the requirement
UPDATE ZEMPLOYEE_1 SET name = wa_emp-name
WHERE emp_id = wa_emp-emp_id.
COMMIT WORK.
Save and Activate Method.

Now execute transaction code /IWFND/MAINT_SERVICE find service. Activate ICF node again and click on SAP Gateway Client.

Below screen will appear.

Click on EntitySets.

Get Entity ,Which you need to UPDATE (/sap/opu/odata/sap/ZTEST_ODATA1_SRV/EmployeeSet(EmpId=’00000001′).
Reason is to reuse payload.

Click on Use as Request.

Select Radio Button PUT, keep URL as it is.

Change value of description.

Execute.


Successfully updated Entity From Odata.

Now in next blog we will delete entry from table.