Creating 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.
Select the CREATE button.
The below popup appears.
Provide project name, description and save in Local Object.
Now a project is created.
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.
The below pop up apperas.
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.
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.
Now here in the entity set we have the field ‘Carrid’ as the key.
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.
The below popup appears.
Provide a Entity Set name and choose F4 option to assign a entity type.
Here We have only one entity type and select this.
Select Continue.
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.
A popup screen appears with all the model provider class, data provider class and others. Select Continue.
Below successful message log appears after successful generation of the run time objects.
From the left side tree, all run time artifacts can be seen.
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.
Select Yes to continue.
The below popup screen appears. Now select Local Object.
Finally Select Continue button.
After registration the Status turns into Green. Now choose Maintain button.
Choose Cal Browser button.
Select Allow.
The below XML format appears in the web browser where we can see the service name and other details.
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
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
One comment