Skip to Content

If you go and ask 10 experienced programmers about what is their biggest professional fear, 7 would say to become obsolete. I don’t have any hard data to support such a statement, it was pure empirical, literally I went and asked this to 9 of my colleagues and got these answers. Some more serious people concluded than one in three developers fear A.I will replace them, but that’s another discussion.

So here I am, 10 years old ABAP developer trying to catch up with SAP’s latest technology. I’m starting this blog as kind of a journal in which I could come back to it one year later, and let 1-year future me decide whether there have been any improvements, or it was just a waste of time -although no time in educating yourself is wasted time, I believe.

Hopefully we won’t get to this point anytime soon.

After reading Paul Hardy’s ABAP to the future book -make yourself a favor and get it, the topics to improve became clear:

  • Object-oriented programming in general.
  • Test-Driven development and ABAP Unit.
  • Business Object Processing Framework (BOPF).
  • Floorplan Manager and other UI technologies (SAP UI5 perhaps).
  • ABAP for SAP HANA.

To improve in OOP, I decided to take some examples out of the book Head First Object-Oriented Analysis and design, which is also very good and fun to read. The first chapter describes a guitar store owner who decided to ditch his paper-based system for keeping tracks of guitars and start using a computer system to manage his inventory.  Naturally, he bought SAP ERP and hired a consultant to implement his system.
Here’s the initial class diagram design for Mike, our guitar shop owner:

Ok, that was a bit disappointing, but still a good place to start. Each of the guitars are represented by the abstraction ZCL_GUITAR, which has the same structure as the database table ZGUITARS.

Nothing much to see in ZCL_GUITAR, as it represents just a data structure, there’s no behavior inside. Instead of creating setters and getters methods, thought it would be a good idea just to create a public attribute and make it read-only.

class zcl_guitar definition public final create public .

 public section.

   data: guitar_record type zguitars read-only.

   "! <p class="shorttext synchronized" lang="en"></p>

   "! Creates a guitar object from a guitar structure

   "! @parameter i_guitar_record | <p class="shorttext synchronized" lang="en"> Guitar structure </p>

   methods constructor importing i_guitar_record type zguitars.

 protected section.

 private section.

endclass.


class zcl_guitar implementation.

 method constructor.
   me->guitar_record = i_guitar_record.
 endmethod.

endclass.

In TDD methodology, before creating any production code you should first create failing tests, and then just write enough code for the test to pass. This is supposed to ensure that all of your code is properly tested, and your system is working correctly. So if I want to add guitars to the inventory, first thing I need is to create a test method. This is a really cool thing to do in Eclipse, go to the test classes tab in the bottom of the source code, type the word ‘test’, press CTRL + SPACE and there is a template waiting to be inserted within the code

 class ltcl_inventory definition final for testing duration short 
 risk level harmless.

private section.

methods:

  setup,

  add_guitar_test for testing raising cx_static_check.

data inventory type ref to zcl_inventory.

endclass.


class ltcl_inventory implementation.

 method setup.
  inventory = new zcl_inventory( ).
 endmethod.

 method add_guitar_test.
   data(guitar_record) = value zguitars(  serialnumber = 'FE34000'
                                           price = '1745.43'
                                           builder = 'Fender'
                                           model = 'Stratocaster'
                                           type = 'Electric'
                                           backwood = 'Maple'
                                           topwood = 'Maple' ).
   inventory->add_guitar( new zcl_guitar( guitar_record ) ).

   cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).

 endmethod.

endclass.

The add_guitar method is empty, so after running this test ( CTRL + SHIFT + F10 ), the Eclipse IDE shows me the failed test:
Fair enough, just need to fill in some code into the add_guitar method to past the test. The method add_guitar is supposed to add guitars to the inventory, which is represented as  a hashed table from within the class

types: begin of ty_guitar,
         serial_number type z_serial_number,
         guitar        type ref to zcl_guitar,
       end of ty_guitar.

types: guitars_tab type hashed table of ty_guitar with unique key 
  serial_number.

Then the class definition would go like this

class zcl_inventory definition public
 final create public.

 public section.

   "! <p class="shorttext synchronized" lang="en"></p>
   "!  Adds a guitar to the inventory
   "! @parameter i_guitar | <p class="shorttext synchronized" lang="en"> Guitar object to add</p>
   "! @parameter r_ok | <p class="shorttext synchronized" lang="en"> Guitar was added to inventory</p>
   methods add_guitar importing i_guitar type ref to zcl_guitar 
                                    raising   zcx_guitar.

 protected section.

 private section.

   data guitars type guitars_tab.

endclass.

One pretty cool thing about hashed tables is that they throw exceptions when you try to insert a duplicate record. The annoying thing is that this feature apparently only works for the secondary key. This left me no other choice than checking for SY-SUBRC in the test method.

