Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Webdynpro ABAP

OVS Search Help in Search GUIBB



This tutorial explains how to set OVS as a search help option for the fields that are created through GUIBB’s (Feeder class). 

With the normal input field which we are creating at the UI level we set the search help option of the particular field as ‘OVS’ by setting the search help mode property of the context attribute that we are binding to the input field.

In case of Generic UIBB’s neither the UI element nor the context node is being created at design level to be modified.  The UI elements and corresponding context are created through the configuration provided in the feeder class. Hence it takes a quite little effort more than usual to set the OVS Search help to those fields.

In this tutorial I have taken a field from Search GUIBB created in earlier tutorial and set OVS Search help for the field carrid.

For information on OVS search help visit the link.

Pre-requisites: A Search GUIBB component designed already.

For an OVS Search help to be implemented a class needs to be constructed which implements the interface IF_FPM_GUIBB_OVS. This Interface contains all the four phases of OVS and is called at pre-defined runtime. All we need to do is fill out the logic that are carried out in each phases in the corresponding method.



Write the coding’s in the method as follow:

Note: Nothing is new is being done here. All the codes that are executed in the OVS Search help within the case statement are split into different methods. Compare with the code in OVS Search Help.

Construct a class and implement the interface IF_FPM_GUIBB_OVS.


Write the methods in the coding as below.


Method: HANLDE_PHASE_0.

 types begin of lty_stru_input,
            carrid 
type sflight-carrid,
          
end of lty_stru_input.

  
types:  begin of lty_stru_list,
            carrid 
type sflight-carrid,
            connid 
type sflight-connid,
          
end of lty_stru_list.

  
datals_search_input  type lty_stru_input,
        lt_select_list   
type standard table of lty_stru_list,
        ls_text          
type wdr_name_value,
        lt_label_texts   
type wdr_name_value_list,
        lt_column_texts  
type wdr_name_value_list,
        lv_window_title  
type string,
        lv_group_header  
type string,
        lv_table_header  
type string.

  
field-symbols type lty_stru_input,
                     
type lty_stru_list.

  ls_text
-name `CARRID`.
  ls_text
-value `Airline ID`.
  
insert ls_text into table lt_label_texts.

  ls_text
-name `CARRID`.
  ls_text
-value `Airline ID`.
  
insert ls_text into table lt_column_texts.

  ls_text
-name `CONNID`.
  ls_text
-value `Connection Number`.
  
insert ls_text into table lt_column_texts.

  lv_window_title 
'OVS Search Help'.
  lv_group_header 
'Flight Information'.
  lv_table_header 
'Flight details'.

  IO_OVS_CALLBACK
->set_configuration(
  label_texts  
lt_label_texts
  column_texts 
lt_column_texts
  group_header 
lv_group_header
  window_title 
lv_window_title
  table_header 
lv_table_header
  col_count    
2
  row_count    
20 ).

Method: HANDLE_PHASE_1

  
types begin of lty_stru_input,
            carrid 
type s_carr_id,
          
end of lty_stru_input.


  
datals_search_input  type lty_stru_input.

  io_ovs_callback
->context_element->get_attribute(
    
exporting
      name  
=  io_ovs_callback->context_attribute   " NAME
    
importing
      
value =  ls_search_input-carrid   " DATA
  
).


  io_ovs_callback
->set_input_structureexporting  input ls_search_input ).


Method: HANDLE_PHASE_2

 types begin of lty_stru_input,
            carrid 
type sflight-carrid,
          
end of lty_stru_input.

  
types:  begin of lty_stru_list,
            carrid 
type sflight-carrid,
            connid 
type sflight-connid,
          
end of lty_stru_list.

  
datalt_select_list   type standard table of lty_stru_list.

  
field-symbols type lty_stru_input.


  
assign io_ovs_callback->query_parameters->to .

  
select carrid connid from sflight into CORRESPONDING FIELDS OF table lt_select_list where carrid -carrid.


  io_ovs_callback
->set_output_tableoutput lt_select_list ).


Method: HANDLE_PHASE_3



  types:  begin of lty_stru_list,
            carrid 
type sflight-carrid,
            connid 
type sflight-connid,
          
end of lty_stru_list.

  
field-symbols<ls_selection>    type lty_stru_list.

  
assign io_ovs_callback->selection->to <ls_selection>.
  
if <ls_selection> is assigned.

    io_ovs_callback
->context_element->set_attribute(
    name  
IV_WD_CONTEXT_ATTR_NAME
    
value <ls_selection>-carrid ).

  
endif.

That’s it! The implementation of the class for OVS search help is done. Now we need to assign this search help class as OVS to the field attribute.
Go to the GET_DEFINITION method of the feeder class and fill the exporting parameter ET_FIELD_DESCRIPTION_ATTR with the component OVS_NAME for the corresponding attribute.


append INITIAL LINE TO et_field_description_Attr ASSIGNING .
  
-name              'CARRID'.
  
-ovs_name          'ZCL_CSK_CARRID_OVS'.



Test the application:



About Arun

0 Comments:

Post a Comment

Powered by Blogger.