Technical Design Time

So you are doing the technical design of a project.   OK – so the design and the coding have been done and you are supporting it.  (Me)   But pretend I helped design the “mess” I call dynamic programming.   Don’t get me wrong, I love dynamic programming when used with some common sense.   But anyway…   Back to the story, YOU are doing a technical design for a project.


A screen is needed to display a table.   In the table there can be many records that relate back to one line.   You want to display the table in one line for editing, creating, and displaying.


Line Name of Field Description of Field Value
1 Crazy1 Crazy field 1 Yes
1 Medication1 Medication Needed Tranquilizer
1 Time_Dangerous Time when dangerous While Programming
2 Crazy1 Crazy field 1 No
3 Happy When are happy No computers
3 Medication1 Medication Needed None

Display / Change / Create – After clicked on line 1

Line Crazy1 Medication1 Time_Dangerous
1 Yes Tranquilizer While programming

Display/Change / Create – After clicked on line 2

Line Crazy Field 1
2 No

OK Now lets make it a little harder – the fields for the lines are determined by different criteria.

Line Job Number of years People interaction hours logged with people interaction Color Animal Name of Field
1 Programmer 3 Crazy1
2 Programmer No Crazy1
3 Horse Crazy1
4 Independent wealthy Happy
5 Yes 10 Medication1
6 Red Time_dangerous

So it’s an interesting requirement.    Let’s pretend nothing in standard SAP will work for the requirement.   So what do you do?   What do you put in your technical spec?  How are you really going to program this beast?

Maybe the above isn’t enough information.   So you get more and continue.

Dynamic programming is an option.   Probably a good one.   Use it with an ALV.   Ahhhhh… Now you see where I’m going with the dynamic programming.   But..   What about a Step-loop?   It’s old, true.  And the display will look different – going down the page instead of across.  So which is the better choice?

Aha!  It’s SAP ABAP we are talking about.   So the answer “It depends”.   Yes!  Fist pump.  That is the answer.   I know it.

Questions to ask yourself

So step back – look at the mess and try to think about it.   Now step back again look at it again, and decide which will be the easiest to code.   Step back – yes look again, which is going to have the best performance.   Alright one more time – the last and most import to all of us that support your code – step back look again.   Which is going to be the easiest to support?  What skill levels are on staff?  What do they normally use?   What about the development team who will be developing the code?  What if it isn’t you – can they do what you want?

So many questions and no good answer.

Decision Time:

So one more time – I’ll move forward.

I decide to use dynamic programming and an ALV output.    I’m going to build a custom container to hold the code as I’m adding it via a screen exit.

Code Snipit

Here’s some code:


I know not enough – but search on Dynamic programming.  You’ll find a lot of examples.    This blog isn’t meant to explain how to do it.  Also I know the requirements are not all detailed.  But hey we are developers, we know they aren’t always well defined!   I like trying to read the back of the napkin for my functional requirements, it’s always fun.

So now – answers to my questions.  Of course, my own answers.

Readability – Maintenance

Here’s where it gets fun.   I’m a new program and have to maintain this.   Oh boy.   I wouldn’t know where to start.   I’m an “older” programmer (Yes, I sure am) and I’ve never seen anything like this.  Either way the maintenance cost will go up.


Here it gets a little harder….   If I had used a step loop, I would have been querying and adding data screen by screen.   However, a step loop really didn’t meet the requirement.   As a side note, if they used page up and down a lot – it really wouldn’t have been a good performance save.   Do think about things like that if you are doing web programming, RF programming, etc.  Screen by screen or all at once?  And it would have depended on if I pulled all thedata up front before moving from screen to screen.


Not always the best way to go.   It depends on your background.  For me, no this wasn’t the easiest.

Should Dynamic programming been a technical requirement?

Do it sounds like step loop should have won, and dynamic programming should not have been used.   Well I would say the answers are interesting.  The one that would concern me would be the performance.

So did dynamic programming make sense?  YES!   Look at some different blogs.   I get to ride my soapbox a bit.  It’s always fun.   It should have been used for many different reasons.  It is more flexible.   Once you learn it, it will be easy to maintain.  For what I’m using it for, it meets the requirement much better.   Performance is better.   But one of the best reasons – it’s fun!   No not really, the best reason.   The best reason is it’s going to expand the technical skills of anyone who has to maintain it.   Will it take longer for them to do?  Of course.  Will they complain?  Maybe.   But they will move forward a bit.

And yes, this is still a bit behind the times.  No web, no HANA… What can I say?  We aren’t there yet.

So what do YOU think Dynamic or some other form of programming?  Would you have done something different?   Maybe even a newer technique I didn’t think of.    Feel free to get on your soapbox.  I’d love to hear what you think.

To report this post you need to login first.


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

  1. Sharath Yaralkattimath

    I love to do dynamic programming especially with RTTS, field symbols,

    I had a requirement where program needs to be same in all landscapes, but the condition tables which needs to be fetched are different, so I used dynamic select, dynamic read statements where key also differs. There as no other option as well.

  2. Stephen Johannes

    I wrote once a generic extractor in CRM that allowed me to configure the fields to extract and the layout.  It saved me from writing about 20 different extract programs instead.

    One thing I did in that program(class technically) which was even new for me was to include my own BADI’s to replace case statements for field output(translate codes to display text values).  The idea is that I could have default routine that outputs the code, but then I could define as needed implementations for each field how to handle translation of the code to the value descriptions.  It’s nice since if I need to add handling for a new field I can just implement that piece, not change the main program and keep in dynamic.  I think utilizing BADI’s in your own code is a great way to make a program more dynamic.

    I definitely wish I would have more time to solve things more generic because I really do see the benefits when done.  However nothing like a quick and dirty program when you are under project deadlines 😉 .

    Take care,


    1. Jelena Perfiljeva

      Yes, deadlines are a constant challenge. Many times I set off on writing a perfectly designed dynamic program but then end up scrambling to just get it to work because everyone is yelling and screaming that it’s needed in Production “yesterday”. Actually I frequently face the same challenge in writing – “I didn’t have time to write a short email, so I wrote a long one”. 🙂

      I really like the idea of BADI in own code, maybe one day I’ll get to that point. As soon as I’m done with what’s needed the day before yesterday. 🙂

  3. Bruno Lucattelli

    Dynamic programming is something that exists in many programming languages. And all of them probably faces similar challenges when it comes to creating and maintaining the code base. If you look at WordPress for instance, you’ll find a lot of dynamic programming happening there.

    Some C programming courses will teach you how to use generics in C. But they will also recommend you avoid using it unless it’s absolutely necessary. They say that the compiler should be able to make a static analysis on your code and point out possible erros and security bugs. When you are using generics though, the compiler lets you go by yourself.

    Personally, I had some great experiences with it, especially in the situations where I am writing a “kernel” for the application that other developers will use it as they write their own extensions. For instance, my ZARC project uses the Abstract Factory + Factory Method patterns to enable external “plug-ins”.

    In this scenario, it is nice to write a piece of documentation that enables new developers to take advantage of the existing code base and expanding its capacities by writing peripheral code.

    Lastly, I try to make my code follow the golden rule that states that code tells you how, comments tells you why.

    Anyway, those were my 2 cents. Thanks for the blog post, it was very interesting.


Leave a Reply