Documente Academic
Documente Profesional
Documente Cultură
It’s kinda a mantra that I live a reasonable part of my life to. I think the above image is a not
unjustifiable representation of my feelings about documentation:
But there are many good reasons that I should be doing doco. Most of them are supposed to save
the customer money in the long run. And occasionally by doing the doco, I even find some small
errors in my code that I hadn’t seen before.
UML output
The first thing I decided, was that I was NOT going to try to build the graphical output myself.
Having had lots of fun in Sydney trying to make Gravity do something it really wasn’t designed
for I thought I’d research how else I could get my interaction diagrams created.
If in doubt Wikipedia
http://en.wikipedia.org/wiki/List_of_UML_tools
There were loads there, and I’d pretty much decided on UMLet when I discovered something
about interaction diagrams. Basically, interaction diagrams are supposed to show interaction
between objects. Bit bloody obvious really. However, the thing is, if I’m documenting my code, I’d
really like to show the interaction within my objects too. I.e. if I make a call to a private method of
my class, I’d really like that to show up in my diagram. Given that interaction diagrams are only
supposed to show external interaction it’s not surprising that most of the tools for creating the
diagrams don’t really support this idea of internal object calls.
So a bit of browsing later and I found PlantUML. It has some awesome functionality for creating sequence
diagrams, actually, most UML diagrams it seems, but it was the sequence diagrams that I was interested in.
Here’s a simple example:
See how it’s quite possible to show “internal” calls of an instance and also show the life time
of those calls. This feature I didn’t find on the other free UML tools that I looked at. There are
a bunch of other formatting features that can be used too. If you’re interested check out their
website: http://plantuml.sourceforge.net/sequence.html
However, it does not allow you to do things like filter out standard SAP routines (as far as I know! If anyone
can tell me how to do this (without needing to list every method I call, please let me know!) When I was looking
at one of my examples, where I ran a program to generate a performance review document for an employee,
there were over 100,000 different routines called. Only about 400 of those calls involved my code, so you can
imagine generating a UML diagram for the whole 100,000 calls would be a bit of overkill (not to mention an
impossible to read diagram).
In customer systems there is a function module ATRA_UML_DECIDER that has been purposely
handicapped. One does have to wonder why this has been done, but nevertheless it has. It
allows the user to chose from a list of potential UML extraction routines. All of these routines
implement the IF_ATRA_UML_TOOL interface. There are classes for extracting to JNet, Borland
Together and Altova. Now, I’m sure that Borland and Altova have good products, it’s just that I
don’t really want to spend money on then when there are perfectly good (for my tasks) free and
open source products out there.
There is a factory class/method CL_ATRA_UML_FACTORY that creates an instance of a class
implementing the interface. I overrode this method to use my particular extractor if it was me
running the code. In the future, I might enhance this to check for a user role, or perhaps a user
parameter, that’s trivial, the main point will be to allow others to access this logic too.
Need to know which session I will be recording. If I left it as “Any” it will start recording this
session, not very useful!
Session 2 it is!
I now need to delete the scheduled measurement. Despite the intimidating words, this does not delete my
measurement, just the scheduling of it.
now swapping to the “Evaluate” tab in SAT I can see my measurement, and I can click to output
to UML
Clicking on the button triggers a bit of a pause whilst the system code chugs away and does
loads of stuff it doesn’t need to do…
Then
Would probably have been a little bigger if my employee had a job assigned to their position, but
you can see how incredibly easy this now makes documenting the functionality I’ve built.
After checking the SCN T&C and finding similar (if not worse conditions for the upload of SAP derivative code
(it uses an SAP standard interface, so it probably is)) and the same indemnity clauses that make me refuse to
participate in Code Exchange, I've decided not to share the code here. That said if someone else is willing to
put the code out there on Code Exchange I'm more than happy to provide it to them. Perhaps someone will put
their hand up to load it into Code Exchange - Gregor Wolf ???
This content was previously published on my own blog, but the tip about the SLAD filter wasn't, and certainly
the code wasn't published there. Some excellent points have been raised about how this isn't a replacement
for actually documenting the functionality of the code that has been built. But, I have found at least one case
where using this tooling has helped me write a better bit of code by sharing references to objects that I didn't
realise were being instantiated multiple times. Could something like this help you with your doco? Do you have
any thoughts?
11688 Views Tags: sapmentor, abap, documentation, sat, uml, abap_trace, doco, slad, plantuml,
sequence_diagram, i_hate_doco
Yves Xiao
Mar 5, 2014 9:20 AM
For those who are also interested in UML diagram function in SAT in release 740: double confirmed from
Netweaver basis developer that this will not be provided in release 740...(not sure about future release if any)
seems such a helpful function was demised forever somehow.
As Srikanth mentioned, cannot see the button in SAT. We are also on 702. Appreciate, if you can help us in
activating the button.
Satbirsingh Hundal
Sep 18, 2013 2:04 PM
Very informatic,
Best Regards,
Satbir
I'm pretty sure the functionality is there in 7.02 not sure about 7.01 or below. I'll have a quick check today, but
think there is a routine that checks what you have installed that hides/shows the generate uml button. Let me
get back to you...
Chris
Srikanth Chandroo
Aug 29, 2013 9:15 PM
Hi Chris,
It probably sounds clichéd by now, still this is real exciting stuff!
I have one question though, does this work only on SAP NW 731 and plus levels only?
We are on SAP NW 702 and are due to upgrade not any sooner, so was wondering if I can still use this
functionality. I dont see the UML generator button in SAT transaction now. If you can also add this info of the
bare bones minimum required level of SAP NW to enjoy this useful functionality?
Thanks!
Srikanth
for me the real use is in supporting the solution, not in explaining how it should be built (if you have to use
detailed interaction diagrams to do that, then you've probably already lost.)
One should also consider however, that many successful agile solutions are built without detailed specs before
the build (they also tend not to document). But in the case that you have a so-called "quality control" busy-
body, then loading them up with diagrams often helps.
Whilst a building architect would be a fool to start building a sky-scraper without a plan, he does not have the
benefit of being able to create his product iteratively or being able to refactor it on the go!
Again, I'll point out - to me one of the best bit of the solution was being able to visualise the flow of my code
and from that make some simple tweeks that saved a lot of unnecessary logic being executed. Without the
diagram, it would have been reasonably tricky to find those points where the code could be enhanced.
Cheers,
Chris
But then again, it's the opposite of what I'm supposed to do.
I really should make the UML diagrams upfront, and then implement them.
In such case, I wouldn't even need the UML export.
you'd be surprised though how often I'm asked to make a diagram for something that has already been build...
If a real construction architect would come in such situation, I'm pretty sure that they won't take the job, and the
building will probably collapse in the short term.
If anyone finds an error in the code, and has a fix, please do let me know!
Cheers,
Chris
The system I built this on was a 7.31 EhP6 system so don't think it's a stack level thing.
code type i,
sap_code type i,
end of ty_call_stack,
instance type i,
code type i,
end of ty_object,
Cheers,
Chris
Chris Paine
Aug 22, 2013 10:18 AM
Might be worth noting that for very large diagrams you can increase the Java heap size to allow plantUML to
process them - use cmd line parameter like
Kay Streubel
Aug 22, 2013 9:32 AM
This looks really interesting. Thanks for posting!
However, while trying it on an ABAP 7.31 EHP6 server, I noticed that from the source code you posted the
type definitions for TY_OBJECT and TY_CALL_STACK (+ the corresponding table types) were missing. I just
added them.
In addition, I could not find the UML generation button in SAT. Is there some configuration missing?
I recently had an issue generating a diagram that had over 50 participants in it - think that PlantUML has some
issue with very large diagrams (not that a diagram that large would be readable anyway! But other than that it
seems to work quite nicely.
Riju Thomas
Aug 22, 2013 6:10 AM
Really it is a good one.
Thanks for sharing.
Ivan Femia
Aug 22, 2013 5:32 AM
It looks really interesting...
I'll give it a try thank you for sharing!
hopefully I can make your life even easier - I just posted the code I used at:
http://www.wombling.com/coding/code-for-uml-sequence-diagram-extract-from-abap-for-plantuml/
Somewhat ridiculously, as discussed over here:Share and share alike there isn't a space in SCN for sharing
code that does not come with terms and conditions that are (in my view) unacceptable for an individual to
contribute under.
Robert Petersen
Aug 21, 2013 5:53 PM
Thanks Chris,
I must say this comes in handy right now - not a day early, too.
That's exactly what our management guys want to see in the weekly meetings; and your post will save me a lot
of time
Greets,
Rob