OData Basics – Part 4 (Insert Operation)
In this blog, let us see how to handle the Insert Operation. As discussed in previous blogs, any enhancement regarding business logic is done in Data provider extension class. DPC is highlighted in below screenshot:
In the blog OData Basics – Part 2 (Read Operation), we have enhanced the method SCARRSET_GET_ENTITY to retrieve the data..
To handle insertion operation, let us redefine the method SCARRSET_CREATE_ENTITY
The data that we get from request can be read using the importing parameter IO_DATA_PROVIDER as shown below:
All the metadata related to our service is available in Model Provider class..
In the first step, to define a work area – I have referred the DPC ZCL_ZRZ_SCARR_DEMO_MPC=>TS_SCARR
- Transaction /IWFND/MAINT_SERVICE – Activate and Maintain Services [We can activate and maintain service in SEGW transaction only – like we did in previous blogs]
- Transaction /IWFND/GW_CLIENT – Gateway client
First, read a record and use it as request for inserting fresh record:
Modify the record with values you want to insert into table as shown below..
Record is captured as shown below:
Execute POST method to insert the record:
Table got updated successfully..