method add_guitar.
   data(guitar_record) = value ty_guitar( serial_number = i_guitar->guitar_record-serialnumber
                                          guitar =  i_guitar ).

   try.
       insert guitar_record into table me->guitars.
   catch cx_sy_itab_duplicate_key.
      
      raise exception type zcx_guitar
         exporting
           textid = zcx_guitar=>duplicate_record.
   endtry.
 endmethod.

Run the test again and great! First test passed.


Now let’s create a test in which you add a duplicate record. Here what’s got me thinking is how to manage that exception raised from the add_guitar method?. According to SAP a test method should not catch an exception

But what about when you are provoking an exception and this one does not get raised? The recommended solution in the previous link did not work for me. Even after the second call to the method under test, the exception did not stop the execution of the test method and I got the wrong error that an exception was not raised. After removing the cl_abap_unit_assert=>fail call the test passed, though.

Anyways here’s the whole test class

 class ltcl_inventory definition final for testing duration short
 risk level harmless.

 private section.

   methods:
     setup,
     add_guitar_test for testing raising cx_static_check,
     duplicate_guitar for testing raising zcx_guitar.

   data inventory type ref to zcl_inventory.

endclass.


class ltcl_inventory implementation.

 method setup.
   inventory = new zcl_inventory( ).
 endmethod.

 method add_guitar_test.
   data(guitar_record) = value zguitars(  serialnumber = 'FE34000'
                                   price = '1745.43'
                                   builder = 'Fender'
                                   model = 'Stratocaster'
                                   type = 'Electric'
                                   backwood = 'Maple'
                                   topwood = 'Maple' ).

   inventory->add_guitar( new zcl_guitar( guitar_record ) ).
   cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
 endmethod.

 method duplicate_guitar.
   data(guitar_record) = value zguitars(  serialnumber = 'FE34000'
                                    price = '1599.95'
                                    builder = 'Fender'
                                    model = 'Stratocaster'
                                    type = 'Electric'
                                    backwood = 'Maple'
                                    topwood = 'Maple' ).

   data(guitar1) = new zcl_guitar( guitar_record ).
   data(guitar2) = new zcl_guitar( guitar_record ).

   inventory->add_guitar( guitar1 ).
   inventory->add_guitar( guitar2 ).

*  Supposed to fai the test only if no exception has been thrown by the previous method call
*  Seems not to work
     cl_abap_unit_assert=>fail( msg = 'ZCX_GUITAR not raised' 
                               level = if_aunit_constants=>critical ).
 endmethod.

endclass.

 

Well that’s gonna be it for this time, next time I’ll come up with more tests to make and will try to improve the design of this simple application.

To report this post you need to login first.

