We used to spend lot of time in identifying the SAP delivered CDS view(s) or Existing CDS View(s) in the system before starting the development which is very important so that we don't create duplicate objects and also we can utilize SAP delivered objects. Personally I felt the process was really painful and time taking.
As a Coding Savvy I could able to identify the tables which has all the Meta data information about the CDS view(s). So I had created a table function in S/4 HANA system which makes CDS search is easy. I am hoping that developers could able to leverage this code so that they could save lot of investigation time.
Below is the code for the table function and corresponding the AMDP Class. Only change which needs to done is to update the client number in the Class where I had mentioned as '000' at line number 23.
Table Function Code
@EndUserText.label: 'table function for CDS Meta Data'
define table function ZT_CA_CDS_METADATA
class zcl_cds_meta definition
create public .
class-methods: GET_CDS_META for table function ZT_CA_CDS_METADATA.
class zcl_cds_meta implementation.
method GET_CDS_META by database function
using RSODPABAPCDSVIEW DD25T DD03L.
i_sqlview = SELECT
'000' as CLIENT,
INNER JOIN DD25T AS DD25T
ON DD25T.VIEWNAME= RSODPABAPCDSVIEW.SQLVIEWNAME;
sqlview.DdlName as CdsView ,
sqlview.ddtext as CdsViewDesc,
DD03L.rollname as DataElement,
DD03L.leng as Length,
from :i_sqlview as sqlview
left outer join DD03L as DD03L
on DD03L.tabname = sqlview.sqlviewName;
Get the Data through Data Preview option or through writing SQL as displayed below
Open the image in a new window for clearer picture.
or you can modify the SQL query for getting the CDS views which has Billing in the CDS name
For Instance if you want to see all the CDS views which has name General Ledger
This Table Function can answer below questions
Search for CDS view(s) by using the CDS View description.
Get the Data Base View name of the CDS View(s).
Get the Field names of the CDS view(s).
Get the Data Type, Data Element and Length of Fields in the CDS View(s)
Hope this blog gives good sense and makes your development easy in order to identify the CDS views which was delivered by SAP and also you can reuse the CDS which were already built by other colleagues.
Please let me know if any suggestions and questions.