Skip to Content

Foreword

This blog (series… I believe it will become a series sooner or later) is for people that are curious and have this stupid custom of trying something new, outside of their everyday box. It is for people that accept challenges and feel this warm feeling when they crack the problem after a fair duel.

I once had a colleague (for just very short time), who spent two months working on a program that was quite short and was only calling BAPI_SALESORDER_CREATEFROMDAT2. I don`t say I would do better at that time, but I can imagine the pain of the newcomers. But over the years I learnt something that would help me or him at that time. I learnt two things. Not to be afraid, that`s crucial.

If you`re afraid, you tell your boss something like “It cannot be done” or “It would take a week” or similar nonsense. Some bosses might even go to a customer and pass that nonsense to the customer (it`s often because they`re good bosses when It comes to people, they trust their colleagues etc.). And that damages the business, the customer and you too.

The second thing is to USE the SAP standard. It might sound obvious. It is. But after that gentleman above got fired and started talking, I learnt that he had no idea how to benefit from the fact that the aforementioned BAPI is called all over the place (I think so, don`t make me to go and look in my system… Ok, I checked and in my system and it is called from at least 3 times from SAP standard code + some demos and stuff). He didn`t get the idea of finding a transaction which create s sales orders, going to the BAPI source text, putting in the breakpoint, running the transactions and checking what are the arguments. So he spent a week trying to call the BAPI for the first time.

So that`s the background why I write this blog, why I accept challenges and the story. Howgh!

 

The challenge

Now here is the problem: I want to sell nice and cool SAP standard performance dialog solution. No custom development, just elegant, simple customizing + some BADIs maybe to make the thing even cooler. I must also mention that the problem is not mine. It`s a friends problem. My job is not to do BADI implementations in HR or appraisals. I do ABAP and Java authorizations and security. So that`s quite a challenge for me.

