Constants - To be declared in class or interface?
Hello OO gurus,
The place where I work is upgrading SAP version and now all developments must be done using OO concepts. I am already familiar with this concept but i have one doubt regarding its application in ABAP programs.
I transformed a existing procedural report into a object oriented report. I declared all the constants used in this program in a separated class as follows:
CLASS: cl_constants_handler DEFINITION. PUBLIC SECTION. CONSTANTS: c_h1(10) TYPE c VALUE 'Purch.Doc.', c_h2(09) TYPE c VALUE 'Doc. date', " (...)
However i saw that constants are declared in interfaces in standards programs. Then, classes need to implement these interfaces to used them. Examples: IF_BCB_ITEM_CONSTANTS, IF_CRM_CONSTANT1, IF_UA_APPLICATION_CONSTANTS
My question is: what is the advantage to declare constants in interfaces instead of classes?