Defining and using naming conventions ensure consistency in the names used by all the developers on a project. This posts summarizes the naming conventions recommended by SAP for the RAP Development Objects.
General Rules
The overall object name will be split into 3 parts.
[/<namespace>/][<prefix>]_<meaningful_abbreviation>_[<suffix>].
Namespace
[/<namespace>/]
For custom object, the namespace can just be Z. Your project can also have a namespace like ZAB_ etc.
Prefix
Prefix is used to differentiate between different types of same development object. For example, Root Entity and Projection Entity can be differentiated using the prefix.
Meaningful Abbreviation
This can be any meaningful text separated by _ characters. For example, customer_name.
Suffix
Suffix can be used for additional differentiation between different types of development objects. For example, a service binding with UI service can be named with suffix _V2 for OData version 2 and _V4 for OData version 4.
With this explanation, let us understand how the RAP development objects can be named. For the examples the namespace used is ZJP_.
ABAP Dictionary Objects
Object Type | Prefix | Suffix | Example |
---|---|---|---|
Database Tables – Persistent | A_ | ZJP_A_Customer | |
Database Tables – Draft | D_ | ZJP_D_Customer |
CDS Objects
Object Type | Prefix | Suffix | Example |
---|---|---|---|
Interface CDS Entity (Root CDS Entity) | I_ | ZJP_I_Customer | |
Base CDS Entity | R_ | ZJP_R_Customer | |
Projection CDS Entity | C_ | ZJP_C_Customer | |
Behavior Definition – Root | Same as root CDS Entity | ZJP_I_Customer | |
Behavior Definition – Projection | Same as projection CDS Entity | ZJP_C_Customer | |
Metadata Extension | Same as the related CDS entity | ZJP_C_Customer |
Business Services
Object Type | Prefix | Suffix | Example |
---|---|---|---|
Service Definition | UI_ | ZJP_UI_Customer | |
Service Binding for UI Service with OData V2 | UI_ | _O2 | ZJP_UI_Customer_O2 |
Service Binding for UI Service with OData V4 | UI_ | _O4 | ZJP_UI_Customer_O4 |
Service Binding for Web API | API_ | ZJP_API_Customer |
Source Code Objects
Object Type | Prefix | Suffix | Example |
---|---|---|---|
Behavior Pool | BP_
| ZJP_BP_Customer | |
Handler Class | LHC_ | ZJP_LHC_Customer | |
Saver Class | LSC_ | ZJP_LSC_Customer |
The naming conventions can also be checked in the ABAP Flight Reference Scenario. This contains many reference services which can help you learn more about ABAP RAP. Check for package /DMO/FLIGHT_LEGACY.
The code can be also downloaded from github link https://github.com/SAP-samples/abap-platform-refscen-flight.
Visit ABAP RESTful Application Programming Model to explore all articles on ABAP RAP Model.
If you like the content, please subscribe…