Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
IanStubbings
Active Participant

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.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

How it works in a nutshell

HRASR00_PROCESS_EXECUTE uses IF_HRASR00_FORM_WINDOW as a component

 

 and the search help implements IF_HRASR00_FORM_WINDOW as an interface.

 

 

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. 

30 Comments