Go to DPC_EXT class in it FIND CREATE_ENTITY method and redefine method.
Below Screen will appear.
Write below code.
DATA : wa_iodp TYPE ZCL_ZTEST_ODATA2_MPC=>TS_EMPLOYEE.
* Capture Input record from frontend into WA_IODP
io_data_provider->read_entry_data( IMPORTING es_data = wa_iodp ).
* Insert into table ZEMPLOYEE_1
INSERT INTO ZEMPLOYEE_1 VALUES wa_iodp.
COMMIT WORK.
* Transfer Inserted records to frontend
er_entity = wa_iodp.
Save and Activate.
Go to Transaction Code /IWFND/MAINT_SERVICE.
Execute it by clicking on SAP Gateway Client.
Below screen will appear.
Click on EntitySets and select EntitySet Name.
First Get Entity Set by using url: /sap/opu/odata/sap/ZTEST_ODATA2_SRV/EmployeeSet(EmpId=’00000001′)
Reason for doing it that we often make mistake while creating payload hence we will fetch one record and will take that record for reference and change values for our operation.
Click on Use as Request.
Below screen will appear.
Select Radio Button Post and change values of key field.
Changed Entry.
Click on Execute ,change URL like /sap/opu/odata/sap/ZTEST_ODATA2_SRV/EmployeeSet than press execute else It will throw error.
Entries are there in Table.
Successfully Created record USING OData. In next blog we will update entry in table.