简体   繁体   English

确定类继承层次结构。 如何?

[英]Determining the class inheritance hierarchy. How?

Our company provides ABAP system analysis services offline.我司提供线下ABAP系统分析服务。 That is, a system's ABAP code is extracted and sent to us as XML.也就是说,系统的 ABAP 代码被提取并作为 XML 发送给我们。 We analyze the system with a tool written in Java.我们使用 Java 编写的工具分析系统。 Personally, I'm not an ABAP expert.就个人而言,我不是 ABAP 专家。

One upcoming task is building a class inheritance graph.一项即将到来的任务是构建类继承图。 One could certainly do that based on the XML.人们当然可以基于 XML 做到这一点。 But as ABAP provides the RTTS/RTTI, why not using it?但是既然 ABAP 提供了 RTTS/RTTI,为什么不使用它呢? My idea is:我的想法是:

  • Write an ABAP program that queries the RTTI and extracts the full class hierarchy编写一个 ABAP 程序,查询 RTTI 并提取完整的类层次结构
  • Send the result as XML and provide an interface to access that information (not part of this question)将结果作为 XML 发送并提供一个接口来访问该信息(不是这个问题的一部分)

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.正如 vwegert 指出的那样,只要你的类是在对象存储库中设计的,使用 se80/se24 等工具,这将相对容易,RTT 服务提供了所有必要的方法来内省层次结构、继承和 IIRC、接口- 实施。 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.请参阅软件包 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.在那里执行代码检查,在那里您肯定可以提取那些逻辑,这是通过由 control-F2 触发的代码检查完成的。 By the way, the graph, You would like to create, could also be already created by Your ABAP mates.顺便说一下,您想要创建的图表也可能已经由您的 ABAP 伙伴创建。 They already seem to offer XML, so perhaps they could call this here : "ATRA_SHOW_UML_DIAGRAM_JNET" and send the diagram to You.他们似乎已经提供了 XML,所以也许他们可以在这里调用它:“ATRA_SHOW_UML_DIAGRAM_JNET”并将图表发送给您。 All done AND DELEGATED.全部完成并委托。 :-D. :-D。 There are other ways, to visualize stuff in ABAP, and to drop it down to hd, where it can be send via email.还有其他方法,可以在 ABAP 中可视化内容,并将其放到高清格式,然后可以通过电子邮件发送。 One method would be the module "RS_DD_GRAPHIC", which we use it relatively often.一种方法是模块“RS_DD_GRAPHIC”,我们相对经常使用它。 The function group "SDG1" offers some others, too.功能组“SDG1”也提供了一些其他功能。

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.我的提示是:如果您可以在一个系统中完成所有要求,并且结果是一个文件(位图,.pdf,任何只显示层次结构图的东西,所以在 END 中,如果目标只是可视化),并且您确定仅反射存在于对象存储库中的类,然后尝试 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.让它称为一种职责分离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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