简体   繁体   中英

Determining the class inheritance hierarchy. How?

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, eg, performance bottlenecks?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM