Skip to Content

Every day I get a “Google Alert” of all the news stories about SAP.

Yesterday one came up saying a company in Hungary were giving away a free add-on to the ABAP editor which improved the “pretty printer” function.

Without further ado, here is the link:-

http://www.hovitaga.com/buy-product?product=ADVPP

You notice it says “buy” – this is actually free, but the “price” you have to pay is to share the fact you have downloaded this on a social media site such as Facebook or Linked In. I chose Linked In because this is a work related thing.

Anyway, this does not do that much, but it does automate a few things I spend a lot of time doing manually, e.g.aligning DATA statements such as when I am declaring structures and what have you.

Anyway I downloaded it, it does what it says on the tin, and it has not blown up my sandbox system.

More interesting to me is seeing HOW it works, which is an implicit enhancement to function module PRETTY_PRINTER. I had to go into the enhancement and add a comment, and then activate the ehancement again before it worked, it might work for you straight off, if not try that method.

I won’t be able to stop myself enhancing this further, the best example I can think of is the automatic commenting of local classes and methods, to match what standard SAP does with PERFORM routines.

Rant Time! If SAP was REALLY serious about making people use object orientated programming, they would make it as easy as procedural programming e.g. it would be good if when I double clicked on a method defintion then a skeleton implemenatton would be generated with comments saying what the signature was – basically I want the exact same thing that happens when you double click on a call to a PERFORM that does not yet exist.

ABAP OO came out in the year 2000, so SAP has had 13 years – THIRTEEN YEARS – to unify this behaviour i.e. improve the creation of local methods so they are as good as local PERFORM routines, and it has not bothered. What does that tell you about the level of commitment?

Someone is going to say “oh, you can do that in ABAP in Eclipse” well hooray, in five years time when we upgrade again I’ll be able to use that. In the meantime I think playing with this new toy may well solve the problem, I will go farther I will add what I want using the same mechanism.

Anyway, ranting aside, the link above takes you to a page where there is some documentation about what this free tool does, and videos and what have you.

This business model is getting more and more common – companies giving away free things to try and get you hooked, a bit like drug dealers do, for example SALT which is quite a reasonable product given it is free, and I wholeheartedly approve!

Thus far we have discovered that the imrpoved pretty printer mangles the archaic ABAP command “AT END-OF” which used to be used in LOOPS. That command is strongly discouraged from future use as it can give unpredictable results in some situtaions, but nonetheless that’s a bug. An easy fix I imagien, I’ll be able to fix it in our system, no problem, and then I’ll add how to fix it intot his blog.

Cheersy Cheers

Paul

P.S. We have found one bug so far, the new pretty printer mangles the archaic statemtn “AT END OF” which can be used in loops but should not be as it gives weird results. Anyway, a one line code fix:-

Pretty Printer Fix.PNG

To report this post you need to login first.

21 Comments

