Skip to Content

After reading (and relying on) the many excellent blogs by Chris Solomon and the recent one by Derrick Banks, I thought it only fair to share some knowledge on an area that I find most useful (and previously frustrating) – search helps.

 I came across the WDA search helps while implementing a bespoke version of the E-recruiting Requisition form (form scenario S_HRMSSRCF_REQUISITION).   On this form there are two buttons ‘Select Template’ and ‘Select Position’. These both trigger Web Dynpro ABAP (WDA) search helps and return the data selected to the form. Since then, I have used this to apply WDA type search helps to several other forms with huge success.

HRRCF_C_POSITION 

 

 

 

 

 

 

 

 

 

 

 

 

 

How it works in a nutshell

HRASR00_PROCESS_EXECUTE uses IF_HRASR00_FORM_WINDOW as a component

image

 

 and the search help implements IF_HRASR00_FORM_WINDOW as an interface.

IF_HRASR00_FORM_WINDOW

 

 

The onMouseDown event of the button has code used by the WDDOMODIFYVIEW method of the FORM_EDIT view of WDA component HRASR00_PROCESS_EXECUTE. (I am sure you know this well as the main WDA HCM P&F component).

The WDDOMODIFYVIEW method uses the value used for the HRASR_FORM_WINDOW field and calls the popup window of that component. The data is then displayed according to how the component has been developed (OADP or ALV component usage probably) and selected. The values are then returned to the HRASR00_PROCESS_EXECUTE component via the interface node VALUE_HELP_DATA.

 

How it works in detail

To expand on the above:

1. The onMouseDown event of the button must pass the name of the Web Dynpro ABAP component

In the example, this is HRRCF_C_POSITION. It must also pass the name of the ISR_EVENT as USER_EVENT_POPUP.

$record.CONTROL_PARAM.ISR_EVENT = “USER_EVENT_POPUP”
$record.HRASR_FORM_WINDOW.DATA[*].FIELD.value = “HRRCF_C_POSITION” 

This is because the 2 values are processed by the WDDOMODIFYVIEW method of the FORM_EDIT view of WDA component HRASR00_PROCESS_EXECUTE. (I am sure you know this well as the main WDA HCM P&F component) and the search help popup window is displayed with the special data being passed though the method’s interface.

   DATA      component_name    TYPE string.
 CONSTANTS hrasr_form_window TYPE qisrdfieldname VALUE ‘HRASR_FORM_WINDOW’.
 CONSTANTS user_event_popup  TYPE string         VALUE ‘USER_EVENT_POPUP’.
 CONSTANTS user_event_check  TYPE string         VALUE ‘USER_EVENT_CHECK’.

 DATA node_value_help_data   TYPE REF TO   if_wd_context_node.
 DATA value_help_datas       TYPE TABLE OF qisrsspecial_param.
 DATA value_help_data        TYPE          qisrsspecial_param.

  TRY.
*    Evaluate name of search component
      component_name = wd_comp_controller->isr_interface->get_special_data_with_index(
                          i_fieldindex = 1
                          i_fieldname  = hrasr_form_window ).
    CATCH cx_root.
  ENDTRY.

  IF NOT component_name IS INITIAL.

*   Launch popup and Initialize variable for help component name so
*   that help popup is only launched once.
    wd_comp_controller->isr_interface->set_special_data_with_index(
                         i_fieldindex = 1
                         i_fieldname  = hrasr_form_window
                         i_fieldvalue = space ).
    wd_comp_controller->raise_popup( component_name = component_name ).
    TRY.
      CATCH cx_root.
    ENDTRY.
  ENDIF.  

2. The MAIN window of the search help component will then display the data requested

 In the case of the HRRCF_C_POSITION search help, this is via an OADP component usage. A row is selected via an interface method and the data is returned to the calling WDA via the CLOSE_POPUP event on the component controller by populating the VALUE_HELP_DATA interface node. 

  *   send selected position back to form fields
    value_help_data-fieldname   = ‘POSITION_ID’.
    value_help_data-fieldindex   = 1.
    value_help_data-fieldvalue = wd_this->position_id.
    APPEND value_help_data TO value_help_datas.
    value_help_data-fieldname   = ‘POSITION_TEXT’.
    value_help_data-fieldindex   = 1.
    value_help_data-fieldvalue = wd_this->position_text.
    APPEND value_help_data TO value_help_datas.

*   fill context for fields
    node_value_help_data = wd_context->get_child_node( name = wd_this->wdctx_value_help_data ).
    node_value_help_data->bind_table( value_help_datas ).

