My CDS View Self Study Tutorial - Part 9 Cube View and Query View
My CDS View Self Study Tutorial - Part 9 Cube View and Query View
1 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
backend:
This cube view has only three fields: prod_id, prod_text and
quantity.
2 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
3 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
While for a normal CDS view, the DPC class has super class
CL_SADL_GTK_EXPOSURE_MPC, which means the data
access in this case is done by SADL framework.
4 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
REPORT zcds_get_query_view_data.
DATA(lo_tool) = NEW cl_nat_generic_dpc( ).
DATA(lo_context) = NEW /iwbep/cl_mgw_context( ).
DATA: l_r_rs_gw_columns TYPE REF TO cl_abap_tabledescr,
l_t_rs_gw_columns TYPE REF TO data,
lo_request TYPE REF TO /iwbep/cl_mgw_request,
lo_detail TYPE REF TO /iwbep/if_mgw_core_srv_runtime
ls_detail TYPE /iwbep/if_mgw_core_srv_runtime=>ty_s_mgw
lt_header TYPE tihttpnvp,
lt_filter TYPE /iwbep/t_mgw_select_option,
lt_order TYPE /iwbep/t_mgw_sorting_order,
ls_page TYPE /iwbep/s_mgw_paging,
ls_header TYPE LINE OF tihttpnvp.
FIELD-SYMBOLS:
<l_t_rs_gw> TYPE table.
lo_context->/iwbep/if_mgw_context~set_parameter( iv_name = /iwbep/if_
iv_value = 'Z_C_PRODUCT_CDS' ).
lo_context->/iwbep/if_mgw_context~set_parameter( iv_name = /iwbep/if
iv_value = '0001' ).
lo_tool->/iwbep/if_mgw_core_srv_runtime~set_context( lo_context
CREATE DATA lo_detail.
lo_request = NEW /iwbep/cl_mgw_request( ir_request_details = lo_detail
DATA(lo_rt) = NEW cl_eq_bics_gw_rt( i_query = '2Czprdquery'
i_servicetype_oq = abap_true
lo_rt->get_designtime(
IMPORTING
e_t_column_description = DATA(l_t_query_struc) ) .
l_r_rs_gw_columns = cl_eq_bics_gw_dt=>build_rs_structure( l_t_query_st
CREATE DATA l_t_rs_gw_columns TYPE HANDLE l_r_rs_gw_columns.
ASSIGN l_t_rs_gw_columns->* TO <l_t_rs_gw>.
ls_detail-technical_request-service_name = 'Z_C_PRODUCT_CDS'.
ls_detail-technical_request-service_version = '0001'.
ls_detail-technical_request-source_entity_type = ls_detail-technical_
= 'Z_C_PRODUCTType'.
ls_detail-technical_request-source_entity_set = ls_detail-technical_re
= 'Z_C_PRODUCTTypeCollection'.
ls_header-name = 'dummy'.
APPEND ls_header TO ls_detail-technical_request-request_header.
CALL METHOD lo_tool->/iwbep/if_mgw_core_srv_runtime~read_entityset
EXPORTING
iv_entity_name = 'Z_C_PRODUCTType'
iv_source_name = 'Z_C_PRODUCTType'
is_paging = ls_page
it_order = lt_order
it_filter_select_options = lt_filter
5 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
is_request_details = ls_detail
CHANGING
cr_entityset = l_t_rs_gw_columns
ct_headers = lt_header
).
ASSIGN l_t_rs_gw_columns->* TO <l_t_rs_gw>.
WRITE: 'lines of data: ', lines( <l_t_rs_gw> ).
With SAT trace I can easily locate the exact location of code
where the data retrieve is done:
6 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
Mystery Revealed!
7 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
8 of 9 26/03/2022, 23:22
My CDS view self study tutorial – Part 9 cube view and query view | ... https://blogs.sap.com/2016/05/21/my-cds-view-self-study-tutorial-part...
9 of 9 26/03/2022, 23:22