I have been sitting on this blog for quite a while…I was not sure if this should be shared…my own little secret (haha). However, as I see more and more push back, complaining, negative posts, etc. saying things like “oh I can’t wait till WebDynpro ABAP replaces the Adobe forms in HCM P&F” or “I sure am glad there are 3rd parties that have WDA replacements for the Adobe forms in HCM P&F” or “well, our company is just going to wait till EhP6/HR Renewal 1.0 so we can just make WebDynpro ABAP views for HCM P&F”…I thought “why is it Adobe OR WebDynpro? Why not both?” (and yes, I think my track record/past blogs/dust up I caused does point to the fact that I do understand the licensing side of this issue, but let’s take that out of it). So here goes…
Back in the early days of HCM P&F, you almost felt like a cave man with crude wooden tools and maybe one stone wheel. Times were hard. You had to make due with what you were given (ie. not much).
If you wanted to give the users “help” on possible entries for fields, you had not much more than a drop-down list to offer them. Often times, you had to code your own generic service in order to populate your drop down list because the SAP “automatic” way of doing it left a lot to be desired or did not handle your own “business logic” (for instance, say your field has a check table with 15 valid entries in it. However, on the form, your business rules say that of those 15, only 6 should show on the form…that is where a custom generic service comes in). Furthermore, if you wanted to make your form “interactive” and “web like”, you had to implement “user events” (a misnomer in my opinion) in your configuration….and then, you began to “jump hurdles while juggling and balancing an egg on the end of a spoon held in your mouth” because you usually had to make creative use of “trigger” or “flag” fields and configure “rules” in order to make your “user events” actually behave like what I (and many others) imagine “events” to behave like.
But again….those were “dark” times for us all in HCM P&F. With EhP4, we became a little more evolved. We got SAP_PD which opened up the world of PD/OM processes to us. Likewise, SAP slipped in a new “event”….along with “initialize” and “check”, we now got USER_EVENT_POPUP. You see this most often used with things like WebDynpro ABAP “Search Help” pop-up windows. This was perfectly blogged by Ian Stubbing in HCM Processes & Forms: Web Dynpro ABAP Search Helps. His blog really got me thinking….and thinking….and thinking some more….
I thought, wouldn’t it be nice if I could just pop-up any old WebDynpro ABAP I had written from within a HCM P&F form? Something like…oh I don’t know…This?!?!?
Ahhh yeh! Pretty sweet!
But then I thought, wouldn’t it be cool if on the form I had some input field for the user….
…that the user filled in…
…and then clicked some button that would trigger a pop-up window of my own custom WebDynpro ABAP application that could read that field from the form…
…and then in my custom WebDynpro ABAP application window, I could enter whatever data there….
…click “OK” on the pop-up window and send it back to the form to any field over there ?
Oh yeh…Something like ALL of that? That WOULD be cool!!! haha
It actually was much easier than I thought. Using the lessons learned of reverse engineering the “Search Helps” as I blogged about before (HCM Processes & Forms: The Secrets of Search Helps and OADP….REVEALED! – part 1), I was able to make it all work….in about 15-20 minutes.
The first “key” is understanding the “Call Pop Up” method of your WebDynpro ABAP’s component controller. This is where you will handle reading in whatever fields from the form you like. SAP has provided us with a very nice “importing” structure SPECIAL_DATA as part of the “Call Pop Up” method in the IF_HRASR00_FORM_WINDOW WDA interface.
This SPECIAL_DATA structure has ALL of our form fields and their values. We can then simple read through it, find the fields we need, and set our own context fields in our WDA as we wish. After that, the component controller handles firing the call to pop-up the actual window.
In the first part of this code, you can see how we are looking through the SPECIAL_DATA form fields for one particular field. From this, we can read that value and then set our own context values as we like.
After this, we simply are going to find the “title” for our pop-up window and then call the code to launch the pop-up (this is normal code you will see in the standard SAP search helps for HCM P&F).
The next “key” to this is the method in our actual “view” of our WDA. In our view’s “WDOINIT” method, we already “subscribed” to listen for the event that occurs when the user clicks the “OK” button on our pop-up window (we can listen for “cancel” as well).
Now, when our view “catches” this event in our ONACTIONOK event handler method, this is our chance to set fields to send back to our form.
So…there you have it…mixing a little custom WebDynpro ABAP into HCM P&F’s Adobe Interactive Forms was never easier!
One last note…in our testing, my co-worker, Philip Johnston, did discover a “bug” in our version in which continuous uses of the “pop up” event seemed to make our form fields passed to the ISR interface DOUBLE on EACH use….so it grew exponentially! The problem was found to be in the WDA component QISR_UI in it’s component controller method SET_EXTERNAL_DATA_TO_INPUT_P. After the loop, they left off the simple line:
delete adjacent duplicates from cr_model->external_data comparing fieldindex fieldname.
We added this in an “overwrite” enhancement of the whole method and it works perfectly well now.
I hope as Ian Stubbing did for me on my (fanatical? haha) search into this solution that I too might spurn on others to push this further. Trust me…once I figured this out, it had my mind spinning on how much more was possible….which is where my next blog was born from……HCM Processes & Forms: Good-bye User Events!!!!…..hello windowless WDA events!
As always….till next time..enjoy!!!!