‎2025 Mar 26 11:49 AM - edited ‎2025 Mar 26 12:34 PM
OData service is a comprehensive solution offered by SAP to create a secure and versatile integration between your SAP system and fiori or other non sap applications. OData (Open Data Protocol) is a protocol that builds on top of the REST framework to define best practices for building and consuming RESTful APIs. OData provides additional features and standards, such as enhanced query capabilities, standardized metadata, and support for different data formats. In SAP, ODATA service is created that can work integrated with the project created in Fiori environment.
Creating an Odata service:
T-Code SEGW:
1- Create (Necessary project and service names are made and created.)
2- Generate (The created service is generated)
After these operations, the objects in the network are generated:
Model provider classes:
This is where the names of entities and entities on the Odata side are managed - it can be thought of as a table/structure, so I have models on the Odata side, what can those models be: There may be products, vendors, etc., these have structures, fields. There can be structures where we can create these structures, update these structures, these structures are managed by the model provider class)
Data provider classes:
Operations such as updating the structures on the model provider side, data extraction are controlled, etc.
Extension classes:
If there is an extra operation to be done, these operations are done in extension classes, for example, we can think of user exits, extension operations in bady.
Technical model name:
Model definition language) is required for different objects and techniques for Odata.
Technical service name:
When Odata service is created, this part is added to the service, otherwise the service cannot be used.
Error analysis: T-codei: /IWFND/ERROR_LOG
After Generate, the objects, structures and classes to be generated are displayed in the green colored sections on the right side:
Service activation:
The following t-code to maintain and activate the service we created:
/n/IWFND/MAINT_SERVICE
After this process, we can now use this service.
From this screen we can come back and test to see if our Odata service is working and its basic metadata:
1-
2-
3-
Since we have not yet added a structure or other pattern to our metadata, no structure or field pattern will appear in the metadata.
We create a table to be added to our metadata:
Create an Entity type:
Go to the SEGW screen and right click on the Data Model folder, give Entity name and add the structure to be used:
With Medata, the fields of the structure to be used for metadata are specified:
In data exchange, there must be a key for the Entity type, which field is key is specified on this screen, while determining the key field, the way the table on the SAP side holds data and key fields are taken as basis:
With next to next operations we create the Entity type and Entityset:
After that, we re-generate our project so that the related classes and methods can be created.
Mapping operations of RFCs:
Function group is created
Create, Get, Get_list, Delete and Modify RFCs functions are created under the related Function group:
Now that our RFCs are created, we can map our RFCs to our ODATA service appropriately.
In another way, we can do this in data provider clusters (ext's), but we choose RFC mappings in this project because it is more practical and easier to manage the process.
Note:
Actually, we can write the codes we want in the relevant methods (EXT parts) of the Entity without adding RFC, when we right click on the method and say redefine, the parts where we can write code directly open. But I do not recommend it, it is not practical, creating with RFC is a more practical and more manageable method.
RFC Mapping is done by mapping the relevant RFCs to the processes in the service implementation section.
Right click, map data source and then propose mapping:
Sometimes it may not do it automatically, we may need to drag and drop from the data source section.
Key fields should be mapped as both input and output.
When we check again on the gateway side, we can see that the Entity set has arrived in the metadata:
With the Add Uri options button, when we select &metada, we can now see our fields in our metadata structure and in the metadata we can see information such as Entity, Metadata version, key fields etc:
As a result, our ODATA service on the SAP side is ready, now you can go to the Fiori environment and call our ODATA service, using the SAPUI5 library, you can integrate your SAP system with your Fiori application, thanks to this integration, you can securely manage your front end and backend data flows, you can create your necessary reports in the WEB environment using SAP data and you can perform your related CRUD operations with your Fiori applications.
- Finish-
I hope it has been useful for you.
Thank you for your time.
Request clarification before answering.
| User | Count |
|---|---|
| 10 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.