I know how to debug, how BADIs work, I was shown the transaction where one can create an appraisal form and I was show the PHAP_CREATE transaction where one can create an instance of that appraisal. In that PHAP_CREATE transaction there is a button “Additional data” which opens up a popup which lists some more data about the appraisee. The challenges is to put some more data into that popup without having to change a standard SAP code or do custom development (my BADI development will start with Z of course, but it will spoil the customer`s system much less than rebuilding half of the appraisals system, right).

Side-note: if you`re an HR person, a developer or a consultant, this blog must be a bore for you. I know. Then try to replace the HR BADI problem with any other and try it yourself.

 

The cracking process

So what we need to do is to find the name of the BADI first. One can go to SDN and start searching, but there must be dozens of BADIs in HR and appraisal system, so I rather start debugging. I am a developer after all. So I go PHAP_CREATE, put the magic spell “/h” to the OK_CODE box (or how do you guys call it?) and start debugging.

Interesting parts were:

* Call subscreens

  CALL SUBSCREEN sub_container.

* Call subscreens

  CALL SUBSCREEN sub_header.

* header defaulting

MODULE d2000_header_defaulting.

FORM f2000_user_command.

CASE l_ok_code.

WHEN ‘BHEAD’. And so on.

Then I reach CALL METHOD p_2100_instance->get_add_header_data.

P_2100_instance is an instance of a class that looks very much like the BADI I need. The BADI definition name is HRHAP00_ADD_HEADER. I can now go to SE18 and take a look. Hmm, 3 methods.

Let`s implement the class and see what happens. To be able to see what happens I implement all three methods I put BREAK-POINT statement in them. So that`s my ZCL_IM_HR_HRHAP00_ADD_HEAD implementation.

I assume that you know how to implement a BAI, dear reader, but if not, I Googled a nice SDN forum thread that should help: Performance Appraisal : BADIs – Header – Additional data

So we now have the BADI implemented. I go PHAP_CREATE to create an appraisal instance (whatever you call it, HR friends). Oops, “Additional data” button does not trigger my BADI.

 

Cracking the necessary customizing

Ok, there must be something more. PHAP_CREATE does not offer any “customizing” where I could change something, so go back to OOAM (PHAP_CATALOG). I have no idea what to do with the appraisal template definitions, so let`s go check the menu. I learnt that some “advanced” options and customizing are hidden under discrete main menu entries, rather that accessible via the buttons or right mouse clicks. Interesting, there is a section Enhancements under Goto. There is then “Additional Header Data” item further in the menu. And I cannot see my enhancement here. I must find a way how to get it here (There is a “Create” button here too, that could make the whole thing much easier if you create the implementation from here. Just a guess, I am not going to try).

The Google and SDN comes to play again. This thread helps: how to create a enhancement in a enhancement area in MBO module. Let`s go OOHAP_BASIC, Enhancement Area “AY”, new enhancement. The thread says “F4, there is your filter value of your new BAdI implementation”. For whatever reason the search help didn`t work for me, but when I put in the definition and saved, it worked. In the thread there is one more useful information is at the very bottom: “To make enhancement be visible in “Free enhancement” combo-box in appraisal template catalog (OOAM), the view cluster VC_T77HAP_CATEGORY “Category groups” should also be maintained”.

Let`s go SM34, view cluster = VC_T77HAP_CATEGORY. Ah, so I have to assign my Enhancement to an appraisal category group. And assign it to a category too. These two I know, because my appraisal template belongs to one of these. Then comes the enhancement area. I know that from before too = “AY” (see above).

On the way I learnt that I am supposed to put the enhancement to the “Layout” tab of the appraisal template (see first SDN thread above: “I apologize, it is not in the “Processing” tab page but it is in the “LAYOUT” tab page”).

So I go check “Layout”, namely the “Further” section. By default there is nothing, but I can select “Personnel Header Data”. I noticed that my “Additional data” button (in PHAP_CREATE) is not there for some of the appraisal forms, so could it be that I have to select this “Personnel Header Data” (at least) to be able to see that button? And now I also know that if I do everything right, I should get my BADI implementation visible here too. And If I select it, it will get triggered and I get my custom additional data.

For those new to appraisal templates like me it is important to know there are “statuses” of the forms. If the form is “Released” then you see it in PHAP_CREATE, but you cannot make any more changes. If it is “Not Released”, you can make changes, but not visible in PHAP_CREATE. If you need to switch between these two statuses, go right mouse click -> Status -> Release (or Cancel Release).

And now, when we got that far, if I go PHAP_CREATE and select my “demo template” here we go: BREAK-POINT in the debugger is here.

 

Adding custom fields

At first I got frightened that I will have to somehow figure out how to create the BADI implementation from scratch. But it`s not that bad. There is this “Personnel Header Data” default option which has a class behind it. That`s something that I would expect. Unfortunately the documentation of the BADI description does not say anything about it (or I must have missed it). If you go to SE24 and search for PERSONNEL_HEADER_DATA, such class does not exist either. So the best option (maybe the only one, maybe there are others) is to go to PHAP_CATALOG menu -> Enhancements -> Additional Header Data -> click on PERSONNEL_HEADER_DATA and click display. Voila! Here comes the class.

When you compare the number of lines of the code in this class, which is by the way called CL_IM_HRHAP00_ADD_HEADER_1, it will tell you that there is a long way to write that code yourself. That means you will either have to call this functionality somehow or maybe copy that class, register it as described above and use the copy instead. It`s up to you.

It makes no sense to flush code here, if you can do some ABAP, I just gave you all the clues necessary to be able to add custom fields as per your requirement.

Conclusion and appeal

Hope I won`t be accused of posting boring step-by-step tutorials. I know we have wikis etc. But I tried to share a story here including the reasoning, how I managed to step further etc. Some patterns should be reusable in many other situations, outside of HR or authorizations.

If you want to give this blog additional sense, what about accepting a challenge from outside your box and then writing a blog about that? It would feel good to know that I inspired somebody maybe and one more blog that will provide useful knowledge was born. If you do that, if you accept my challenge, please post a link under this blog so I can read it too. It would be a pity to miss it.

To report this post you need to login first.

6 Comments

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

  1. Rudra Sonar

    As usual a classic, amazing and very helpful information from an “Un crowned King” ,,,,, Gold Otto …

    thanks for sharing this information and lots others ……….

    Regards,

    Ravindra Sonar.

    (0) 
    1. Otto Gold Post author

      Hi Ravi, long time no see:)) Hope you`re doing well.

      I need a challenge in my work time to time, so I accept tasks outside of my daily routine. So please beware this does not necessarily have to be right or the best approach. Maybe a HR ABAPer doing it for 10 years would find something better… but from my experience 80% of people doing things are trying their best with tasks they face the first time. SAP is just to huge to be able to sell one skill or experience ten times. For me nearly every task is a new research.

      Take care, Otto

      (0) 
      1. Rudra Sonar

        Hey Otto,

        Yes really really a long time we had words, in last few months I was really busy and out of touch from SDN, but it never stoped reading your posts and blogs though.

        Anyways, I am also learning and getting so many challenging tasks now a days 🙂 And I am so happy for it ….

        Back then I was very new to SAP and with your help I learned a lot ……….. Eventually Got to know SAP is an ocen and one can only say “I know how to Swim!“,,,, and I learned few styles of Swiming 🙂   Now learning and practising few strokes too 🙂   Seeing/Reading from you and people like you out there.

        I like the way you explains it, it always helps if someone explains in a way as if he is sitting beside you and explaining the things…..

        All is well ………. 😛 BTW how’s is Jana? Hope everything is great with you guys ………

        PS: Which email ID is still with you…. KCT/SEZNAM ?

        Keep posting …..

        Regards,

        Ravi

        (0) 
        1. Otto Gold Post author

          That`s the only way I can explain things. Like if the other person is sitting next to me. Plus funny story (I think I mentioned it somewhere else too, but in this flood of content you have not read it probably): I am using my old blogs to recall the skills I used to have, but for whatever reason didn`t practise them for some months. Then you know the basics, but don`t have eye for detail any more or don`t remember the tricks you used to know.

          Then I go to SDN and read my old blog on that topic (typically those on formatted Excels via CALL TRANSFORMATION… I am using it again and again over the years) and then don`t have to undergo the whole reseraching pain and trial and error.

          Jana is fine, became a fan of Start Trek and Battlestar Galactica:)) If you want to mail again use the google mail maintained in the business card here:))

          You must tell me how was life during those months out of reach,

          cheers Otto

          (0) 
    1. Otto Gold Post author

      Hi, thanks for leaving the comment. I am always happy to help and few words give the signal it made sense 🙂 Hope it will spare you lots of time.

      Cheers Otto

      (0) 

Leave a Reply