3. The second half of the WDDOMODIFYVIEW is then valid:

  IF wd_comp_controller->cmp_form_window IS BOUND.
*   Write data from the search compoinent back to ISR context
    node_value_help_data = wd_context->get_child_node( name = wd_this->wdctx_value_help_data ).

    node_value_help_data->get_static_attributes_table(
      IMPORTING
        table = value_help_datas ).
    node_value_help_data->invalidate( ).
    IF NOT value_help_datas IS INITIAL.
      LOOP AT value_help_datas INTO value_help_data.
        wd_comp_controller->isr_interface->set_special_data_with_index( EXPORTING
                                                  i_fieldindex = value_help_data-fieldindex
                                                  i_fieldname  = value_help_data-fieldname
                                                  i_fieldvalue = value_help_data-fieldvalue ).
      ENDLOOP.

*     Refresh ISR context
      wd_comp_controller->isr_interface->call_isr_process_event( i_eventname = user_event_popup ).
      wd_comp_controller->isr_interface->call_isr_process_event( i_eventname = user_event_check ).
    ELSE.
      wd_comp_controller->isr_interface->call_isr_process_event( i_eventname = user_event_popup ).
    ENDIF.
  ENDIF.

 

Therefore, this is how the search help, the main WDA and the form communicate.

The example shown above shows one of the standard search helps that is probably in your system already, the following table showing all of them. All the HRRCF prefixed ones are for erecruiting.

 

 HRASR_C_ORGUNIT                                   
 Search Help for Org. Unit
 HRASR_C_POSITION
 Search Help for Position
 HRASR_C_QUALIFICATION_BLK
 Search Help for Qualification Block
 HRRCF_C_BRANCH
 Search Help for Branch
 HRRCF_C_POSITION
 Search Help for Position
 HRRCF_C_REQUI_DEFAULT
 Search Help for Branch

 

I have written several bespoke search helps, both using OADP component usage and ALVs and they are now the method of choice if anything more than a dropdown is required. 

To report this post you need to login first.

