Creating odata services and sample get odata services call
Step 1: Start the Gateway Client (Transaction /IWFND/GW_CLIENT) in a separate window to run the service. Provide the following URI to get the metadata for the service:
/sap/opu/odata/sap/ZCREATE_project_SRV/$metadata
Step 2: Go to client transaction and select entity set as company code.Click on execute. The output is as follows. and select entity set as company code Click on execute. Then company code data will be displayed.
Step 3: Go to client transaction Select entity set has plant set Change the URI as shown below to display plant details for company code equals to ‘0005’ using filter functionality.
Step 4: Change the URI as shown below to display material details for plant equals to ‘0001’ using filter functionality.
refrence: https://blogs.sap.com/2017/03/09/step-by-step-guide-to-build-an-odata-service-based-on-company-code-to-get-plant-details-and-to-get-based-on-plant-details-to-get-material-details/