Technical Articles
Exposing SAP BW Extractors via ODP as an OData Service
Introduction
SAP ERP system SAP ECC or SAP S/4HANA is one of the leading ERP systems in market which enables the client to do business with ease by integrating different functional areas & its business processes seamlessly with in the IT environment of the organization. Any system that is new or old needs a continuous performance evaluation of business processes to keep the system running efficiently, basically to report the performance of the system. To do this another solution from SAP, a data warehouse solution SAP BW which has seamless integration with SAP’s ERP solution. SAP BW acquires data from SAP ERP and transforms data as part of ETL process and stores data that is read optimised for end user to consume through reporting. These report helps business owner to take right decision at right time to keep up the business performance of the organisation.
Although SAP BW is the preferred solution for reporting due to seamless integration and SAP delivered standard extractors which includes complex business logic to get data from different tables, function modules, programs, BAPI, etc and make data available for SAP BW to acquire.
With all these advantages still, some customer would opt out of SAP BW option and choose to design their custom data warehouse solution outside SAP eco system for various reasons. Due to rapid growth in cloud computing in recent years data warehouse application on cloud are becoming popular. With this approach the main bottle neck was unable to take advantage of complex business logic that are built-in into SAP delivered standard extractors.
Now with SAP’s ODP (Operational Data Provisioning) framework data from standard SAP delivered extractors can be push out of SAP ERP system into external systems via various methods. We shall restrict our discussion to one of the methods that is Exposing SAP Extractors via ODP as an OData Service. This means any external system that can read OData can be consumer of this service.
More information on ODP framework & different data extraction option is provided within ODP framework is available in the below SAP wiki page:
https://wiki.scn.sap.com/wiki/display/BI/Introduction+to+Operational+Data+Provisioning
Although below approach details on how to consume extractor data directly from ECC as a OData service, but any customer can still continue within SAP eco system using SAP’s own cloud data warehouse, SAP Data Warehouse Cloud which is a subscription based cloud solution.
SAP Extractors via ODP as an OData Service
Any SAP extractor that is whitelisted by SAP for ODP framework can be used to extract data from and expose that data as an OData service for consumption. And for extractors that are delta capable can extract delta data as part of ODP framework and make it available for any external system as an OData service for consumption is icing on the cake.
List of steps to be performed to make this possible can be broadly classified as
- Extractor setup
- Enabling ODP
- OData Service generation
Note: Extractor 0UCINSTALLA_ATTR_2 is considered as an example to discuss in this blog.
1. Extractor setup
This step is typical SAP BW extractor enabling step.
1.1 Activate Extractor
Go to transaction RSA5, expand sub tree and find extractor (in this example 0UCINSTALLA_ATTR_2)
1.2 Validate Extractor
To make sure extractor is active and to view the fields of extractor go to transaction RSA6, expand subtree and find the extractor.
Double click on the extractor to view the fields.
1.3 Test Extractor
To perform a test run, go to transaction RSA3 and type in extractor name (in this example 0UCINSTALLA_ATTR_2) and click on Extraction button
Click on ALV Grid button to view the data.
Additional information |
In case of any issue the test run of extractor may fail and it needs to be fixed before proceeding with next steps. Issues can be related to extract structure fields or authorization etc. |
2. Enabling ODP
Most of the extractor have ODP enabled. This can be verified by checking the ODP icon in RSA5/6 which indicates if the extractor is whitelisted by SAP or not.
Additional information |
In case, a standard extractor is not available in ROOSATTR table then implement latest version of SAP note 2232584 and run program BS_ANLY_DS_RELEASE_ODP to update the whitelist extractors into ROOSATTR table. Also similar to RSA3 the ODP enabled extractors can be tested with program RODPS_REPL_TEST which creates a dummy subscriber with ID RODPS_REPL_TEST in ODQMON (operational delta queue for ODP extractors) RODPS_REPL_TEST: Report to test ODP setup, acts an independent subscriber RODPS_OS_EXPOSE: Report to release customer-defined extractors for ODP. BS_ANLY_DS_RELEASE_ODP: Report to release standard extractors for ODP. |
3. OData Service generation
After ODP extractor is setup a service needs to be created to expose the extractor data. Follow the below steps to configure OData service.
Note: all objects are saved in local package $TMP in this example.
3.1 Create Project & Service
Go to transaction SEGW, create a new project by clicking on New button.
Enter project Name & Description
Expand Project and select Redefine -> OPD Extraction from context menu.
A three-step wizard opens, in step-1 input
- RFC destination: In case Gateway is on same system then choose same system)
- ODP Context: DataSource / Extractors
- ODP Name: Data Source Name
Click on Add ODP button & click Next
Model (prefix _MDL) & service (prefix _SRV) names are prepopulated
Enter description for Model & Service and click Next
Select all nodes and click Finish
3.2 Generate Runtime Objects
A pop-up appears with model & service names prepopulated. Click continue.
The generated runtime artifacts appear in the respective folder under project.
3.3 Service Maintenance
Go to transaction /IWFND/MAINT_SERVICE and click Add Service
Enter System Alias as LOCAL and click on Get Services button
Search the generated service (in this case ZBW_ODP_ODATA_SRV) and click on Add Selected Services button.
Screen returns to transaction /IWFND/MAINT_SERVICE
Select the newly added service and click on Add System Alias on bottom right
A pop-up appears with prefilled alias details, click Save button to save the system alias.
Click on SAP Gateway Client button on bottom left.
A new screen of gateway client opens. With relative path of service URL prepopulated.
Click on Execute button, to run the service and the response appears with status code 200 if there are no errors.
Also click on EntitySets button on top to view list of entities within the service.
To view the complete metadata of the service, use the url
http://<server>:<port>/sap/opu/odata/sap/<service name>/$metadata
Additional Information |
http://<server>:<port>/sap/opu/odata/sap/<service name>/EntifyOf<ODP name>/ (to view data in browser) http://<server>:<port>/sap/opu/odata/sap/<service name>/ DeltaLinksOfEntifyOf<ODP name>/ |
Conclusion
With this approach we can expose any extractor which ODP enabled to external systems using OData service. And this service can be delta capable provided extractor is delta capable.
Also to reemphasize that SAP’s own cloud data warehouse solution SAP Data Warehouse Cloud is available for customer who want to continue within SAP eco system.
The consumption of generated OData service is discussed in next blog: Consuming OData service based on ODP Extractor in Python
Very informative blog Pruthvi !!! Thanks...
Excellent ! Well done.
All right, nice tutorial! Seems that we need to do a bit of work to open extractors to OData, although CDS views are easier here with just one annotation and you get the service, right?
yes in CDS view it is much easier, from NW 7.50 onwards. Earlier versions had similar steps.
Hi Pruthvi,
I have created a CDS view and tried to consume data in OData using ODP but I got error in last wizard could not retreive the model name '__MDL' and version '0001'. Please find the error screenshot.
any help will be appreciated.
Thanks
ODP error screenshot
Got the same error
can somebody help me I cannot see de ODP extraction in the redefine option in the data model folder, can someone telme why?