Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Wich Source Code was executed ?

Rodrigo-Giner
Active Contributor
1,029

My goal is to know what part of the source code (mainly custom) were executed from a functional point of view, hightlight the source code to know the paths the program took. Something like the flow graph of a SAP workflow were you can see the flow that actually took an execution.

I know that ATC in ADT will show you the code coverage but is only for Unit Test, right? I'm looking something like that but only for the actually executed code.

I have done in the past stuff with READ REPORT, SCAN ABAP-SOURCE/CL_CI_SCAN but it's all static Im looking to somehow "log" the execution and then interpret the results.

I investigated and found out that in the past in transaction SAT it was a button that somehow showed a Sequence Diagram but then it was removed. Does currently the ABAP Workbench or ADT have a tool like that or someone can give me some information on how to develop this? if I can get the code I could later on move it to a graph visualization.

11 REPLIES 11

Sandra_Rossi
Active Contributor
785

In SAT, you have the hierarchy of procedure calls? Does it suit you?

From this trace, you may then generate a UML sequence diagram, see here: https://wiki.scn.sap.com/wiki/display/Snippets/ABAP+Trace+to+PlantUML+Sequence+Diagram. I don't know if it still works with recent ABAP versions (cc jacques.nomssi)

matt
Active Contributor
785

transaction SCOV for development and test (coverage analyser), UPL for production.

Rodrigo-Giner
Active Contributor
0 Kudos
785

Thx for the info I used in a little demo program but it highlight pretty much everything in the source code.

In the demo program I show a GRID SALV or LIST SALV depending on the amount of entries and it highlight me both blocks of the IF statement. btw I run it only once.

The other problem is that is seems that the info is not in chronological order.

Regards

Rodrigo-Giner
Active Contributor
785

Hi Sandra, that it exactly the feature that was removed because it was once wrongfully released.

gasparerdelyi
Product and Topic Expert
Product and Topic Expert
785

If you need chronological order, you might need a non-aggregated ABAP trace, using SAT, or ABAP Profiling in ADT. This should answer your question as calls to modularization units are traced.

This will most often create a huge tracefile (and slow downs execution significantly) and it is easy to exceed even maximal limits. You might need to restrict tracing to a limited set of code.

In SAT, Call Hierarchy displays the information you need but in a bit ugly way. And you can navigate to the code location for each step. the Index field tells the sequence of the events, and level tells you the depth of calls.

In ADT, there is Call Sequence and also Call Timeline (more graphical representation, works well if significant time is spent, at least as a gross time for some modularization unit)

In both tools, the mentioned functionality is possible for non-aggregated traces only.

Otherwise, if the sequence of the two calls is the question, it could be also tested by debugging...

0 Kudos
785

Yeah, but the SAT doesn't acctually log the flow logic of the program if I have an IF...ELSE... I want to know in wich block entered (IF or ELSE)

gasparerdelyi
Product and Topic Expert
Product and Topic Expert
0 Kudos
785

It will log the method call, and together with the method call the location in the source code. For each matching line of the hit list, navigation to the source code will tell, which souce code position is it for.

For your purposes, only non-aggregated trace is sufficient because you are interested in the order of the method calls at different souce code locations.

Armin_Beil
Product and Topic Expert
Product and Topic Expert
0 Kudos
785

I know my answer does not properly fit what you asked for, but maybe ADT dynamic logpoints could be helpful for you. It won't highlight your code in any way, but you can create logpoints in code positions of interest and later on see whether that code was executed or not.

nomssi
Active Contributor
785

the logic was tested on a Netweaver 7.5 ABAP stack, so which system release are you on?

An UML sequence diagram is only generated if the measurement was recorded without aggregation. To this aim, you have to create a custom variant in transaction SAT and disable aggregation.

You can then process with the standard

  • Start transaction SAT -> Evaluate -> Double Click on a measurement; on the next screen press F8 (Display measurement as UML sequence diagram)

or with my version:

https://github.com/nomssi/ABAP-to-PlantUML/tree/master/sequence%20diagram

JNN

Rodrigo-Giner
Active Contributor
785

Yeah Jacques thanks my bad the button didn't appear because of the agreggration option. I tried you code it's pretty cool I had seen your blog I also used in the past your Class Diagram. Pretty cool stuff.

The problem is that the info in SAT at the end shows a sequence diagram it's cool to undertand the flow between different programs/calls but you can see the "flow" from a logic point of view. What I´m trying to do is more kinda an Activity Diagram/flow Diagram but showing the executed path exactly like the workflow logs shows you, where you see the conditional and see wich path it took.

So far the best approach was using the Script debugger to trace all the statement executed so later on I can go back and highlight the source code or the program with the lines that were actually executed but I wanted to take it further and display it in a diagram.

Rodrigo-Giner
Active Contributor
785

The best approach that I could find so far was using the Debugger Script. In a Script I trace all the statement in the controler Program and later on in another program having the lines of code executed I could take the original program and highlight the lines that were executed.

Sadly it depends on manual steps but so far was the only option to actual know the statement that were executed within a program.

Regards