Skip to Content

Design Data Model

Perquisites:

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.

/wp-content/uploads/2015/11/1_827002.png

Enter the details as shown in below.

/wp-content/uploads/2015/11/2_827027.png

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


/wp-content/uploads/2015/11/3_827028.png


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.


/wp-content/uploads/2015/11/4_827029.png

Browse to select an xml or edmx file and click next.

/wp-content/uploads/2015/11/5_827033.png

/wp-content/uploads/2015/11/6_827034.png

Click Next you will see the Entity Types and Entity Sets as shown below.

/wp-content/uploads/2015/11/7_827035.png

/wp-content/uploads/2015/11/8_827036.png

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.

/wp-content/uploads/2015/11/9_827037.png

After creating the data model click on generate button over the top (Tool bar) as shown below.

/wp-content/uploads/2015/11/10_827038.png

Run time classes are generated successfully as shown in below.

/wp-content/uploads/2015/11/11_827039.png

Importing a Model File – Existing Project


Right click on the Start of the navigation path Data Model—> Import —> Data Model from File

/wp-content/uploads/2015/11/3_827028.png

Select Custom Import to select the objects manually from the model.

/wp-content/uploads/2015/11/19_827041.png

Click Browse to select and import an xml or edmx file and click next.

/wp-content/uploads/2015/11/20_827043.png

The Wizard Step 2 of 3: File Import window appears and displays the following status for the Artifacts.


1.New:

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.

/wp-content/uploads/2015/11/21_827044.png

2.Delete:

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.

/wp-content/uploads/2015/11/22_827045.png

3.Edit:

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.


/wp-content/uploads/2015/11/25_827051.png


4.Equal:

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.

/wp-content/uploads/2015/11/23_827046.png

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.

/wp-content/uploads/2015/11/24_827047.png

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.


Thanks&Regards,

Harikrishna M

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply