Overview: This blog will guide you through the steps to enhance the system generated OData service In BW4HANA.
Prerequisites:
- SAP BW4HANA – SAP BW Query
- SAP BW4HANA – OData Services
In BW4HANA Odata service can be generated automatically from BW query by clicking checkbox “By Odata”, this service is then can be activated in any SAP Gateway system and consumed from there.
In case of any requirements to enhance the system generated service below steps can be followed.
Steps:
Step 1: Generate OData service from BW Query.
Step 2: Create a project in t-code SEGW. Please remember <Project Name>_SRV is going to be the new service name, so please name the project accordingly.
Step 3: Right click on the Data Model and click on “Redefine” -> “OData Service (SAP GW)
Step 4: In this screen it will ask for a service where we need to select the system generated service that needs to be enhanced and click “Next”
Step 5: Click Select all and click on Finish
Step 6: Enhance the Result set with new field and Save.
Step 7: Right click on project and click on “Generate Runtime”
Runtime artifacts will be generated like shown below
Step 8: Go to DPC_EXT (Data provider extended class)
Select GET_ENTITYSET method and click on Redefine button
Step 9: Write the logic to populate the newly added field here. Super class get_entityset code will be shown by default, start the new logic after the default code. Please note that this code will be executed for each and every row in output.
Step 10: Test the output of OData service.
Go to TCODE /IWFND/GW_CLIENT, give the URL in Request URI and click on execute.
Validate the output with written logic.