基于gateway实现odata(4)–查询选项4-orderby

上一节学习了$top, $skip, and $inlinecount,这一节学习的$orderby的使用。

更详细学习请参看:SAP Press – OData and SAP NetWeaver Gateway

ODATA学习(SAP Press – OData and SAP NetWeaver Gateway)第6.5.5章节,第280页

The $orderby query option allows you to define the sorting of your
result set. Order -by parameters are provided by the framework in your
Get_EntitySet method via the import table I T_ORDER. The table contains
an entry for each property provided in the $orderby clause.

一、地址http://bwnep:8917/sap/opu/odata/sap/ZSALE_SRV/ZTSALE_H?$orderby=Zmemid,Zsaleid,中传入的orderby 参数在Get_EntitySet类中的传入参数IT_ORDER中,有的英文的文档又说存在io_tech_request_context中,如下取得,得我使用的是IT_ORDER参数。

ODATA 中的Get_EntitySet方法基础实现,包含ORDER BY的使用,可参数SAP标准例子:https://help.sap.com/saphelp_gateway20sp08/helpdata/en/71/d07b52a3566f54e10000000a44176d/content.htm

二、在使用中,由于不确认传入需要排序的字段是几个,及传排序的字段名是什么,为了能用,所以新建立了一个通用的对内表进行排序的方法ZCL_ODATA_PUBLIC->ORDERBY

三、在[size=13.3333px]Get_EntitySet方法的最后增加入下调用,就能进行排序了,

更多的查询选项请参看$select ,  $filter , $top ,  $skip , $inlinecount , and$orderby。

留下一个回复

你的email不会被公开。