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

Excluding operators in Search GUIBB

This tutorial explains how to restrict the operator in the search GUIBB.  Below is some the search operator that the Search feeder class provides by default for the component. Now say you want only some of the operators should be allowed and other should be restricted.

clip_image002

 

This can be done at two levels.

1.      Configuration level

2.      Coding level

Note: I am working on lower version (EHP5) and the screens may appear different.

Configuration level: While configuring the Search GUIBB with the feeder class we can restrict the operators that are to be displayed for the operators.

Choose the operators which you want to restrict and click on the button exclude operators.

clip_image004

Choose the operators which you do not need and add it to the excluded operators list.

clip_image005

 

Note: The operators that are excluded can be overwritten in the admin level unless the excluded operators are marked as final.

Output:

clip_image007

 

Coding level:

The operators which are excluded in the customizing part are static. If you wanted to modify the operators dynamically then it has to be done at the coding level.

The definition method of the search feeder class contains a exporting parameter called ET_FIELD_DESCRIPTION_ATTR. This is a deep structure which contains components (internal table) Include and Exclude parameters. By filling the value in the tables we can include or exclude operators which we want.

 

Modify the code in the GET_DEFINITION method of the feeder class as below.

  data : wa_fields     type dfies,    " Work area dicitonary field attributes
         it_fields    
type ddfields, " Internal table Dicitonary field attributes
         ls_field_desc
like line of et_field_description_result" Work area result column description

* Creating the field catalog

  eo_field_catalog_attr ?= cl_abap_structdescr
=>describe_by_data( ms_sflight ).

* Assigning the result catalog

  eo_field_catalog_result ?= cl_abap_tabledescr
=>describe_by_data( mt_sflight ).

* Assigning field description

  it_fields
= eo_field_catalog_attr->get_ddic_field_list( ).

 
loop at it_fields into wa_fields.

    ls_field_desc
-name = wa_fields-fieldname.
    ls_field_desc
-text = wa_fields-fieldtext.

   
append ls_field_desc to et_field_description_result.
   
clear ls_field_desc.

 
endloop.


* Excluding the operators

 
FIELD-SYMBOLS : <fs_desc_attr>        type FPMGB_S_SEARCHFIELD_DESCR,
                  <fs_exclude_operator>
type FPMGB_S_SEARCH_OPERATOR.


data : lt_exclude_operator type FPMGB_t_SEARCH_OPERATOR.

append INITIAL LINE TO lt_exclude_operator ASSIGNING <fs_exclude_operator>.

<fs_exclude_operator>-operator_id = '04'.   " start with
append INITIAL LINE TO lt_exclude_operator ASSIGNING <fs_exclude_operator>.


<fs_exclude_operator>
-operator_id = '05'.   " contains
append INITIAL LINE TO lt_exclude_operator ASSIGNING <fs_exclude_operator>.

<fs_exclude_operator>-operator_id = '03'.   " Is empty
append INITIAL LINE TO lt_exclude_operator ASSIGNING <fs_exclude_operator>.


<fs_exclude_operator>

-operator_id = '23'.   " Is not empty
append INITIAL LINE TO et_field_description_Attr ASSIGNING <fs_desc_attr>.

  <fs_desc_attr>-name              = 'CARRID'.
  <fs_desc_attr>
-exclude_operators = lt_exclude_operator.

  UNASSIGN <fs_desc_attr>

.

 

Code Explanation: The GET_DEFINITION method exports a parameter call ET_FIELD_DESCRIPTION_ATTR which contains component like name of the field, text, include and exclude parameters, OVS Search helps and so on.

For the field for which we wanted to restrict the operated, all we have to do is to fill the exclude parameters to omit the fields that are not to be used. The Search GUIBB component will take this information from the feeder class and restrict the operators.

In this example I have restricted the CARRID attribute to only display ‘Is’ and ‘Is not’ all the other operators has been removed.

Output:

image

About Arun

1 Comments:

  1. This document is not related to : 13.8 OVS Search help in search GUIBB,
    Can you post correct one please..

    ReplyDelete

Powered by Blogger.