Design Data Model
Should use any deployment either Hub or Embedded. In this Blog I’m Using Embedded deployment.
Core Components (SAP Net Weaver Stack):
SAP Net Weaver 7.0 and 7.01
- GW_CORE 190
- IW_FND 240
SAP Net Weaver 7.02, 7.03, and 7.31
- GW_CORE 200
- IW_FND 250
SAP Net Weaver 7.40 and higher
- SAP_GWFND 740: SAP Net Weaver Gateway Foundation 7.40
Create a Project:
In Order to work with Net weaver gateway building O Data Services, one should have a basic knowledge of ABAP & OOABAP.
Creating a project is simple, we can go and create a project in service builder (SEGW) in back end system.
Enter the details as shown in below.
Click on enter, Now project is created successfully.
Creating data model:
Now it’s time to create a data model as per the requirement. So here I’m creating the data model to importing Data Model from File.SAP Net Weaver Gateway provides many useful generator tools which allow you to develop services around RFCs, BAPIs, Dnipro screens, etc.
Importing Data Model from file is the one of the option for to copy a particular gateway service from one server to another server, the most time consuming part is to copy the data model manually by creating all the entities, entity sets, associations and navigation paths. Now to overcome this big trouble, there is a better way given by SAP. There is an option called “Data Model from File”.
The File Import function is developed to allow importing of the data model files defined by external model editors like Visual Studio (edmx files) and the metadata files types (xml) into the Service Builder to create a data model. The files can be imported into the Service builder for the following Project Types:
1) Service with SAP Annotations
2) Service with Vocabulary-Based Annotations
Importing a Data Model – New and Empty Project
Right click on the Start of the Navigation path Data Model—> Import —> Data Model from File
Import data using “Data Model from File” option SAP provide two options (i.e. Custom Import and Full Import).
Custom Import: To import a metadata/edmx file for an existing project, which already has a data model created (re-import). In this case, the existing data model is overwritten.
Full Import: To import a metadata/edmx file for a new project. In instances where you create a project and import a file.
In my case I’m “Importing a Data Model – New and Empty Project”, so that’s the reason Custom Import Option is greyed out. Shown below screen shot.
Select Full Import to overwrite the existing model. Follow the steps in the previous section “Importing a Data Model – New and Empty Project” to complete the full import.
Browse to select an xml or edmx file and click next.
Click Next you will see the Entity Types and Entity Sets as shown below.
Click on finish, go and check the model was created successfully and automatically corresponding Entity Types, Entity sets, Associations and Navigation Properties will be created. As shown below.
After creating the data model click on generate button over the top (Tool bar) as shown below.
Run time classes are generated successfully as shown in below.
Importing a Model File – Existing Project
Right click on the Start of the navigation path Data Model—> Import —> Data Model from File
Select Custom Import to select the objects manually from the model.
Click Browse to select and import an xml or edmx file and click next.
The Wizard Step 2 of 3: File Import window appears and displays the following status for the Artifacts.
If the imported file contains an artifact that is not present in the Data Model, then that artifact is displayed with the Status New. On selecting that artifact, a new entry is created in the Data model.
If the file does not contain the artifact that exits in the data model, then it displays Delete status. If you select the artifact, it is deleted from the data model. If this option is not selected, then data model remain unchanged.
If an artifact is available in both the file and in the Data Model, but if the one in file (file that is being imported) has some changes, then these artifacts have the status changed. You can choose to adapt the file changes in the data model. If this option is not selected, then the artifact in the data model remain unchanged.
If an artifact exist in both Data Model and in the file and if it is equal, then the artifact is disabled for selection. These artifacts are displayed with the Status Equal.
After select the Entity Types and Entity Sets then click on Next and then Click on finish, go and check the model was created successfully and automatically corresponding Entity Types, Entity sets, Associations and Navigation Properties will be created. As shown below.
Now you can redefine your methods write your own logic in the *DPC_EXT class. By using Import Data from file you can easily design model from existing model.