Capture Date: 15.04.2018 23:39:00
To display DDL source codes of SAP CDS objects like CDS Views in SAP GUI ABAP developer can run DEMO_SHOW_DDL_SOURCE program.
CDS objects like CDS views or CDS table functions are created and maintained in ADT Tools like SAP HANA Studio with SQL Console.
When you are in SAP GUI and want to see source codes of a CDS view, you can use ABAP program DEMO_SHOW_DDL_SOURCE .
CDS View created using SQL DDL Document
Here is BSIS CDS View in SAP HANA system which I use SE11 transaction to display DDL SQL View.
Note that there is DDL Source section which has the value “BSIS_DDL”. When I double click it, I get only a small part of the SQL DDL source codes of the CDS view.
ABAP programmers should realize the warning:
Data Definitions can only be edited using ADT in Eclipse
Message no. DDIC_ADT_DDLS005
So if you have SAP HANA Studio ADT Tool installed, using the Eclipse IDE it is possible to display the SQL data definition language source codes of the CDS view.
Fortunately, there is an ABAP report to display source codes of SQL DDL views.
DEMO_SHOW_DDL_SOURCE to Show DDL Source Codes of CDS Views
SAP provided ABAP program DEMO_SHOW_DDL_SOURCE to display DDL source codes of CDS views or other CDS objects easily in SAP GUI environment without using SAP HANA Studio.
Launch SE38 ABAP transaction to execute DEMO_SHOW_DDL_SOURCE report
Run the program with F8
Enter the DDL source name (name of the SQL DDL document) and press Enter button. Please check on SE11 for DDL Source attribute. Do not use the DDL SQL View name instead of DDL Source name.
Although the format of the SQL codes is confusing the developers, all of the SQL DDL codes of a CDS view can be displayed with DEMO_SHOW_DDL_SOURCE ABAP program without the requirement of an installed SAP HANA Studio.
Create DEMO_SHOW_DDL_SOURCE ABAP Program
If DEMO_SHOW_DDL_SOURCE ABAP report does not exist on your SAP system, you can try to create it by using following ABAP codes.
" copy of DEMO_SHOW_DDL_SOURCE ABAP report
CLASS demo DEFINITION.
CLASS demo IMPLEMENTATION.
DATA name TYPE string.
cl_demo_input=>request( EXPORTING text = 'DDL Source' CHANGING field = name ).
name = CONV ddlname( to_upper( name ) )
ddddlsrcv_wa = DATA(ddlsrcv_wa) ).
CATCH cx_dd_ddl_read INTO DATA(exc).
cl_demo_output=>display( exc->get_text( ) ).
IF ddlsrcv_wa-source IS INITIAL.
cl_demo_output=>display( |Nothing found| ).
cl_demo_output=>display( replace( val = ddlsrcv_wa-source sub = |\n| with = '' occ = 0 ) ).
I could get a better formatted SQL DDL source view of the CDS view I created at CDS View tutorial using “Z_Ddlsqlview” in the DDL Source input parameter as follows