Mentor SAP

Advanced, Intermediate, and Basic Interfaces

When you implement the methods of the basic interface, you will get a working OData V4 service that will satisfy most requests. Complex requests such as $expand are then handled by the framework that will call the methods for the basic interface in the correct order.

 

However, the implementation of the intermediate or advanced interface should also be taken into account if your service implementation would be able to handle specific requests, such as specific $expand or navigation calls, more efficiently than by calling the methods of the basic interface recursively.

 

 

ToDo Flags

The SAP Gateway V4 framework has introduced so-called ToDo flags, which provide a hint for the application developer as to what his implementation has to do. Depending on the query options that have been used in the request, you will get a simple list with boolean values for the following flags:

 

deltatoken, select, filter, skip, orderby, skiptoken, search, top, …

 

 

 

Done flags confirm that the response fits to the request. They allow the application developer to inform the framework to handle feature generically, for example, $top, $skip, and $select. Using such flags also allows an implementation to be compatible in the future. Instead of a wrong result, an exception will be raised if a Done flag is not set.

 

The list of ToDo and Done flags will vary depending on the method that is called (READ; READ_LIST, CREATE, …). For a simple GET request with a $filter query option,

 

…/SalesOrder?$filter=Customer eq ‚SAP‘,

 

a service implementation would have to look like as shown above.

 

At the beginning of our service implementation we have to check whether we have to handle the filter option. We call method io_request->get_todos. Then we have to check whether the ls_todo_list-process-filter flag is set. If yes, the filter string is requested via method io_request->get_filter_osql_where_clause and the flag that we have handled the filter query option is set in the ls_done_list structure. This information is, at the end, sent back to the framework via method io_response->set_is_done that takes the Done list as a parameter.

 

Generic Framework Support: $expand

As already mentioned, you will get a working OData V4 service by only implementing the methods of the basic interface. If a client calls the following URL:

 

GET .../ze2e001_salesorder/0001/SalesOrder('500000000')?$select=Salesorder,Customer& $expand=_Item($select=Salesorderitem,Product,Grossamountintransaccurrency,Transactioncurrency)

 

the SAP Gateway framework will call the above mentioned basic methods in your service implementation.

 

 

Conditional Requests