Hello OData ABAP experts,
as described e.g. in Let’s code CRUDQ and Function Import operations in OData service! implementing a "basic" CL*DPC_EXT class is straight foreward. Also we do not use RFC or BOR stuff to be OData'fied, so we are free to design code within the DPC_EXT itself.
To have "full" support, we like to implement as much as possible OData language like $filter,$orderby,$select and other URI options natively map them most efficient & generic to ABAP SQL.
As as result, we like to code in *_GET_ENTITYSET method something like:
SELECT (lv_columns) UP TO lv_mrows ROWS FROM (lv_table) INTO TABLE et_entityset WHERE (lv_where) ORDER BY (lv_order_by).
Unfortunately the interface for *_GET_ENTITY or *_GET_ENTITYSET is different e.g. io_tech_request_context->GET_OSQL_WHERE_CLAUSE( ) works in entityset but not in entity due to different tech_request_contexts.
The thing is how to obtain the lv_* values in a correct,generic and complete (support all OData features) way out of the SEGW generated interface...
* <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Protected Method XXX_GET_ENTITYSET * +-------------------------------------------------------------------------------------------------+ * | [--->] IV_ENTITY_NAME TYPE STRING * | [--->] IV_ENTITY_SET_NAME TYPE STRING * | [--->] IV_SOURCE_NAME TYPE STRING * | [--->] IT_FILTER_SELECT_OPTIONS TYPE /IWBEP/T_MGW_SELECT_OPTION * | [--->] IS_PAGING TYPE /IWBEP/S_MGW_PAGING * | [--->] IT_KEY_TAB TYPE /IWBEP/T_MGW_NAME_VALUE_PAIR * | [--->] IT_NAVIGATION_PATH TYPE /IWBEP/T_MGW_NAVIGATION_PATH * | [--->] IT_ORDER TYPE /IWBEP/T_MGW_SORTING_ORDER * | [--->] IV_FILTER_STRING TYPE STRING * | [--->] IV_SEARCH_STRING TYPE STRING * | [--->] IO_TECH_REQUEST_CONTEXT TYPE REF TO /IWBEP/IF_MGW_REQ_ENTITYSET(optional) * | [<---] ET_ENTITYSET TYPE XXX=>TT_XXX * | [<---] ES_RESPONSE_CONTEXT TYPE /IWBEP/IF_MGW_APPL_SRV_RUNTIME=>TY_S_MGW_RESPONSE_CONTEXT * | [!CX!] /IWBEP/CX_MGW_BUSI_EXCEPTION * | [!CX!] /IWBEP/CX_MGW_TECH_EXCEPTION * +--------------------------------------------------------------------------------------</SIGNATURE>
After searching usages of OData by SAP code itself I'm little bit disappointed. Every CL*DPC*EXT* code handles the *DPC* interface in a differenty way.
Is there a ABAP based best practice guideline (besides Creating High-Quality OData Services - SAP Gateway Foundation (SAP_GWFND) - SAP Library ) or generic classes (like io_tech_request_contect in and all lv_* parts out) to fulfill these "always the same" *DPC* to ABAP SQL mapping ?
What is your experience here ?
Thanks in advance,
Matthias