Directly Display CDS DATA
Step 1 – Data Declarations
Step 2 – Create ALV IDA for CDS View
Step 3 – Get Reference of Full-screen API
Step 4 – Display Data
Output
Useful Links
Sample Code
*&--------------------------------------------------------------------*
*& Report Z2812_CDS_DIRECT
*&--------------------------------------------------------------------*
REPORT z2812_cds_direct.
DATA: go_alv_ida TYPE REF TO if_salv_gui_table_ida,
go_fullscreen TYPE REF TO if_salv_gui_fullscreen_ida.
START-OF-SELECTION.
TRY.
" Create 'ALV with IDA' for Core Data Services(CDS)
go_alv_ida = cl_salv_gui_table_ida=>create_for_cds_view(
iv_cds_view_name = 'Z2812_CUSTOMER_BOOKINGS'
).
CATCH cx_root INTO DATA(lo_root).
DATA(lv_text) = lo_root->get_text( ).
WRITE:/ lv_text.
LEAVE TO LIST-PROCESSING.
ENDTRY.
END-OF-SELECTION.
TRY.
" Activate Fullscreen modus (interface)
go_fullscreen = go_alv_ida->fullscreen( ).
CATCH cx_salv_ida_contract_violation INTO DATA(lo_error).
lv_text = lo_error->get_text( ).
WRITE:/ lv_text.
LEAVE TO LIST-PROCESSING.
ENDTRY.
" Display Data
go_fullscreen->display( ).