2

A while ago during documenting legacy code I found out there is a tool for displaying call graph (call stack) of any standard program. Absurdly I wasn't aware of this tool for years :D

enter image description here

It gives fancy list/hierarchy of calls of the program, though it is not a call graph in a full sense, it is very helpful in some cases.

enter image description here

The problem is this tool is linked only to SE93 so it can be used only for transactions. I tried to search but didn't find any similar tool for reports or function modules. Yes, I can create a tcode for report, but for function module this approach doesn't work.

If I put FM call inside report and build a graph using this tool, it wraps this call as a single unit and does not analyze deeper. And that's it

enter image description here

Anybody knows a workaround how we can build graph for smth besides transaction?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Suncatcher
  • 10,355
  • 10
  • 52
  • 90
  • The call graph is not maintained anymore since at least Basis 4.6, and it doesn't work for classes and methods. Despite this limitation, if you are interested to use it for reports and function modules, you may call directly the function module `RS_CALL_HIERARCHY`, with parameter `OBJECT_TYPE` set to `P` for programs and `FF` for function modules. – Sandra Rossi Apr 13 '20 at 13:41
  • I just [receive this](https://imgur.com/a/1uw77FC) if I call it for function module, no call hierarchy showed. Also I see no output parameters in this FM, did you try it for function module? – Suncatcher Apr 13 '20 at 14:43
  • Yes, I tried it with function modules and with programs, and other objects too. It works more or less, whatever it's for transaction codes, function modules or programs, and it has not been maintained for 20 years. Maybe you have to rebuild the object list of its function group. – Sandra Rossi Apr 13 '20 at 15:31
  • `RS_CALL_HIERARCHY` is the tool that is behind the option in `SE93`, which analyzes the hierarchy below the transaction code, and goes down for each subroutine, function module, etc. It's possible to call this same tool individually for one program or one function module. I found one function module containing a PERFORM but it's not displayed by the tool. So, the tool is buggy, whatever it's for one transaction code or one function module (try it by wrapping the function module in a custom transaction code and run the tool). It works well only for old programs. – Sandra Rossi Apr 13 '20 at 15:45
  • `It works well only for old programs` I tried more than 10 different FMs and none of them worked, maybe because all of them contained performs, but for programs it works. So yes, seems to be deprecated now and buggy – Suncatcher Apr 13 '20 at 16:07

2 Answers2

2

The cynic in me thinks RS_CALL_HIERARCHY was left to rot. Sandra is right, it definitely used to work. Once OO came to abap, interfaces and dynamic/generic code became possible. So a call heirarchy based on static code analysis was pushing proverbial up hill.

IMO the best way to solve this is a FULL trace and then to extract the data from the trace. There are even external tool that do that. This is of course, still limited as running a trace on every execution path can be very time consuming. Did I hear someone say small Classes please ?

Trans SAT. Make sure teh profile you use isnt aggregating, and measure the blocks you are interested.

Trace profile Make sure the profile isnt aggregating calls And set to measure the relevant callable blocks

Now wade you way through the trace. https://help.sap.com/doc/saphelp_ewm93/9.3/en-US/4e/c3e66b6e391014adc9fffe4e204223/content.htm?no_cache=true

Have fun :)

phil soady
  • 11,043
  • 5
  • 50
  • 95
1

The call hierarchy displays also works for programs and function modules.

In my S/4HANA system, for VA01, it displays: enter image description here

Clicking the hierarchy of function module CJWI_INIT displays: enter image description here

I get exactly the same result by calling the function module RS_CALL_HIERARCHY this way: enter image description here

The parameter OBJECT_TYPE may have these values:

  • P : program
  • FF : function module

The "call graph" is not maintained anymore since at least Basis 4.6, and it doesn't work for classes and methods.

But the tool is buggy: in some cases, a function module containing a PERFORM at the first line, it may not be displayed, whatever the call graph is launched from SE93 or directly from RS_CALL_HIERARCHY.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • I tried RS_CALL_HIERARCHY exactly with that module and first of all `PROGRAM` parameter [is obligatory](https://imgur.com/a/9RT6269) and is not callable like on your screenshot, secondly it [doesn't not return anything](https://imgur.com/a/6DsCkrr) even if I fill all params. Tried on 7.50 and 7.02 systems. So I cannot accept this as answer, because my experience differs from you – Suncatcher Apr 14 '20 at 09:10
  • 1
    I don't ask for accepting my answer ;-) I just provide screenshots to illustrate my initial comments. Maybe try with old function modules like `DELETE_TEXT` maybe it will "better work" for you. Anyway, it's buggy, so I don't think it's worth spending more time on this tool. Let see if someone developed a custom tool. – Sandra Rossi Apr 14 '20 at 09:24