cancel
Showing results for 
Search instead for 
Did you mean: 

Determine class structure / components (local class, test classes, ...)

dschiener
Explorer
0 Kudos
207

Hello,

I am looking for a solution to determine the structure / components of a class.

Regarding "structure and/or components" I mean for example local classes or test classes of a global class!
I do NOT want to analyze attributes or methods by using a type descriptor.

So I guess that tables exist where such information CCAU, CCDEF etc. are stored...

Can anyone give me a hint, in which tables such information is stored?
I would start retrieving the class name of a global class by reading table TADIR.

Maybe there is a "static" variant of a solution by reading several tables or a "dynamic" variant by using any kind of RTTI?

BR

Sandra_Rossi
Active Contributor
0 Kudos
The content of this database table is "encoded". Use the ABAP statement READ REPORT to read the source code of CCAU, CCDEF, etc.
dschiener
Explorer
0 Kudos
@Sandra_Rossi of which table?

Accepted Solutions (0)

Answers (1)

Answers (1)

dschiener
Explorer
0 Kudos

My solution looks at the moment kind of like this:

" 1. Select necessary records of TADIR table
SELECT
  FIELDS *
  FROM tadir ...

" 2. Get name of include for test classes
DATA(test_classes) = cl_oo_classname_service=>get_ccau_name( ).

" 3. Read source code of include to check if test classes exist or not
READ REPORT test_classes INTO source_code_test_classes.

" 4. Check if test classes exist

Now I am wondering if there is a simpler way to check if test classes exist in the include instead of parsing its whole source code...

Maybe there is another database table aswell where a marker for each local test class is stored?

Maybe anything like the ZCL_....=CMETH=001 for class methods also for test classes exists ZCL_...=CCUA001?

Sandra_Rossi
Active Contributor
0 Kudos
Note that, although it's abnormal, test classes can be defined outside the CCAU include. If you don't want to parse the code yourself, and you are processing only CUSTOM classes, you may try to find the table containing the cross-reference information generated to build the tree of "sub-objects" displayed in ADT or SE80, or read the table TAUNIT_META_DATA which contains the test classes after execution.