Odata Helper
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
- class ZCL_ODATA_V2_HELPER definition
- public
- final
- create public .
- public section.
- class-methods PARSE_SELECT_FIELDS
- importing
- !I_SELECT type /IWBEP/T_MGW_TECH_FIELD_NAMES
- !I_STRUCT_DESCR type ref to CL_ABAP_STRUCTDESCR
- returning
- value(R_SELECT_FIELDS) type STRING .
- class-methods PARSE_ORDERBY
- importing
- !I_ORDER type /IWBEP/T_MGW_TECH_ORDER
- exporting
- !E_ORDERBY type STRING .
- class-methods GET_DATA_FROM_VIEW
- importing
- !I_KEYS type ANY
- !I_SELECT_OPT type /IWBEP/T_MGW_SELECT_OPTION
- !I_ORDER type /IWBEP/T_MGW_TECH_ORDER optional
- !I_TOP type INT4 optional
- !I_SELECT_FIELDS type /IWBEP/T_MGW_TECH_FIELD_NAMES optional
- !I_PAGING type /IWBEP/S_MGW_PAGING optional
- changing
- !C_DATA type ANY TABLE .
- class-methods TIMESTAMP_TO_DATETIME_SQL
- importing
- !I_SELECT_OPT type /IWBEP/S_COD_SELECT_OPTION
- !I_DATE_NAME type STRING
- !I_TIME_NAME type STRING
- !I_TIMESTAMP_NAME type STRING optional
- changing
- !C_WHERE type RSDS_WHERE_TAB optional .
- class-methods CONVERSION_INPUT
- importing
- !I_TABLENAME type TABNAME
- !I_FIELDNAME type DFIES-FIELDNAME
- !I_VALUE type ANY
- exporting
- !E_VALUE type ANY .
- class-methods CONVERT_IMPORT_STRUC_TO_WHERE
- importing
- !I_STRUCTDESCR type ref to CL_ABAP_STRUCTDESCR
- !I_KEYS type ANY
- exporting
- !E_SQL_WHERE type RSDS_WHERE .
- class-methods EXTRACT_PARAMETER
- importing
- !I_KEYS type ANY
- !I_SELECT_OPT type /IWBEP/T_MGW_SELECT_OPTION
- !I_PARAMETER_NAME type FIELDNAME
- exporting
- !E_PARAMETER type ANY
- raising
- CX_SY_MOVE_CAST_ERROR .
- class-methods GENERATE_WHERE_CLAUSE
- importing
- !I_KEYS type ANY
- !I_SELECT_OPT type /IWBEP/T_MGW_SELECT_OPTION
- exporting
- !E_SQL_WHERE type RSDS_WHERE
- !E_TABLENAME type RSDSTABS-PRIM_TAB
- !E_STRUCT_DESCR type ref to CL_ABAP_STRUCTDESCR
- raising
- CX_SY_MOVE_CAST_ERROR .
- class-methods CONVERT_SELECT_OPT_TO_WHERE
- importing
- !I_SELECT_OPT type /IWBEP/T_MGW_SELECT_OPTION
- !I_TABLENAME type TABNAME
- exporting
- !E_SQL_WHERE type RSDS_WHERE .
- class-methods GET_STRING_FOR_TEXTID
- importing
- value(IV_TDID) type TDID optional
- value(IV_TDNAME) type TDOBNAME optional
- value(IV_OBJECT) type TDOBJECT optional
- exporting
- value(EV_STRING) type STRING .
- class-methods REMOVE_EMPTY_FILTERS
- changing
- !C_SELECT_OPT type /IWBEP/T_MGW_SELECT_OPTION .
- class-methods HANDLE_SORTING
- importing
- value(IM_IT_ORDERBY) type /IWBEP/T_MGW_TECH_ORDER
- changing
- !CH_CT_TABLE type ANY TABLE .
- PROTECTED SECTION.
- private section.
- class-methods TABLE_IS_OK
- importing
- !I_TABNAME type TABNAME
- returning
- value(R_OK) type ABAP_BOOL .
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>CONVERSION_INPUT
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_TABLENAME TYPE TABNAME
- * | [--->] I_FIELDNAME TYPE DFIES-FIELDNAME
- * | [--->] I_VALUE TYPE ANY
- * | [<---] E_VALUE TYPE ANY
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD conversion_input.
- DATA:
- lt_dfies TYPE TABLE OF dfies,
- ls_dfies TYPE dfies,
- lv_conversionexit(60) TYPE c.
- * Convert to internal format, get the needed conversion exit from the field
- CALL FUNCTION 'DDIF_FIELDINFO_GET'
- EXPORTING
- tabname = i_tablename
- fieldname = i_fieldname
- dfies_tab = lt_dfies
- EXCEPTIONS
- not_found = 1
- internal_error = 2
- OTHERS = 3.
- READ TABLE lt_dfies INTO ls_dfies INDEX 1.
- "* Create data element with correct data type for the conversion exit output
- r_elemdescr ?= cl_abap_elemdescr=>describe_by_name( ls_dfies-DOMNAME ).
- else.
- r_elemdescr ?= cl_abap_elemdescr=>describe_by_name( ls_dfies-FIELDNAME ).
- CREATE DATA r_field TYPE HANDLE r_elemdescr.
- CALL FUNCTION lv_conversionexit
- EXPORTING
- input = i_value
- IMPORTING
- output = <fs>.
- e_value = <fs>.
- else.
- e_value = i_value.
- ELSE.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>CONVERT_IMPORT_STRUC_TO_WHERE
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_STRUCTDESCR TYPE REF TO CL_ABAP_STRUCTDESCR
- * | [--->] I_KEYS TYPE ANY
- * | [<---] E_SQL_WHERE TYPE RSDS_WHERE
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD convert_import_struc_to_where.
- ls_components TYPE LINE OF cl_abap_structdescr=>component_table,
- lv_fieldname TYPE string,
- lv_eqpart TYPE string,
- ls_where TYPE rsdswhere,
- lv_noand TYPE boolean VALUE 'X'.
- lt_components = i_structdescr->get_components( ).
- lv_noand = ''.
- ELSE.
- unassign <fs>.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>CONVERT_SELECT_OPT_TO_WHERE
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_SELECT_OPT TYPE /IWBEP/T_MGW_SELECT_OPTION
- * | [--->] I_TABLENAME TYPE TABNAME
- * | [<---] E_SQL_WHERE TYPE RSDS_WHERE
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD convert_select_opt_to_where.
- ls_field_ranges TYPE rsds_range,
- ls_rsds_trange TYPE rsds_frange,
- lt_where_clauses TYPE rsds_twhere,
- ls_selopt TYPE rsdsselopt,
- ls_gwsopt TYPE /iwbep/s_cod_select_option.
- ls_field_ranges-tablename = i_tablename.
- ls_rsds_trange-fieldname = ls_select_opt-property.
- ** Convert to internal format, get the needed conversion exit from the field
- TRY.
- CALL METHOD ZCL_ODATA_V2_HELPER=>conversion_input
- EXPORTING
- i_tablename = i_tablename
- i_fieldname = ls_rsds_trange-fieldname
- i_value = ls_gwsopt-high
- IMPORTING
- e_value = ls_selopt-high.
- CALL METHOD ZCL_ODATA_V2_HELPER=>conversion_input
- EXPORTING
- i_tablename = i_tablename
- i_fieldname = ls_rsds_trange-fieldname
- i_value = ls_gwsopt-low
- IMPORTING
- e_value = ls_selopt-low.
- CATCH zcx_ddic_type_not_found.
- * Just continue with the next values - or is there something else we should do?
- CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_WHERE'
- EXPORTING
- field_ranges = lt_field_ranges
- IMPORTING
- where_clauses = lt_where_clauses.
- READ TABLE lt_where_clauses INTO e_sql_where INDEX 1.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>EXTRACT_PARAMETER
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_KEYS TYPE ANY
- * | [--->] I_SELECT_OPT TYPE /IWBEP/T_MGW_SELECT_OPTION
- * | [--->] I_PARAMETER_NAME TYPE FIELDNAME
- * | [<---] E_PARAMETER TYPE ANY
- * | [!CX!] CX_SY_MOVE_CAST_ERROR
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD extract_parameter.
- DATA:
- struc_ref1 TYPE REF TO cl_abap_structdescr,
- lt_components TYPE cl_abap_structdescr=>component_table,
- ls_components TYPE LINE OF cl_abap_structdescr=>component_table,
- lv_fieldname TYPE string,
- ls_so TYPE /iwbep/s_cod_select_option,
- ls_filter TYPE /iwbep/s_mgw_select_option,
- lv_tablename TYPE tabname
- .
- ** Get the type of the I_KEYS
- struc_ref1 ?= cl_abap_structdescr=>describe_by_data( i_keys ).
- lv_tablename = struc_ref1->get_relative_name( ).
- *** Try to find parameter value in select options table
- READ TABLE i_select_opt WITH TABLE KEY property = i_parameter_name INTO ls_filter.
- TRY.
- CALL METHOD ZCL_ODATA_V2_HELPER=>conversion_input
- EXPORTING
- i_tablename = lv_tablename
- i_fieldname = i_parameter_name
- i_value = ls_so-low
- IMPORTING
- e_value = e_parameter.
- CATCH Zcx_ddic_type_not_found.
- * Just continue processing other entries
- ELSE.
- *** Try to find parameter in IMPORT structure
- lt_components = struc_ref1->get_components( ).
- TRY.
- CALL METHOD ZCL_ODATA_V2_HELPER=>conversion_input
- EXPORTING
- i_tablename = lv_tablename
- i_fieldname = i_parameter_name
- i_value = <fs>
- IMPORTING
- e_value = e_parameter.
- CATCH zcx_ddic_type_not_found.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>GENERATE_WHERE_CLAUSE
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_KEYS TYPE ANY
- * | [--->] I_SELECT_OPT TYPE /IWBEP/T_MGW_SELECT_OPTION
- * | [<---] E_SQL_WHERE TYPE RSDS_WHERE
- * | [<---] E_TABLENAME TYPE RSDSTABS-PRIM_TAB
- * | [<---] E_STRUCT_DESCR TYPE REF TO CL_ABAP_STRUCTDESCR
- * | [!CX!] CX_SY_MOVE_CAST_ERROR
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD generate_where_clause.
- struc_ref1 TYPE REF TO cl_abap_structdescr,
- lt_where type rsds_where
- .
- ** Get the type of the OUT_TABLE. Throws cx_sy_move_cast_error if i_keys is invalid.
- struc_ref1 ?= cl_abap_structdescr=>describe_by_data( i_keys ).
- e_struct_descr = struc_ref1.
- e_tablename = struc_ref1->get_relative_name( ).
- * Throw custom exception?
- ** Convert select options to where clause
- CALL METHOD ZCL_ODATA_V2_HELPER=>convert_select_opt_to_where
- EXPORTING
- i_select_opt = i_select_opt
- i_tablename = e_tablename
- IMPORTING
- e_sql_where = e_sql_where.
- ** Create where clause based on Import parameter I_KEYS
- ** Append to structure since both filter and primery key were given.
- ** This case should only happen with malformed primarykeys, ie. manually added key in function module
- CALL METHOD ZCL_ODATA_V2_HELPER=>convert_import_struc_to_where
- EXPORTING
- i_structdescr = struc_ref1
- i_keys = i_keys
- IMPORTING
- e_sql_where = lt_where.
- read table lt_where-WHERE_TAB ASSIGNING <fs> index 1.
- ** Read only by primary key (I_KEYS)
- CALL METHOD ZCL_ODATA_V2_HELPER=>convert_import_struc_to_where
- EXPORTING
- i_structdescr = struc_ref1
- i_keys = i_keys
- IMPORTING
- e_sql_where = e_sql_where.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>GET_DATA_FROM_VIEW
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_KEYS TYPE ANY
- * | [--->] I_SELECT_OPT TYPE /IWBEP/T_MGW_SELECT_OPTION
- * | [--->] I_ORDER TYPE /IWBEP/T_MGW_TECH_ORDER(optional)
- * | [--->] I_TOP TYPE INT4(optional)
- * | [--->] I_SELECT_FIELDS TYPE /IWBEP/T_MGW_TECH_FIELD_NAMES(optional)
- * | [--->] I_PAGING TYPE /IWBEP/S_MGW_PAGING(optional)
- * | [<-->] C_DATA TYPE ANY TABLE
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- method GET_DATA_FROM_VIEW.
- DATA:
- ls_where_clauses TYPE rsds_where,
- lv_tablename type TABNAME,
- lv_lang TYPE dml_text_langu_ui,
- ls_orderby type string,
- ls_select type string value '*',
- struc_ref1 TYPE REF TO cl_abap_structdescr,
- lv_top type int4
- .
- CALL METHOD zcl_odata_v2_helper=>generate_where_clause
- EXPORTING
- i_keys = i_keys
- i_select_opt = i_select_opt
- IMPORTING
- e_sql_where = ls_where_clauses
- e_tablename = lv_tablename
- e_struct_descr = struc_ref1.
- CALL METHOD ZCL_ODATA_V2_HELPER=>PARSE_ORDERBY
- EXPORTING
- I_ORDER = i_order
- IMPORTING
- E_ORDERBY = ls_orderby
- .
- CALL METHOD ZCL_ODATA_V2_HELPER=>PARSE_SELECT_FIELDS
- EXPORTING
- I_SELECT = i_select_fields
- I_STRUCT_DESCR = struc_ref1
- RECEIVING
- R_SELECT_FIELDS = ls_select
- .
- * Determine top
- lv_top = i_top.
- else.
- clear lv_top.
- else.
- * * Select data from table (lv_tablename)
- up to lv_top rows
- INTO CORRESPONDING FIELDS OF table c_data
- WHERE (ls_where_clauses-where_tab).
- else.
- INTO CORRESPONDING FIELDS OF table c_data
- up to lv_top rows
- WHERE (ls_where_clauses-where_tab)
- order by (ls_orderby).
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>GET_STRING_FOR_TEXTID
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] IV_TDID TYPE TDID(optional)
- * | [--->] IV_TDNAME TYPE TDOBNAME(optional)
- * | [--->] IV_OBJECT TYPE TDOBJECT(optional)
- * | [<---] EV_STRING TYPE STRING
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD get_string_for_textid.
- * Use this method to read select text element and convert it to string.
- CLEAR ev_string.
- lv_tdid = iv_tdid.
- lv_tdname = iv_tdname.
- lv_object = iv_object.
- * Check that all key fields are filled
- CALL FUNCTION 'READ_TEXT'
- EXPORTING
- id = lv_tdid
- language = lv_langu
- name = lv_tdname
- object = lv_object
- lines = lt_tlines
- EXCEPTIONS
- id = 1
- language = 2
- name = 3
- not_found = 4
- object = 5
- reference_check = 6
- wrong_access_to_archive = 7
- OTHERS = 8.
- CALL FUNCTION 'Z_TEXT_TO_STRING'
- EXPORTING
- it_tline = lt_tlines
- IMPORTING
- ev_text_string = ev_string.
- .
- * call function 'IDMX_DI_TLINE_INTO_STRING'
- * exporting
- * it_tline = lt_tlines
- * importing
- * ev_text_string = ev_string.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>HANDLE_SORTING
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] IM_IT_ORDERBY TYPE /IWBEP/T_MGW_TECH_ORDER
- * | [<-->] CH_CT_TABLE TYPE ANY TABLE
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- METHOD handle_sorting.
- ls_sorter TYPE abap_sortorder,
- ls_orderby TYPE /iwbep/s_mgw_tech_order.
- * fill sorting table
- * ----------------------------------------------------------------------------
- ls_sorter-name = ls_orderby-property.
- ls_sorter-descending = abap_true.
- ls_sorter-descending = abap_false.
- * execute sort
- * ----------------------------------------------------------------------------
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>PARSE_ORDERBY
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_ORDER TYPE /IWBEP/T_MGW_TECH_ORDER
- * | [<---] E_ORDERBY TYPE STRING
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- method PARSE_ORDERBY.
- lv_order type string.
- lv_order = 'DESCENDING'.
- else.
- lv_order = 'ASCENDING'.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>PARSE_SELECT_FIELDS
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_SELECT TYPE /IWBEP/T_MGW_TECH_FIELD_NAMES
- * | [--->] I_STRUCT_DESCR TYPE REF TO CL_ABAP_STRUCTDESCR
- * | [<-()] R_SELECT_FIELDS TYPE STRING
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- method PARSE_SELECT_FIELDS.
- * ** Method compares the selection fields with the fields in the table and adds the applicable fields to select string
- lt_components TYPE cl_abap_structdescr=>component_table,
- ls_components TYPE LINE OF cl_abap_structdescr=>component_table.
- r_select_fields = '*'.
- else.
- lt_components = i_struct_descr->get_components( ).
- read TABLE lt_components into ls_components with key name = ls_select.
- ** Field found, append it to selected fields
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>REMOVE_EMPTY_FILTERS
- * +-------------------------------------------------------------------------------------------------+
- * | [<-->] C_SELECT_OPT TYPE /IWBEP/T_MGW_SELECT_OPTION
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- method REMOVE_EMPTY_FILTERS.
- **** SAP UI5 provides filters with empty value
- ls_select type line of /IWBEP/T_COD_SELECT_OPTIONS.
- read table ls_select_opt-select_options into ls_select index 1.
- delete c_select_opt.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Private Method ZCL_ODATA_V2_HELPER=>TABLE_IS_OK
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_TABNAME TYPE TABNAME
- * | [<-()] R_OK TYPE ABAP_BOOL
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- method TABLE_IS_OK.
- SELECT TABNAME
- FROM DD02L
- INTO TB
- WHERE tabname = i_tabname
- ORDER BY PRIMARY KEY.
- EXIT.
- r_ok = abap_true.
- * <SIGNATURE>---------------------------------------------------------------------------------------+
- * | Static Public Method ZCL_ODATA_V2_HELPER=>TIMESTAMP_TO_DATETIME_SQL
- * +-------------------------------------------------------------------------------------------------+
- * | [--->] I_SELECT_OPT TYPE /IWBEP/S_COD_SELECT_OPTION
- * | [--->] I_DATE_NAME TYPE STRING
- * | [--->] I_TIME_NAME TYPE STRING
- * | [--->] I_TIMESTAMP_NAME TYPE STRING(optional)
- * | [<-->] C_WHERE TYPE RSDS_WHERE_TAB(optional)
- * +--------------------------------------------------------------------------------------</SIGNATURE>
- method TIMESTAMP_TO_DATETIME_SQL.
- *Importing
- * OPTION = GT
- * LOW = 20210111083234
- * Exporting
- * ( DATE = '20210111' AND TIME >= '083234'
- * OR DATE > '20210111' )
- lv_time type tims,
- lv_timestamp type timestamp,
- lv_esdate type string,
- lv_estime type string,
- lv_opt type c length 2,
- lv_datepart type string,
- lv_where like line of c_where,
- lv_and like line of c_where value 'AND'.
- lv_opt = i_select_opt-OPTION.
- "" surround values with quotes
- lv_timestamp = I_SELECT_OPT-low.
- convert TIME STAMP lv_timestamp TIME ZONE sy-zonlo
- into date lv_date time lv_time.
- case lv_opt.
- concatenate '(' i_date_name lv_opt lv_esdate 'AND' i_time_name lv_opt lv_estime ')' into lv_where SEPARATED BY space.
- "" Not available through odata
- "" Finally remove the previously mapped timestamp field from the where clause
- GeSHi ©
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
- FUNCTION Z_TEXT_TO_STRING.
- *"----------------------------------------------------------------------
- *"*"Local Interface:
- *" IMPORTING
- *" REFERENCE(IT_TLINE) TYPE TABTYPE_TLINE
- *" EXPORTING
- *" REFERENCE(EV_TEXT_STRING) TYPE STRING
- *"----------------------------------------------------------------------
- clear ls_stream.
- clear lt_stream.
- refresh lt_stream.
- call function 'CONVERT_ITF_TO_STREAM_TEXT'
- * EXPORTING
- * LANGUAGE = SY-LANGU
- itf_text = it_tline
- text_stream = lt_stream
- .
- clear ev_text_string.
- GeSHi ©
Vorlage für alle GET_ENTITY und GET_ENTITY_SET basierend auf Mapping mit Function Module:
1.) Baustein Kopieren
2.) Für den zugrunde liegenden View oder Tabelle einen Tabellentyp anlegen (SE11).
3.) Den View/Tabelle unter I_KEYS ändern
4.) Den Tabellentyp unter Exportparameter O_DATA eintragen.
5.) Der Baustein in der SEGW im Mapping verwenden,
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
- FUNCTION Z_ODATA_GET_SCUSTOMER.
- *"----------------------------------------------------------------------
- *"*"Local Interface:
- *" IMPORTING
- *" VALUE(I_KEYS) TYPE ZCDS_SCUSTOMER OPTIONAL
- *" VALUE(I_SELECT_OPT) TYPE /IWBEP/T_MGW_SELECT_OPTION OPTIONAL
- *" VALUE(I_ORDER) TYPE /IWBEP/T_MGW_TECH_ORDER OPTIONAL
- *" VALUE(I_SELECT_FIELDS) TYPE /IWBEP/T_MGW_TECH_FIELD_NAMES
- *" OPTIONAL
- *" VALUE(I_PAGING) TYPE /IWBEP/S_MGW_PAGING OPTIONAL
- *" EXPORTING
- *" VALUE(O_DATA) TYPE ZCDS_SCUSTOMER_TT
- *"----------------------------------------------------------------------
- * if i_keys is initial and i_SELECT_OPT is initial and i_paging-top is INITIAL.
- * return.
- * endif.
- ZCL_ODATA_V2_HELPER=>GET_DATA_FROM_VIEW(
- EXPORTING
- I_KEYS = i_keys
- i_paging = i_paging
- i_order = i_order
- i_SELECT_OPT = i_SELECT_OPT
- I_SELECT_FIELDS = I_SELECT_FIELDS
- changing
- c_data = o_data[]
- ).
- GeSHi ©
Additional Definitions in REDEFINITION of xxx_GET_ENTITYSET
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
- :
- :
- * Added order by and select fields functionality
- :
- :
- :
- :
- * Get filter or select option information
- lo_filter = io_tech_request_context->get_filter( ).
- lt_filter_select_options = lo_filter->get_filter_select_options( ).
- lv_filter_str = lo_filter->get_filter_string( ).
- * Added order by and select fields functionality
- lt_orderby = io_tech_request_context->get_orderby( ).
- ls_paging-top = io_tech_request_context->get_top( ).
- lt_select_fields = io_tech_request_context->get_select( ).
- :
- :
- TRY.
- CALL FUNCTION lv_rfc_name
- EXPORTING
- i_keys = ls_converted_keys
- i_select_opt = lt_filter_select_options
- i_order = lt_orderby
- i_paging = ls_paging
- i_select_fields = lt_select_fields
- IMPORTING
- o_data = o_data
- EXCEPTIONS
- OTHERS = 1002.
- GeSHi ©