OData Basics – Part 2 (Read Operation)
Handling Read Operation in OData service:
We have one OData service available created as part of OData Basics – Part 1
Lets enhance the Data provider class [Note: All enhancements are done in extension class i.e., class name with suffix ‘EXT’. These EXT classes are sub classes of base class and can be enhanced by redefining methods]
Right click on Data provider extension class ZCL_ZRZ_SCARR_DEMO_DPC_EXT and navigate to workbench.
Redefine the SCARRSET_GET_ENTITY method
In that method, IT_KEY_TAB will bring the inputs
Using the key values, fetch the data from SCARR table and fill the exporting parameter ER_ENTITY. Write simple code shown in below screenshot:
Come back to Gateway service builder transaction after activating the changes in data provider class. Click maintain to test the changes..
Click “Call Browser”
Change the URL and pass input by referring the entity set as shown below and also find the results in the XML structure:
To debug and see how the data is being retrieved, pass additional parameter “sap-ds-debug=true”
Try to verify Request/Response tabs also..