You must be Logged on to comment or reply to a post.

  1. Graham Robinson

    Thanks for bringing this to my attention Paul – although the download is not available at the moment. πŸ™

    In response to your rant – perhaps you could do some of this yourself given this enhancement has shown you the way. πŸ˜†

    Cheers

    Graham Robbo

    (0) 
    1. Paul Hardy Post author

      Mr.Graham,

      I shall do this very thing, and then tell the world. Maybe that wll shame SAP into including this in the standard system….

      Cheersy Cheers

      Paul

      (0) 
      1. Jens Petersen

        I would die for having that functionality! Seeing that your promise is from April, is there any chance that you will do it anytime soon?

        Thank you for the good blog btw.

        (0) 
        1. Paul Hardy Post author

          April last year…

          As it turned out someone beat me to this….

          http://wiki.scn.sap.com/wiki/display/ABAP/Tool+to+generate+a+class+implementation+from+its+definition?original_fqdn=wiki.sdn.sap.com

          This is still not as good as I would like (the only thing I would like is native SAP support to make OO coding at least as good as procedural coding tool-wsie within SE80) but it is well ahead of where I had got to.

          I have played around with that enhancement to the pretty printer a lot, whenever I find myself doing something cosemtic to the code again and again I say “hang on, is there not a way to automate this?”. This is the approach I take in actual programming i.e. never write the exact same code twice.

          I think you mentioned somewhere else on the SC you did not think too much of Eclipse, but that is the route SAP are pushing. SAP do not alwasy win, and I am not at an SAP level where I could try ABAP in Eclipse for my day to day work. Until I get to that point I could not really comment one way or the other. But with 70,000 developers SAP could at least THINK about putting some of the nice Eclipse features into SE80 for those not able or inclined to use Eclipse…. and putting local methods on a par with local FORM routines is not really in the “new and fancy” basket.

          Cheersy Cheers

          Paul

          (1) 
          1. Jens Petersen

            I agree with you, but SAP always endeavors to push their latest exploits into the community, and tools that allow said community to work without them are not helpful in that context.

            Tbh I do not really understand the article you linked to. At first, the author announces that he is presenting a “Tool to generate a class implementation from its definition”.

            Then he points out that he is in fact giving an example for the use of “the ABAP source code scanner”. He further explains that there is an ABAP command “scan abap-source" that will launch that code scanner. However, what he does not mention is what the code scanner has to do with the goal he proposed in the headline and how he plans on using it.

            How should his code be used? I mean, when I am coding a local method in SE38, should I run a different program in another window that includes this command? Or should I put that statement at the beginning of my code and launch the program so that my code will modify itself?

            The article looks nice and all, but IMHO it lacks a proper introduction. There is also no complete code following it, only code snippets with interjacent text. Should I copy all the snippets and chain them together to form some sort of program that will hopefully be doing something useful?

            What I would have expected is an explanation of the form “You can insert the the following code in user exit (or BADI) xyz, and it will provide a definition and implementation frame whenever you code a method call.” After that, he could have pointed out exactly how his solution works (which he did, but without the necessary introduction).

            The fact that he explains in detail what his ideas are and how his code works is nice, but the way it is presented, I do not understand exactly what the result is supposed to achieve and how it can be used.

            (0) 
            1. Manish Kumar

              Complete code is present. Just start reading the wiki from “Here is the complete code of the tool:” text onwards.

              First step is to create report using code given just after “Here is the complete code of the tool:”. When source code internal table is passed to subroutine of this report, the internal table should have extra generated lines.

              Now the question is how to pass source code internal table to that subroutine. He would be calling the subroutine from ABAP Editor exit (Call Pattern > Other pattern > Z_.. ) , whose steps are given just after “Building it in as editor pattern” text.

              Have a look at another use case of such Editor exit.

              Call a function module in the ABAP Editor: Stop Crying – Start Laughing.

              You could comment on that wiki or open a discussion for additional questions.

              (0) 
  2. Florian Henninger

    Hi Paul,

    thank you for bringing it (again) to my mind.

    One thing to add and don’t get me wrong. This here is really cool, but is it really a fail of SAP that your company doesn’t decide to do an upgrade, so you could use Eclipse. Additional to that, isn’t it a mistake of all of us, that we just used the “not so good” tools all the time?

    Just a thought…

    ~Florian

    (1) 
    1. Paul Hardy Post author

      It is 100% not the fault of SAP that my company won’t upgrade to the latest version, unless you wanted to be philospical about it and wonder why they made putting in an enhancement pack 97% as diifficult as an actual upgrade.

      That is not a guess, we have actually done such a thing, and to be honest we can only convince “the business” to let us do such a gargantuan task every seven or eight years, and we last did one in 2012 to take us to EHP5 where we will remain for a very long time.

      We had a meeting the other day about whether we could go from EHP5 to EHP7, but it did not work out too well from my perspective. When asked what the benefit was someone said “none” and all I could mention was all the groovy new development things – like ABAP in Eclipse and the Floorplan Manager workbench – which only benefit the developers and there are only three permanent ones.

      I do not know how prevalent this is, but some people have noticed an ironic aspect of all the EHP functionality being delivered as dormant so as to not disrupt the existing landscape. The funny thing is , you do a technical upgared do not activate anyt new things, you have to test everything anyway, just in case, and then six months afterwards a lot of people are too scared to switch anything new on as you have no idea what unrelated thing will break – the only possible way around this is to switch the whole lot on during the upgrade so you only have to teste everything once – the exact opposite of what SAP intended.

      So what happens? Newly delivered SAP functionality remians undiscovered and inactive, and the exact same thing gets built in custom ABAP. That is good news for us developers but it could be argued this is a strange way to carry on … yet I have seen it again and again in assorted organisations.

      Cheersy Cheers

      Paul

      (0) 
      1. Matthew Billingham

        EHP7 means that the ERP system is more HANAized, meaning business processes are “significantly faster”. That’s the benefit for the business, which is all anyone is interested in.

        The development goodies are only side benefits.

        I work mainly on BW systems. They’re less reluctant to upgrade. Currently developing web dynpro using HTML5 on a 7.4 system. NEW,    LOOP AT tab INTO DATA(wa)….I must get around to installing eclipse…. 😎

        (0) 
      2. Jānis B

        Hi,

        Our situation is very similar to what you describe… although we manage to bring out two releases (a “minor” and “major”) of our custom ABAP for IS-U, and the “business” manages to perform at least the “regression test” of kern processes each time.

        Maybe I’m too naive and inexperienced in the whole SAP upgrade/EHP thing, but is there really no upgrade path to update just the BASIS and SAP_APPL (and whatever other cross-aplication tidbits are necessary), yet functionally remain on ERP 6.00 EHP5? Instintively (and perhaps again naively) it feels that the potential for disruption through updating BASIS and SAP_APPL would be significantly smaller… “Small” BASIS upgrade every, say, 3 years, and big one – whole new ERP EHP – 6 years πŸ™‚

        cheers

        Janis

        (0) 
  3. Peter Inotai

    Hi Paul,

    Thanks for sharing this, it’s a quite useful extension. Just downloaded and started to test.

    Someone is going to say “oh, you can do that in ABAP in Eclipse”

    Just placed an external breakpoint in FM PRETTY_PRINTER and it’s also called from Eclipse. So it’s still relevant for that.

    Also noticed that after import the enhancement was not called in a  ERP Ehp7 (Basis 7.40) system, until I did a consistency check in SE80 for the enhancement and fixed the mentioned issue there and activated the enhancement. After that it worked fine. Just in case if someone has the same release/issue.

    Cheers,

    Peter

    (0) 
    1. Peter Inotai

      Tested also for ERP Ehp5 (Basis 7.02) system:

      Consistency check also fails, but the Enhancement is called. Probable because the transport was created in a Basis 7.00 system.

      ADV_PP_ENH.JPG

      Peter

      (0) 
  4. Matthew Billingham

    Not sure if you’re aware, but if you have the object list open, you can drag and drop methods from the class tree into a method – and it gives you a skeleton usage of the method.

    (0) 
      1. Peter Inotai

        Drag and drop works also for older releases (maybe even 46c). This approach is only available for the ABAP editor with code completion (as of Basis 7.02).

        (0) 

Leave a Reply