Tuesday, 13 September 2016

General properties of ABAP Classes / Interfaces

Every day you create or change ABAP class in class builder. When you activate your change, have you noticed a series of objects with several "=" in the middle part of each?

General properties of ABAP Classes / Interfaces
Technically speaking, an ABAP class consists of several parts. In order to figure them out, I just create a simple class with the following source code:

CLASS zcl_abap_class DEFINITION
  PUBLIC FINAL CREATE PUBLIC .
  PUBLIC SECTION.
    DATA public_attribure TYPE i .
    TYPES:BEGIN OF ty_global,
            name  TYPE string,
            score TYPE i,
          END OF ty_global.
    METHODS public .
protected section.
  data PROTECTED_ATTRIBUTE type I .
  methods PROTECTED .
  PRIVATE SECTION.
    DATA private_attribute TYPE i .
    METHODS private .
ENDCLASS.
CLASS ZCL_ABAP_CLASS IMPLEMENTATION.
  METHOD private.
  ENDMETHOD.
  method PROTECTED.
  endmethod.
  METHOD public.
  ENDMETHOD.
ENDCLASS.
I have also generated a local test class for it via SE80. After activation, look into corresponding entry in TRDIR.

General properties of ABAP Classes / Interfaces

The object name under column NAME could be opened via SE38. Take CCAU for example:

General properties of ABAP Classes / Interfaces

So CCAU contains the source code of local test class implementation:

General properties of ABAP Classes / Interfaces

Here below is the list of each part and its meaning:

Part Name
Part Meaning
CCAU
contains the source code of local test class implementation
CCDEF
Class-Relevant Local Definitions, contains the definitions of local classes inside the public class
CCIMP
It contains the implementation for those local classes which definitions are stored in the Definitions-Include
CCMAC
contains the macros of the public class
CI
source code of private section
CMXXX
source code of each method
CO
source code of protected section
CP
open it in SE38, it will automatically navigate to class builder
CT
open it in SE38, it will automatically navigate to class builder
CU
source code of public section

The constant of part name is defined in type group SEOP:

General properties of ABAP Classes / Interfaces

If you need to get the part name of a given class via ABAP code, you can use utility class CL_OO_CLASSNAME_SERVICE. There are corresponding getter method for each kind of part defined.

For example, if you need to get the part name of all methods of class CL_CRM_BOL_CORE, just set breakpoint in method CL_OO_CLASSNAME_SERVICE =>GET_ALL_METHOD_INCLUDES, and open the class CL_CRM_BOL_CORE in SE24, and click "Source Code-Based" button:

General properties of ABAP Classes / Interfaces

Here you can find the name class part for each method are populated with one incremental step in hexadecimal.

1 comment:

  1. A nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.

    SAP HR Training in Chennai

    SAP SD Training in Chennai

    SAP Basis Training in Chennai

    ReplyDelete