It always helps to define development guidelines / naming conventions and adhere to them. ABAP CDS View development is not an exception.
Development guidelines / Naming Conventions are not something set in stone. They need to make sense and meant to help rather than complicate life. So if you have better ideas, please share in comments.
- STOB (name after define view) and DDLS (used in CDS wizard creation wizard) MUST be the same. Will save you trouble locating views;
- Dimension and measures names for SAP standard fields should be the same as SAP uses. It is absolute MUST for dimensions to make sure that navigations are working;
- Associate dimension to dimension fields to take advantage of attributes, hierarchies, texts and values helps;
- Associate ABAP Boolean fields (‘X’ / ‘ ‘) with I_Indicator SAP standard dimension CDS view to provide user friendly texts like Yes / No
- Format % values accordingly instead just decimal fraction of 1. See my blog for more information
- If needed, cast custom fields to SAP data elements to get the right descriptions and formatting
- Assign quantity and amount unit of measures to ensure correct aggregation and presentation;
- If you extend standard CDS view with custom fields then name custom fields starting with Z to avoid future naming collisions with SAP standard fields;
- Use UNION ALL instead of UNION where applicable to improve performance;
- If CDS View has parameters, then provide value help as explained. See Maksim Alyapyshev’s blog for more information.
General Naming Convention:
- Use CamelCase naming for CDS View fields (not underscores);
- CDS STOB views name should start with prefix, for example, ZC_ followed by CamelCase name (not underscores). CDS DDLS is capitalized by the system;
- CDS View parameter names should be prefixed with P_ followed by by CamelCase name (not underscores).
- Association names should start with _ followed by view without prefix, for example, _Material for I_Material.
View Specific Naming Conventions:
|View Type||Naming Convention||Comments|
|Hierarchy||ZI_< DimensionName >HIER||Add sequence number at the end if need more than one|
|Table Function||ZI_<CubeName>FUNC||Add sequence number at the end if need more than one|
|Query||ZI_<CubeName>QUERY||Add sequence number at the end if need more than one|