Saturday, June 7, 2008

Set Theory and Programming (ABAP)


Marilyn Pratt tagged me due to 8 things we don't know about her :). As usual I was embarrassingly late and could not comply. She has got some really interesting real life stories to share. As they say, truth can be stranger than fiction. Of course I am not comparing with Bollywood movies but this one from Zoli can be really close.
I will probably won't be able to write a complete post about myself but for the respect...of elders :) ..

Back in 2005, I was an active member of SDN and then applied to be an expert blogger. Marilyn approved my Blog application :) . Somehow I could not contribute as much as I should have but then that's another story [ there is none really ]. However, I did get something else along with my rights to blog at SDN. My cool black and white photograph...cropped nicely...

Actually, that 'cropped nicely' part was done by SDN however B&W part was by accident. I tried editing my snap in MS photoshop and by default it was saved as B&W.
[ I now know about the issue with Photoshop ].

I developed my personal website, sometime in 2004 and somehow I do like this black and white color scheme . Believe it or not, I've not updated my personal website for ages. Though my subscribers list for the website is a lot bigger compared to my Blog. Just in case you are feeling jealous, it's still very modest and under control. I will blame Dunbar and his number for that :).Dunbar's number is the supposed cognitive limit to the number of individuals with whom any one person can maintain stable social relationships.

Before you set high expectations with this post, 'Set Theory and ABAP', let me clarify that I have not done my engineering in computer/software field. I am actually a Mechanical Engineer by qualification. So I still manage to try a few things on my own before googling and realizing that it was invented million years back.
Have you ever felt that some of the mathematical operations, if available in ABAP, can be really useful at times. To start with..what about Set Theory. Will an specific implementation for some of the Set theory operators might just be useful in ABAP Programming?

For Example : Given that internal table ITAB1 has the same structure as ITAB2, if we can use the Set operators like UNION, INTERSECTION etc.

It can be implemented as a Class/methods or Functions or even as ABAP Statements. I can understand that complex use of these statements will result in degradation of performance but it can be useful for specific scenarios.

By complex use I mean something like : ITAB4 = (ITAB1 ∩ ITAB2) - ITAB3

As an example : Let's say you have 3 Internal tables already available through
Function read etc. in your ABAP program.
  • ITAB1 [ Employees who performed well consistently for the past 3 years ]
  • ITAB2 [ Employees who has been promoted during past 3 years ]
If we have set operators then we can write just a few lines of code to get :

  • Employees who performed and promoted = (ITAB1 ∩ ITAB2)

  • Employees who performed but did not get promoted = ITAB1 - (ITAB1 ∩ ITAB2)

  • Employees who didn't perform but got promoted = ITAB2 - (ITAB1 ∩ ITAB2)

You may find some interesting and related articles on web:
P.S. - I wrote a quick program to compare the object list between two huge transport requests. The idea was to find the objects which are not shared by both. In terms of Set terminology it can be called a DisjointUnion - all elements in either set A or set B, but not in both.
As people normally search for these kind of utilities to reach my post. Use standard FMs / APIs to write your own code. See Function Module TRINT_READ_REQUEST.

P.P.S. - Blogger's editor has a problem. It does not accept the URL links with special characters - http://en.wikipedia.org/wiki/Dunbar's_number, as it is. And saves it as http://en.wikipedia.org/wiki/Dunbar.
Updated : However, you can write in HTML as Dunbar%27s+number and that works.

No comments:

Post a Comment

Info : Comments are reviewed before they are published. SPAMs are rejected.

Copyright