Naming convention

Object

Length

Naming Convention / Description

Tables

30

Z<area>_<tech.repr>_<bo/query> (e.g. ZSD_A_SALES_ORDER)

<area>: FI, SD, PE..  
<tech.repr>: Optional prefix necessary when there are multiple technical representations for the same semantic data.
                     A=Active, D=Draft

CDS View Entities

 30

Z<area>_<type>_<bo/query><suffix(e.g. ZSD_C_SALES_ORDER)
<area>: FI, SD, PE..  
<type>: I for Interface Views (Basic or Composite), C for Projection/Consumption Views (incl. specific annotations for Fiori UIs, web APIs or SAC queries)  E for Extensions include views, X for View extension
<suffix>: Optional Some recommendations are VH for Value Helper views, TP for transactional objects/views, TF for table functions..

CDS DDIC views are no longer recommended. SAP is planning to convert all standard CDS DDIC views to CDS View Entities

CDS Extractors (e.g. BW) are considered Interface Views taking standard CDS extractors as reference.

Access Control

16

ZAC<description><suffix>
<description>, all written together in upper case letters
<suffix>, PFCG for profile generator or LIT for Literals

Behavior Definition

30

Same name as the root entity of the business object or query. See CDS View Entities.

Behavior Pool

30

ZBP_<area>_<bo/query> (e.g. ZBP_SD_SALES_ORDER)

<area>: FI, SD, PE..  

Metadata Extension

30

Same name as the CDS entity it relates to. If there is more than one, add a numbered suffix. See CDS View Entities.

Service Definition

30

Z<area>_<bo/query>(e.g. ZSD_SALES_ORDER)
<area>: FI, SD, PE..  

Service Binding

30

Z<area>_<type>_<bo/query>_<protocol>(e.g. ZSD_UI_SALES_ORDER_O2)
<area>: FI, SD, PE..  
<type>: UI if exposed as UI Service, API if exposed as Web API
<protocol>: O2 for ODATA v2, O4 for ODATA v4

Object

Naming convention

Local classes

LCL_<noun>

Local Test Class

LTC_<noun>

Local Test Double

LTD_<noun>

Local interfaces

LIF_<noun>

Class in the class library

ZCL_<area>_<noun>

<area>: FI, SD, PE..

BADI Implementation classes are autogenerated (ZCL_IM_<BADI Implementation>) and therefore considered valid

Exception class in the class library

ZCX_<area>_<speaking>

<area>: FI, SD, PE..  

Interface in the class library

ZIF_<area>_<speaking>

<area>: FI, SD, PE..  

Method name

Has to begin with a verb. Don’t mix synonyms for the same action
e.g.: GET_STATUS, CREATE_PO, CHECK_COMPANY_CODE …

Events

<noun>_<participle>

e.g.: BUTTON_PUSHED, COMPANY_CODE_CHANGED, BUSINESS_PARTNER_PRINTED

Method Parameters

<direction><type>_<parameter name>

<direction>: I for Importing, E for Exporting, C for Changing, R for Returning
<type>: S for structure, T for table, v for variable..

Attribute (Static or Public)

<visibility><type>_<Speaking>
<visibility>: G for Static/Public, M for Protected/Private
<type>: S for structure, T for table, v for variable..

Exception: For exception classes, don’t use any prefix since attributes are also used as method parameters.

Attribute access

SET/GET_<attribute name>

e.g. : GET_STATUS, SET_USE_COUNT

Event handler methods

ON_<event name>

Methods that handle events should begin with ON, followed by the name of the event that they handle.

e.g. ON_BUTTON_PUSHED, ON_BUSINESS_PARTNER_PRINTED

Methods that perform type conversions

AS_<new type>

e.g. AS_STRING, AS_ISOCODE

Methods that return a Boolean value

IS_<adjective>

e.g. IS_OPEN, IS_EMPTY, IS_ACTIVE

Recommendation: Use SPACE and ‘X’ to represent false and true respectively.

Добавить комментарий