Tuesday 2 October 2018

How to find a predefined VDM for a selected S/4HANA table

Purpose 


This blog illustrates how to find the predefined VDM (template of the CDS View for business entities  in S/4HANA)  for a table, e.g. finding the VDM “I_ProfitCenter” for the table CEPC.

This method should help reduce the development effort, by using a predefined VDM instead of creating custom CDS Views for the business entities in S/4HANA.

By searching “Views” in Where-Used List for a table in Transaction SE11, the candidates of SQL Views of the predefined VDM (CDS View) are listed. The object name you are looking for should start with “I”, “P” or “C”. After selecting an entry, the definition of the selected SQL View is displayed. “DDL Sources” (=CDS View) can be selected in the Where Used List, however sometimes the Where-Used list does not list all the CDS Views (for example more complex VDM’s may not always be included). Where-Used List is also available in ADT (ABAP Development Tools in HANA Studio), however this is likely to take long time as it is not possible to search “Views” only.

In this way, only the SQL Views directly using the table as a source are listed (select from <the table>), so that further steps might be needed for more complex predefined VDM. But most of the predefined VDM for master data and simple transaction data (Interface Views) can be searched.

How can the predefined VDM’s be used?


Predefined VDM’s can be used to create custom CDS Views. It is possible to create Consumption Views from predefined VDM’s, and master predefined VDM’s can be used for custom transaction CDS Views. Furthermore, predefined VDM’s can also be used in ABAP programs (SELECT ~ FROM <CDS View>) and some can work as the source to send data to BW, or external systems (using ETL tools like Data Services, CPI-DS, SDI).

Steps


In this step, the predefined VDM for ProfitCenter is found from the table CEPC via transaction code SE11.

Select “Views” only and deselect others, ad select Execute.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

The view names are listed (see below). Check the views whose name is starting with “I” (or “P”).

In this case, there are 3 views starting with “I”. From the short description, it seems the first one (IFIPROFITCENTER) seems to be the appropriate one. Double-click this entry.
  • CDS View includes SQL View, and the SQL View is listed in this way. The naming rule of SQL View used in CDS View is “<prefix of VDM type>+<Component ID>~”, e.g. IFIPROFITCENTER. Regarding prefix of VDM type, “I” is used for Interface View, “P” for Private View, and “C” for Consumption View. Interface Views should be the target of the search, as Interface views are generally regarded as the “go to” reuse views.
SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

The definition of the selected SQL View is displayed. The name in “DDL Source” field is the name of CDS View. If the name is started with “I_”, it should be the predefined VDM (as now the SQL View name is started with “I”).

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

For some views, it is possible to run “Contents” (data preview) in this screen, but for other views, it is not possible, e.g. when the corresponding CDS View has the parameters.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

By double-clicking the DDL Source name, the source of CDS View is displayed.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

Source of the CDS View.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning
  • In SAPGUI, it is also possible to display the source of CDS View with the program “RUTDDLSSHOW2”.
SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

Of course, it is possible to open this predefined CDS View in ADT.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

Search with the DDL Source name (“I_PROFITCENTER”) and select the listed CDS View.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

The definition of the CDS View is displayed.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

It is also possible to search “DDL Sources” (=CDS View) in Where-Used List. But unfortunately, not all the CDS Views using the table might be listed. In many cases, it could be fixed by running the program SDDIC_DDLS_INDEX_ALL_SOURCES, by which the necessary records are filled in the table DDLS_RIS_INDEX.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

Select “DDL Sources” only and deselect others, and select Execute.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

In S/4HANA 1809 (or ABAP Server 7.53),  “Data definitions” is used instead of “DDL Sources”.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

The view names are listed. Check the views whose name is starting with “I” (or “P”, “C”).

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorial and Material, SAP ABAP Learning

No comments:

Post a Comment