Please link here to all relevant sections of the Clean ABAP guide
Description
Please describe here what changes to the above sections you propose
When using ENUM class, that would be a little bit overqualified, one class container can only list one type of value. I suggest using a combination of traditional 'Constants Interface' and Enum like below, so that we can:
obey the classical guideline
save repository artifacts cost
referred type linkable
group enum in a single structure
Examples
Please consider adding examples of patterns/anti-patterns this change suggests/avoids
INTERFACE if_some_business_area.
BEGIN OF ENUM ty_e_message_severity STRUCTURE cs_message_serverity,
error,
warning,
information,
success,
END OF ENUM ty_e_message_severity STRUCTURE cs_message_serverity.
when using this in somewhere, we can reference the type if_some_business_area=>ty_e_message_severity, the allowed value only comes from if_some_business_area=>cs_message_serverity-[error, ... success]
CLASS cl_some_function.
METHOD foo DEFINITION
IMPORTING message_severity type if_some_business_area=>ty_e_message_severity.
When call method
NEW cl_some_function( )->foo( if_some_business_area=>cs_message_serverity-error ).
The guide could possibly even go a step further and recommend CDS based enumerations instead, if available. Then no interface definition is needed and the constants can be used in CDS as well as ABAP.
Relevant sections of the style guide
Description
When using ENUM class, that would be a little bit overqualified, one class container can only list one type of value. I suggest using a combination of traditional 'Constants Interface' and Enum like below, so that we can:
Examples
INTERFACE if_some_business_area. BEGIN OF ENUM ty_e_message_severity STRUCTURE cs_message_serverity, error, warning, information, success, END OF ENUM ty_e_message_severity STRUCTURE cs_message_serverity.
when using this in somewhere, we can reference the type if_some_business_area=>ty_e_message_severity, the allowed value only comes from if_some_business_area=>cs_message_serverity-[error, ... success]
CLASS cl_some_function. METHOD foo DEFINITION IMPORTING message_severity type if_some_business_area=>ty_e_message_severity.
When call method NEW cl_some_function( )->foo( if_some_business_area=>cs_message_serverity-error ).