Suppose, we have OData project in server A and if you want to create a OData project with the similar data model (i.e., Metadata such as entity type, entity set, complex type, association, Association set, function import etc.) in server B. It takes lot of time to create the data model manually and it is a difficult task. So to overcome this situation, one option is provided in service builder (SEGW) to upload the metadata file from local system to sap server therefore it will create the data model automatically using the metadata file.
Now we will learn how to achieve this
This involves mainly 2 steps
- Download metadata for a OData project and save it with .edmx extension
- Upload the metadata file to the project in the gateway service builder
Open Gateway for the required service using service builder or T-code /n/IWFND/GW_CLIENT
Execute the $metadata query to fetch metadata for the service
Copy the metadata manually from the HTTP response body and save it into notepad file with extension ‘.edmx’
Open the project where you want to upload the metadata file using T-code SEGW
Right click on data model -> Import -> Data model from file
Browse the file name from local system
Click on next. It will display all the data model created from metadata file in the pop up window
Click on finish to complete the process
Your metadata will be loaded to new project creating the data model.
Note : Only the data model can be downloaded and uploaded through this process. We can’t download/upload the logic in the methods, we need to implement it manually.
Generate run time objects and implement the logic by redefining the methods.
Copying in same server :
If we want to create a project with similar data model in the same server, we can make use of Copy options
Right click on Project -> Copy project
Enter the new project name and description
Click on yes, save it and generate run time objects