Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

How to create Gateway service for query operation using ABAP Development Workbench

$
0
0

Introduction :

In this document you will learn how to create a gateway service using ABAP development workbench for a query type RFC.

Steps included in the creation are :

1. Creation of Gateway Data Model.

2. Creation of Query Operation.

3. Creation of Gateway Consumption Model.

4. Adding an Alias to the service.

 

Prerequisites:

1. Firefox Rest client Plugin to test the gateway service.

2. Access to a configured Gateway 2.0 SP3+ system.

 

Step 1 : Go to Transaction SE80. Set the object type drop down to GW Data Model and in Object name input field enter the name ztest_po_item_details.    

Click on the eye glasses button to create the data model. This Gateway data Model maps the Service to business data.

 

SS1.png

 

Click on the Yes Button.

 

Step 2 :  Choose meta model Type as 'PS' (Public Solution Model)  and select the option as "Generate from Data Source Object" using radio button. Click on continue button.

SS2t.png

 

Step 3 : Enter a suitable Description. Enter Data Source Type as RFC and  the System Alias (this is the alias that is connected to the back end system). Click on Continue button.

SS3.png

 

Step 4 : Enter your package name or save as a local object.

SS4.png

Step 5 : Click on Search button. Enter RFC name and click on continue button. (Here we are using a simple custom RFC with one input parameter for PO number and 1 output table with PO Item details)

 

SS5.png

 

Step 6 :  Select the added RFC object in left hand side by clicking on it and then click on create Mapping button.

 

SS6.png

Step 7 : Select the operation type as Query so that all the attributes of FM get displayed.

SS7.png


Step 8 : Now the Input attribute 'i_ebeln' needs to be set. We can either set some constant value or we can expose it as filterable value in the following way.To Change  mapping of input parameter I_EBELN, Click on Initial and then select Change Mapping Route. Then select the i_ebeln parameter from the pop up screen and click on Continue button.

 

SS8.png


Step 9 :   In Data Model details set key property for required fields by right clicking on attribute and selecting set key property.

 

SS9.png

 

Step 10 : To save the Data Model click on Generate button which will also generate all of its corresponding classes and configuration.

 

SS10.png

 

 

Step 11 : Click on Object Navigator Button. Right click on "Related GW Consumption model" and click on Add Consumpt. Model.The Consumption Model is what exposes the Gateway Data Models to the network.

 

ss11.png

 

Step 12 :  Enter a name for Consumption model and Continue.

 

ss12.png

 

Step 13 :  Click on Yes Button to create the Consumpt. Model.

 

ss13.png

 

Step 14 : Enter Description and Click on Continue button.

 

SS14.png

 

Step 15 : Go to Transaction /IWFND/MAINT_SERVICE and click on search button. Enter the Technical Service name and search. Then Click on the Service.

 

SS15.png

 

 

Step 16 : Click on Create System Alias button.

 

SS16.png

 

 

Step 17 : Click on New entries button. Enter the name of your Consumption Model and click on F4 Button.Then Double click on your service document in the popup window. In the System Alias column enter the alias of the system you want your service to call.         

SS17.png

Save your changes then hit the back button.

 

Step 18 : Click on Call Browser Button to launch a web browser for OData Service.

SS23.png

 

SS20.png

 

Step 19 : For example the url generated is :

http://seasrv05.abcdef.com:8000/sap/opu/odata/sap/ZTEST_PO_ITEM_DETAILS/?$format=xml

Now replace the end of url "?$format=xml" with "$metadata" .

 

SS21.png

 

Step 20 : Now replace "$metadata" with entity set name which is "ztest_po_item_detailsCollection" in our case, followed by " ?$filter=i_ebeln eq '3000000006' " which is a way to pass input parameter to query operation.

SS22.png


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>