16 Comments

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

    1. Glen Anthony

       

      I’ve seen some our your excellent posts/answers etc. on here. If you are at risk of going obsolete then I think there’s not much hope for the rest of us!

      (0) 
    2. Jerry Wang

      Man, remember the dialogue by Arnold Schwarzenegger in Terminator 5? “I am old but I am NOT OBSOLETE”.

      I wish I will be qualified to say this sentence when I am 50 years old. I learn hard every night after I left office just in order not to be obsolete. Due to the large population, there are a tremendous number of excellent programmers in China. See this report from HackerRank finds that while the U.S. and India have lots of developers, Chinese and Russian programmers are the most talented. Working under such circumstance I have to keep learning, otherwise be obsolete. That’s life.

      Best regards,
      Jerry

      (2) 
  1. Paul Hardy

    That “Head First Design Patterns” is a great way to move yourself forward. Somewhere on the SCN you will see a blog I did some years back where I was redoing the “Gumball Machine” chapter from that book in ABAP.

    A lot of programmers don’t care about becoming obsolete they just keep doing what they have been doing the last ten years, because it still works.

    I wrote an SAP Press book all about the various new technologies and all my colleagues at work got free copies. A lot of them found it really useful, one guy felt his desk telephone was too low so used my book as a stand to make it a bit higher, and another guy had a desk where one leg was shorter than the other three so my book came in really handy there as well.

    (6) 
    1. Marco Hernandez Post author

      Funny because I’m using your book as a guide to catch up with NW 7.50 and make myself proficient in recent technologies.

      And you’re right, between staying in the comfort zone and fear for change, many people decide just to stay where they are. Specially when there are no incentives to move forward: Stable job, doing programming merely as a job (people who actually do this as a hobby as well tend to be more up to date), and so on.

      Being a freelancer also forces you to sharpen those skills for what the market is demanding. Not updating yourself is, as I have read from you somehwere else, committing professional suicide.

       

      (0) 
  2. Joachim Rees

    Hi Marco,

    While I agree with you, that learning something new is always a good idea, I don’t fear being replaced by AI or something.

    I think we as a society should re-think the dogmatic connection between (financially) securing one’s livelihood and working.

    Concepts like the basic income are right there, they “just” need to be implemented.

     

    best

    Joachim

    (0) 
  3. Matthew Billingham

    We recently notified SAP of a badly performing bit of code. They sent back some new code that does improve performance. What was depressing, however, is that instead of using 15 year old technology and using HASHED/SORTED tables, it uses a standard table, sort and binary search (30 year old technology?).

    Obviously, some SAP employees aren’t that interested in “trying to catch up with SAP’s latest technology”

    *sigh*

    (7) 
    1. Jelena Perfiljeva

      The program that was developed for us by the consultants just a couple of months ago starts with TABLES. The sad thing is they are likely not the ones who will become obsolete simply because they rates are 1/5 of the US rates and that’s all that management cares about.

      (1) 
      1. Jerry Wang

        In China we call these guys ( normally with low pay ) “Coder” (kindly don’t mix it with the same word used in “TopCoder” ).

        Coders are not programmers or developers. They simply finish coding according to the software specification. How about program design and code quality? They don’t care at all.

        Best regards,

        Jerry

        (0) 
  4. Jerry Wang

    Hello Macro,

    Excellent blog! Thanks a lot for your nice conclusion on the topic listed in your blog.
    Being an employee working in SAP, I just have some comments here. I saw the word “SAP’s latest technology” within the communication of this blog above, no doubt that it could be quite good for an ABAPer to keep learning them as you listed, and IMHO it could be even better if an ABAPer has some basic awareness of the latest technique trends in open source community. Perhaps it is difficult for a traditional ABAPer to touch some of these trends in daily work, however I do think that by knowing them, it can help you to become a better programmer, not just a better ABAPer.
    Some of them come into my mind which are related to ABAPers’ life:
    1. Functional programming
    2. Spring
    3. JavaScript
    4. A kind of NoSQL database
    In order to avoid that my comment become so lengthy here, I post the detail reason why I think it is worth putting some effort on these four points into another blog: What should an ABAPer continue to learn as an application developer Hope you don’t mind.

    Last but not least, there is a technical discussion session about ABAP OO Design held by our team Architect next week. Our Architect recommend every colleague to read your blog first before the session, which proves you did really a good job! See the meeting request where your blog is mentioned below 🙂 Thanks a lot for your blog again.

    Best regards,
    Jerry

    (0) 
    1. Marco Hernandez Post author

      Wow, I certainly never expected this, definitely will go to read your post right away!

      This also proves that there are many colleagues in the same situation, keep in tune for the upcoming posts! Thanks for your comment

      Cheers

       

      (2) 
  5. Michelle Crapo

    I Loved this blog and the answers.

    I was asked the other day by my boss – how many times were you able to just pick up a specification and use it to write your code.   Then go back and have your code work.

    My answer was never.   I needed to know what happened before, after, and then I could put something together.

    HOWEVER, not so long ago I could have held the sign ABAP for Food.   My job was outsourced to a different country.    Bummer, right?    But what made me valuable and not obsolete was my strong development skills – yes.   BUT I knew a little about various other things.   Functional areas, security, BASIS…    Now I have a job I love!

    BTW – 20ish years in SAP…   I’ll always be learning. That’s the fun part of it.

    (1) 
  6. Glenn Allen

    A couple of people have touched on the situation I’m experiencing which is not an issue of obsolescence but rather commoditization. Simply put, our skills are becoming less valuable. It doesn’t matter if you are the best ABAP developer in the world if it’s only worth $30 per hour. If visa laws continue to be abused and offshore capabilities continue to improve, then these skills are less relevant (at least in the US). How is it in the EU?

    For those of us who survive it’s an ongoing battle. In the past you might have had a team of 5 or 6 developers where you would share information and bounce ideas off of each other. Now you have a blended team with 1 or 2 onsite and 5+ offsite. The richer development tasks go offsite and onsite deal with break fixes and requirement gathering,etc. On a few occasions I’ve considered switching away from SAP.

    Even though my comments are somewhat bleak I am an optimist and do try to grow my skills. I am very fortunate to be on a HANA project currently where I am able to do some development. We always need to find ways to demonstrate value…to fill a niche.

    All the best.

    @glenn_a_allen

    https://www.linkedin.com/in/glennallen

    (2) 
  7. Sergio Fraga

    Hello Marco,

    Just found your blog and would like to thank you for your time and effort.

    I agree with everything that is said here. This Saturday I have attended to my first ABAP Code Retreat and I would suggest to anyone who wants to move forward. The content is about TDD and you use Eclipse but the best thing is to find people working in ABAP that want to continuously evolve. I definitely recommend that you attend an ACR next to you.

    And just for constatation, my trigger to learn more was after reading Paul Hardy book. It was a real motivation for me. After that one, I went to HFDP and then you get addicted to learn….and feel that the more you learn…the more you need to learn!

    Thanks

    Sérgio Fraga

    (0) 

Leave a Reply