2

Our company provides ABAP system analysis services offline. That is, a system's ABAP code is extracted and sent to us as XML. We analyze the system with a tool written in Java. Personally, I'm not an ABAP expert.

One upcoming task is building a class inheritance graph. One could certainly do that based on the XML. But as ABAP provides the RTTS/RTTI, why not using it? My idea is:

  • Write an ABAP program that queries the RTTI and extracts the full class hierarchy
  • Send the result as XML and provide an interface to access that information (not part of this question)

Now my question: Does the first point sound like a good/feasible idea? Any are there any pitfalls, e.g., performance bottlenecks?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Ulrich Scholz
  • 2,039
  • 4
  • 30
  • 51

2 Answers2

2

This should be easy as long as you restrict your analysis to global classes. Local classes and class hierarchies provide a challenge: They can be part of any kind of program and are not easily discovered. You'd have to examine a vast number of programs for potential candidates, and that can be very time-consuming. Other than that, it's a perfectly viable idea.

vwegert
  • 18,371
  • 3
  • 37
  • 55
  • From what you say I guess, local classes are not observed by the RTTS, right? But what is the problem with hierarchies of global classes? If I have the information for each global class individually, building the graph should be easy. – Ulrich Scholz Mar 19 '15 at 09:04
  • You can inspect local classes using RTTS, but you need to know they're there in the first place. The RTTS is useful to work your way *up* the inheritance tree using `GET_SUPER_CLASS_TYPE`, but there's no way to navigate *down* the inheritance tree. – vwegert Mar 19 '15 at 11:40
1

As vwegert points out, as long Your classes are designed in the object repository, with tools like se80/se24, etc, this will be relatively easy, the RTT-services offer all necessary methods to introspect hierarchies, inheritances, and, IIRC, interface-implementations. Local classes in reports/class-methods, functionmodules or interface-method-implementations, wchich are coded simply flat top-to-bottom, will cause much more effort. But it can be done as well. How ? See the package SFUNC. There the code-checks are preformed, and there You surely could extract those logic, which is done by code-check which is triggered by control-F2. By the way, the graph, You would like to create, could also be already created by Your ABAP mates. They already seem to offer XML, so perhaps they could call this here : "ATRA_SHOW_UML_DIAGRAM_JNET" and send the diagram to You. All done AND DELEGATED. :-D. There are other ways, to visualize stuff in ABAP, and to drop it down to hd, where it can be send via email. One method would be the module "RS_DD_GRAPHIC", which we use it relatively often. The function group "SDG1" offers some others, too.

My tipp is: If You can do all of the requirements in one system, and the result is a file ( bitmap, .pdf, anything which only shows a hierarchy-graph , so in the END, if the aim is ONLY visualization), and You are sure about ONLY reflecting classes, which exist in the object repository, then try SAP-Stuff-ONLY. It has all the methods You or Your team need and You are acting in one system. Let it call a type of separation of duties.

icbytes
  • 1,831
  • 1
  • 17
  • 27
  • Actually, goal is an interface in our Java tool that can be queried in an arbitrary way – Ulrich Scholz Mar 19 '15 at 12:51
  • Then what You have is already the right direction. Design a proper hierarchical XML-scheme. Design a Z-Function-module, call it from java, reflect the classes in it, fill the xml int it and return the xml-results back to the java-caller. We do this all the time with .net. – icbytes Mar 31 '15 at 13:59