30 Comments

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

  1. Clinton Jones
    This is a nice tip for those wishing to expand the capability of lookup or hit-list or whatever you want to call it. Last week I spent some time trawling through CSS notes only to discover that there isn’t a definitive position on hit-lists. Whilst users can configure their hitlists up to a point, the reality is that SAP standard config steers you away from being able to retrieve lists in excess of 5,000 items an in some cases recommends you not exceed 500 or 1,500 depending on the application area.  It would be interesting to understand how frequently people actually use these lookups in reality. FOr high speed data processors, they generally know the data that they are looking for already and don’t use lookups I would think.
    (0) 
    1. Ian Stubbings Post author
      Thanks Clinton.

      It was while implementing a bank details form on my first project (EhP2) that I came across the restriction you mention. We couln’t expect the employees to scroll through such a huge hit list, so the F4 help was removed instead.

      My current project is EhP3 (and the next on 1st March, Ehp4) so at least they will be available for the forseeable future.

      (0) 
  2. Christopher Solomon
    Geez, you and Derrick are really putting the pressure on me now eh? haha GREAT blog and great info. I have typically developed “search helps” within the form in a round about manner, but this gives me more options. Your write up is straight forward and seems simple enough. Can’t wait to try it out! Thanks again.
    (0) 
    1. Ian Stubbings Post author
      Thanks Chris. I am currently writing an article on how to develop a bespoke ALV search help with all of the steps and code required. Most is there, just need to get the time to complete it. I move onto my next project on Monday (EhP4 – excellent!). Lot’s of SAP_PD forms and mass processing – maybe I’ll write a blog on these – when I understand it all!
      (0) 
  3. Derrick Banks
    This is a great write up and something that I’ve experienced working with in the past few months. Thanks for shedding more light on the topic and we look forward to more blogs from you!
    (0) 
    1. Ian Stubbings Post author
      Thanks Derrick.

      I thought your blog on the workflow aspect of HCM P&F was superb as detailed in the comments. I will be steering the new team towards it if they do not already know about it.

      Cheers
      Ian

      (0) 
  4. soracha t
    I try to using this solution it’s working very good. But I face the problem with value help search using dropdown list. symptom is when I add this solution into my form. And then I test to run the form click on button to call web dynpro abap value help is working fine when I close this window the value in dropdownlist is lost!!! .Please tell us for the solution.
    (0) 
  5. Oleg Sokolov
    Very nice blog. Thanks!
    Can somebody tell me if its possible to submit some custom event round trip to back end SAP_PA and Generci Services after selection is made in the Search Help and “OK” selected
    (0) 
    1. Ian Stubbings Post author
      Thanks Oleg.

      It depends on what EhP and SP you are on!  If you are on EhP3 or EhP4 SP<20/21 you will be fine in triggering the user event as we were doing just that by having the trigger in the click event of the button. Since upgrading to SP21 this doesn’t work anymore. I currently have an OSS request in for this. I’ll update the blog when I get an answer.

      Cheers
      Ian

      (0) 
      1. Oleg Sokolov
        Thanks Ian.
        We are Ehp4 22. Can you give me little more details. Right now on click there is javascript ContainerFoundation_JS.SendMessageToContainer(event.target, “submit”, “”, “”, “”, “”);. How you specify custom event? or you mean it was triggering round trip before automaticaly after “ok” selected but stop working with SP > 20

        Thanks,
        Oleg

        (0) 
            1. Oleg Sokolov
              Ian,

              One more question. Before when you were able to submit. What kind of event was it? Standard Initialize or Check. What if we want to send user event that we configured? Is there a way to do it?

              (0) 
              1. Ian Stubbings Post author
                Hi Oleg

                We sort of found a solution in SAP note 1035630. If you use the scripting at the bottom of the note, it may help out (it worked on one form for us but not the second – odd!)

                Cheers
                Ian

                (0) 
                  1. Ian Stubbings Post author
                    Apologies, Oleg.

                    I rechecked with my colleague and it does not work for the WDA search help after all. It was a standard search help he was also testing with that now works.

                    If we find a solution to the WDA roundtrip, I will post it but be more thorough in my testing next time…

                    (0) 
  6. vivek anand
    Hi Ian,

    I have tried the similar scenario of calling the ORG UNIT help on the Adobe Form. I have put these two lines behind the mouse down event
    “$record.CONTROL_PARAM.ISR_EVENT = “USER_EVENT_POPUP”
    $record.HRASR_FORM_WINDOW.DATA[*].FIELD.value = “HRASR_C_ORGUNIT”

    I am getting the Org Unit pop up and search result but when I click OK I don’t get the selected value on my Adobe form Org Unit field.
    Am I missing some thing?

    (0) 
    1. Ian Stubbings Post author
      Hi Vivek

      Have you named the field in your config the same as the one transferred from the WDA?

      Check the CLOSE_POPUP event on the component controller and make sure your fieldnames match.

      Cheers
      Ian

      (0) 
  7. Joachim Van Praet

    Hi Ian,

    I’m trying to implement a custom HCM Form. In my form process I have 2 different scenario steps. In the first step the field instructions is hidden.In the second step the field instructions is editable. 

    This is working just until I use a WDA value help for a field. After the submit event all data in the UI_Attributes is cleared and All fields are visible.

    What is going wrong?

    kr,
    Joachim

    (0) 
    1. Ian Stubbings Post author

      Hi Joachim

      Apologies but I’ve only just seen this. I don’t seem to get notifications, so I’ll have to recify that.

      I assume you solved your issue?

      Ian

      (0) 
  8. Emanuel Champagne

    Do you ever tried to call this kind of webdynpro pop-up a second time after a first selection?

    For us, the second time, the pop-up appears BEHIND the form, any idea?

    (0) 
    1. Ian Stubbings Post author

      Hi Emanuel

      As above, I have just seen this.  Again ,did you solve your issue?  I recall (it’s over 2 years since I worked with HCM P&F) that the popup could be called multiple times but I’ve never heard of it being rendered behind the form. 

      Ian

      (0) 
  9. Bob Varghese

    Hi Ian,

    A wonderful blog!!.

    It almost solved all my doubts but still i have one doubt in you’re above example (which is related to Recruitment Requisition Request) after selecting position i need to click on next to bring salary band, task & requirement. So could you tell where the next button code is exactly written.As i searched couldn’t find out the location but couldnt get it.

    Thanks in Advance,

    Bob.

    (0) 
    1. Christopher Solomon

      You don’t click a “next” button. You would either (1) create your own button on the form with your own “user event” behind/for it. (2) similar to #1, on the selection of the position (drop down or input field) bind a user event to that “action” and do the same.

      (0) 
      1. Bob Varghese

        Christopher,

        There is already a standard FPM ‘next’ button in Recruitment Requisition Request form which actually brings certain values onto the form based on position.So is it possible to execute the next button event after selecting the position.Below is the screenshot.

        Screen.png

        (0) 
  10. Ian Stubbings Post author

    Glad you liked the blog, Bob, and many thanks for stepping in and helping Bob out, Chris.

    It’s been such a long time I’m not sure I would have remembered the solution!

    Cheers

    Ian

    (0) 

Leave a Reply