Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member207835
Participant

In this blog I will explain Creating Gateway service with all CRUD operations  Before starting, I am expecting that you have basic idea of gateway service and gateway service builder i.e SEGW

1. Create service in Gateway system with all the CRUD operations.(Create Read Update Delete)


Create project in SEGW (Gateway Service Builder).

Our Project looks as below.



    


Now we need to build our Data model, for that first Create the Entity type by importing an RFC Interface.

Give the Entity type name, RFC destination and name of the RFC to be imported and click on next


Select the required properties for the entity type.

Set key property for the entity type, here we will make Material as key then click on Finish.

Our Entity type MATR and its properties look as below.

Create Entity set with necessary entity type.

Give appropriate Entity set name and select the necessary Entity type then click on continue.

Our Project looks as below.

After creating Entity set Service implementation also created with empty CRUD operations which needed to be implemented by mapping with RFC/BOR interface.

Now we need save our changes within a request.

Now click on generate button to generate runtime artifacts.

Data provider and Model provider classes will be created. Click on ok.

Save the changes.

Runtime artifacts are generated and looks as below.

Now we need to implement all the CRUD operations in Service implementation.

Create

Read/Query

Update

Delete


CREATE: This is to create a new entry. Right click on create and choose Map to data source option.

Give the RFC destination name and select required RFC then click on ok.

Now click on propose mapping, the system will do mapping automatically or else we can do it manually for required fields. Here no need to map all the properties of the entity type; we will map only the required properties. We will do the mapping by drag drop from Function Module onto data source parameter of the Service operation.

Here all the required fields will have input mapping as below.

Here in our case we need to pass constant values for BASE_UOM, MATL_GROUP and BASIC_VIEW, we will do that as follows. First append the rows and maintain values under constant value tab.

Once mapping is done save your changes. Now we will implement DELETE operation.

DELETE: Right click on Delete and choose Map to data source option.

Give the RFC destination name and select required RFC then click on ok. Here we are mapping with BAPI_MATERIAL_SAVEDATA.

Do the required mapping as follows. Here we are passing Material, DelFlag, MatlGroup fields so do the mapping accordingly.

READ: Right click on Read and choose Map to data source option.

Give the required RFC and do the mapping as below. Here we are mapping Material, MatlDesc, IndSector, MatlType, MatlGroup, BaseUom fields. Except Material all are having output mapping.

Note: In READ operation all key fields should have input mapping, here in our example Material is key.

QUERY: Right click on Query and choose Map to data source option.

Note: In Query operation all key fields should have output mapping. Here we can also map ranges directly to pass range value for selection.

Give the required RFC and do the mapping as below. Here we are mapping with BAPI_MATERIAL_GETLIST

Here we will map MatlDesc property with appropriate Function field and our key property Material with range table, for that just drag drop that filed on to the data source field. Click on ok in the below screen.

Our mapping looks like below.

Here for display purpose we will again add Material property since all key fields should have output mapping in Query operation.

For this click on create button and choose the Material property and do the necessary mapping as shown below.

UPDATE: Right click on Update and choose Map to data source option.

Give the required RFC, Here we are mapping with BAPI_MATERIAL_SAVEDATA.Do the required mapping as follows. Here we are going to update MatlGroup Field.

After completing all the implementations save the changes and check for syntax errors.

Now again click on Generate button to regenerate the runtime artifacts.

Check the success messages.

With this we have successfully created a gateway service with implementing all CRUD operations.

In the next part Detailed step by step procedure for Creating Gateway Service with all the CRUD Operations and testin...

we will maintain our service and test it in Service Explorer


21 Comments
Labels in this area