oData- Part1

lightCreating a project, entity type, entity set, generating run time artifacts,registering the service  & checking the metadata.

 

 

The below post shows service creation by using the SCARR structure. Go to Tx- SEGW to create a project.

3

Select the CREATE button.

4

The below popup appears.

5

Provide project name, description and save in Local Object.

6

Now a project is created.

7

Now the next step is to create entity type>An entity type can be created in many way but we will use by importing DDIC structure. Right Click on Data Model and Import->DDIC Structure.

8

The below pop up apperas.

9

Provide ABAP Structure as SCARR and hit the enter key and automatically the Object name and fields are populated. The object name ‘Scarr’ can be changed if needed for a better name. Finally Continue.

10

Now entity type is created with name ‘Scarr’. Navigate along the left tree and double click on the filed Mandt. We don’t need this field , So select the line from the right list & delete it.

11

Now here in the entity set we have the field ‘Carrid’ as the key.

12

The next step is to create an Entity set which is nothing but a collection of Entity type( in abap terminology a table type). Right click on the Entity Set and select Create option.

13

The below popup appears.

14

Provide a Entity Set name and choose F4 option to assign a entity type.

15

Here We have only one entity type and select this.

16

Select Continue.

17

Now you can see, in the service implementation section(left side tree), many options appear. Now we have to generate Runtime Artifcats which means some model class and data provider class , model name & service name. The model provider class & the data provider class contains a base class & extension class and mostly we have to redefine the methods in the data provider extension class methods to get our read, query, create,update and delete operations.  Now select the generate button to generate the runtime objects.

18

 

A popup screen appears with all the model provider class, data provider class and others. Select Continue.

19

Below successful message log appears after successful generation of the run time objects.

20

From the left side tree, all run time artifacts can be seen.

21

Now we have to register the Service by using the Tx- /iwfnd/maint_service but from here also it can be done. Go to the Service Maintenance and double click on the system where service needs to be maintained. Select the Register button.

22

Select Yes to continue.

23

The below popup screen appears. Now select Local Object.

24

Finally Select Continue button.

25

After registration the Status turns into Green. Now choose Maintain button.

26

Choose Cal Browser button.

27

Select Allow.

28

The below XML format appears in the web browser where we can see the service name and other details.

29

We can change the URL last part as ‘$metadata’ to check the details of the service.

https://server address/sap/opu/odata/sap/ZSCARR_DEMO_SRV/$metadata

30

Also we can see the JOSN format by changing the last part of the url as ‘$format=json’

https://server address/sap/opu/odata/sap/ZSCARR_DEMO_SRV/?$format=json

31


 

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s