Introduction


With SAP NW Gateway SP08, there is an option to create OData service by importing search help. Please refer https://help.sap.com/saphelp_gateway20sp08/helpdata/en/29/4e9c1b65f3499cbec6365f59dfa3c8/content.htm


You will find some of the details at https://help.sap.com/saphelp_gateway20sp08/helpdata/en/77/ec405224753607e10000000a441470/content.htm

In this document, I will demonstrate creation of OData service based on search help BRF_SH_CUSTOMID (Search Help for Flight Customers).

Steps

1) Create project ZSEARCH_HELP. Right click on Data Model and Select Import–>Search Help. Provide Entity type name FlightCustomer and provide Search help (from F4 ) as BRF_SH_CUSTOMID and click Next button.

/wp-content/uploads/2014/05/shelp1_461098.jpg

2) Select parameters from RESULT_LIST which you want to include in search help and click Next. Here, I will select all parameters as shown below.

/wp-content/uploads/2014/05/shelp2_461123.jpg

3) Mark fields which you want to be key properties. Here I will select property ID as key property. Click Finish.

Note that Create Default Entity Set is marked by default and hence we need not to create Entity set as wizard will create it.

/wp-content/uploads/2014/05/shelp3_461135.jpg

As result of this step, entity type and entity set will get created as displayed below,

/wp-content/uploads/2014/05/shelp4_461146.jpg

4) Now we will do service implementation for Query and Read operation. first let’s do it for Query operation. Expand Service Implementation folder and right click on GetEntitySet(Query) operation and select Map to Data Source. Select Data Source Attributes as displayed below.

/wp-content/uploads/2014/05/shelp5_461155.jpg

Press Propose Mapping button which will enable system to select mapping automatically.

/wp-content/uploads/2014/05/shelp6_461164.jpg

5) Now let’s map GetEntity (Read) operation. Right click and select Map to Data Source. Select Data Source Attributes as mentioned above. Click on propose Mapping but as this is read operation, we need to provide input key to read it.Click on Insert Row button and add input key property. here I will select ID. then drag the ID parameter from right screen to Data Source Parameter. This will provide input key as ID.

/wp-content/uploads/2014/05/shelp7_461165.jpg

Now Check project consistency and if everything is okay then click on Generate Runtime Objects. This will generate runtime artifacts. Finally do the service maintenance which involves service registration. Click on Maintain which will open window for Gateway Client.

Service Testing

Let’s test Query operation with request URI /sap/opu/odata/sap/ZSEARCH_HELP_SRV/FlightCustomerSet

It will display the search help result as below. you can use $count, $top etc query parameters.

/wp-content/uploads/2014/05/shelp8_461127.jpg

Now let’s test Read Operation with URI /sap/opu/odata/sap/ZSEARCH_HELP_SRV/FlightCustomerSet(‘00000017’). Output will be as below,

/wp-content/uploads/2014/05/shelp9_461128.jpg

Closing Remarks

With the import wizard, it is very simple to create OData service based on elementary search help. please keep in mind below constraints. Reference https://help.sap.com/saphelp_gateway20sp08/helpdata/en/77/ec405224753607e10000000a441470/content.htm

The following are the constraints:

  • Only elementary search helps are supported. Collective search helps are not supported.
  • Search helps that call UI in their exit function are not supported, as this cannot be validated by the Service Builder.
  • At runtime, a query operation that is based on a search help data source can retrieve a maximum of 9,999entries.

Also note that

Only the search helps in the local SAP system can be used as a data source.

Please feel free to put your comments and suggestions.

Happy learning and Coding!

To report this post you need to login first.

4 Comments

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

  1. Deborshi De Sarkar

    Hi,

    I am trying to follow this document. But in my case here no options like Search Help from Data Model-> Import ..

    Can you please help me on this ..

    Thanks !!

    (0) 

Leave a Reply