CDS New Features in SAP ABAP – 01

CDS New Features in SAP ABAP – 01

 

Prerequisite:

SAP ABAP Development Tools in Eclipse (ADT)

 

Define CDS View

1. Define DDL Source – Create CDS DDL View Entity (Currently you can only define one CDS entity per DDL source.)

 

CDS Data Definition

Maintain: package, CDS View Entity Name, Description.

Get a default CDS template like as below:

1.) SQL View Name: This annotation specifies the name of the corresponding view in the ABAP Dictionary (T-Code: SE11 -> view can open it.)

2.) CDS Entity Name, only can access CDS view data via the entity Name.

3.) Data Source Name: like SAP Dictionary Table, View, or other CDS Entity Name

2. Build CDS View

Example:

1).Setting Data Source: SNWD_PO

2.) Point your cursor at the curly brackets (see the below graphic), then press key: CTRL + SPACE

3.) Click “Inserts all elements – Template

4.) Set the Sql View Name : ZPO01

 

5). Click Save and Active button.

3. Test CDS View

  • ADT SQL View

Or open view Data Preview on CDS Entity

 

2. Test CDS in ABAP ALV

Class: cl_salv_gui_table_ida

Method: create_for_cds_view

 

ABAP Test Program Code:

*&———————————————————————*

*& Report z_cds_alv_test_01

*&———————————————————————*

*&

*&———————————————————————*

REPORT z_cds_alv_test_01.

class lcl_main definition create private.

public section.

CLASS-METHODS create

RETURNING

value(r_result) TYPE REF TO lcl_main.

methods run.

protected section.

private section.

endclass.

 

class lcl_main implementation.

method create.

create object r_result.

endmethod.

 

method run.

cl_salv_gui_table_ida=>create_for_cds_view(‘Z_PO_01’)->fullscreen( )->display( ).

endmethod.

endclass.

 

start-of-selection.

lcl_main=>create( )->run( ).

Leave a Comment