Building an ODATA Service
Throughout this documentation, you will model an OData service, deploy and test it and finally consume it by an appli- cation running on JustPerform Cloud.
Note: All objects are saved in the local package $TMP in this example.
Create OData Services Using ODP (Extract Data Sources)
Creating RFC Destination
Tcode : SM59 , Create RFC Destination with connection type :3
Create ODATA Service for BW/4 HANA
Create Project & Service
-
Go to transaction SEGW, and create a new project by clicking on the New button.
-
Enter the project Name and description
-
Expand Project and select Redefine->OPDExtraction from context menu.
A three-step wizard opens, input the following in step-1:
-
RFC destination: None
-
ODP Context: BW/4 HANA
-
ODP Name: Select Info Object
-
-
Click on Add ODP button & click Next
-
Enter description for Model & Service and click Next
-
Select all nodes and clickFinish.
Model (prefix _MDL) & service (prefix _SRV) names are pre populated.
Service Maintenance & Activating Odata Services
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 AddSelectedServices button. Screen returns to transaction /IWFND/MAINT_SERVICE
Selectthenewlyaddedserviceandclick onAdd System Aliasonbottom right
A pop-up appears with prefilled alias details, click Save to save the system alias.
ClickonSAP Gateway Client buttononbottomleft.
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
Activating OData Services
To activate OData services, proceed as follows.
-
Call transaction SICF.
-
Skip filter selection screen by clicking Execute(or press F8).
-
Navigate to tree node default_host sap opu OData to activate all OData (V2) services. Alternatively, to activate an individual service, navigate to the corresponding node deeper in the tree.
Right-click on the OData service node and select Activate Service from the context menu to activate all OData services.