cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced search - changing selection values programically

Former Member
0 Kudos

Hello experts, I'm new to crm development and I have problem which has to do with advanced search. I need to know if there is some way how to get selection parameters with their values and be able these parameters change - dynamic queries.  Class CL_CRM_BOL_DQUERY_SERVICE in which I can see entities of parameters from ui doesn't implement interface which can be use to read them or change them - correct me if I were wrong so if there is any other way how to resolve it pleas let me know. Thanks for help guys

View Entire Topic
0 Kudos

Hi Jorgen,

Here is the code to dynamically change the selection parameters.

  DATA: lr_qs        TYPE REF TO cl_crm_bol_dquery_service,

        lr_qs_col    TYPE REF TO if_bol_bo_col,

        lr_iterator  TYPE REF TO if_bol_bo_col_iterator,

        lr_param_ent TYPE REF TO if_bol_bo_property_access.

    lr_qs ?= me->typed_context->search->collection_wrapper->get_current( ).

    lr_qs_col ?= lr_qs->get_selection_params( ).

    lr_iterator = lr_qs_col->get_iterator( ).

*   Find the field to be changed

    lr_param_ent = lr_iterator->find_by_property( iv_attr_name = 'ATTR_NAME'

                                                  iv_value     = 'field_name' ).  "" Put the field name in quotes

    IF lr_param_ent IS BOUND.

*   Set the attribute value.

      lr_param_ent->set_property( EXPORTING iv_attr_name = 'SIGN'

                                            iv_value     = 'I'   ).

      lr_param_ent->set_property( EXPORTING iv_attr_name = 'OPTION'

                                            iv_value     = 'EQ'   ).

      lr_param_ent->set_property( EXPORTING iv_attr_name = 'LOW'

                                            iv_value     = 'field_value'   ). "" Field value to be set

      me->typed_context->search->build_parameter_tab( ).

    ENDIF.

Jagdish