Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Scenario : We have multiple transaction types  in use under quotations and reps who are using CRM wants to see one transaction type search data by default.

Multiple ways of doing it...one way!

Step 1 : UI Component and View  -> BT115QS_SLSQ

Step 2 : BSP_WD_CMPWB - UI Component Workbench

Step 3 : Click on Enhance Component

Step 4 : Assign Enhancement Set -> Choose from drop down

Step 5 :  Name Application (Ex Z of Component)

Step 6 : Click  on Yes, when system confirms with pop up of (The BSP application does not exist. Do you want to create it?)

Step 7 : Click on Continue, when system confirms with pop up of Input of Runtime Repository Storage Location -> Page = Repository.xml

Step 8: System confirms with pop up of Workbench Request to add in TR

Step 9 : We assigned to Ehn Set and  Enhanced Component.

Step 10 : Transaction Code SM 34

-> Enter View Cluster : BSPWDVC_CMP_EXT

-> Display

-> Select Enhancement Set

-> Enhancement Definition - > Select Component Name -> Details

Note : No entries under Controller Substitutes

Step 11 : Go back to transaction code BSP_WD_CMPWB

->Enter component BT115QS_SLSQ - Display

->Views

->Select  view - BT115QS_SLSQ/SlsQuotSQ

->Right Click-> Enhance

->Class is not Z

Step 12 : System confirms with pop up of Workbench Request to add in TR

Step 13 : Assign Package or put it in Local Object if you don’t consider to move transport.

Step 14 : View color changes to Black and Class is in Z now..

Note: Repeat Step 10, you will find one entry under Controller Substitutes

Step 15 : Double click on Implementation Class ZL_BT115QS__SLSQUOTSQ_IMPL

->Uncheck Filter if it is Checked

Step 16 :

->Click on Edit

->Search Method  DO_PREPARE_OUTPUT

->Select and Click on Redefine

Step 17 : Next screen looks like this .

Step 18 : Copy Paste below code and change your Transaction Type

METHOD do_prepare_output.

* demo coding for prefilling a search attribute in the search UI

* the prefilling happens on the first time,

* the user can then also change the attribute in the UI later on

  DATA: lr_qs           TYPE REF TO cl_crm_bol_dquery_service,

        lr_search_node  TYPE REF TO cl_bsp_wd_context_node_asp,

        lr_col          TYPE REF TO if_bol_bo_col ,

        lr_iterator     TYPE REF TO if_bol_bo_col_iterator ,

        lr_param        TYPE REF TO if_bol_bo_property_access,

        ls_selection    TYPE genilt_selection_parameter,

        lv_low          TYPE string,

        lv_attr_name    TYPE name_komp ,

        lv_value_set    TYPE abap_bool .

* the attribute that shall be prefilled:

* note they have to be available in the search view configuration

* not necessarily as visible, but as available (in the ddlb)

  lv_attr_name = 'PROCESS_TYPE'. " for the Transaction Type filling

* the value for prefilling.

  lv_low = 'ZSAG' . "(Default only ZSAG on Search.)"

  IF iv_first_time EQ  abap_true.

* to initialize the search view.

    CALL METHOD super->do_prepare_output

      EXPORTING

        iv_first_time = iv_first_time.

* fetch the search node and its content.

    lr_qs = me->get_current_dquery( ).

    lr_col = lr_qs->get_selection_params( ).

* check the currently visible search attributes.

    lr_iterator = lr_col->get_iterator( ).

    lr_param    = lr_iterator->get_first( ).

    WHILE lr_param IS BOUND.

* get the parameters

      lr_param->get_properties( IMPORTING es_attributes = ls_selection ).

      IF ls_selection-attr_name = lv_attr_name .

* SET_PROPERTIES

        ls_selection-low = lv_low .

        CALL METHOD lr_param->set_properties

          EXPORTING

            is_attributes = ls_selection.

        lv_value_set = abap_true .

        EXIT.

      ENDIF.

      lr_param = lr_iterator->get_next( ).

    ENDWHILE.

    IF lv_value_set EQ abap_false .

* it was not part of the visible attributes, then add it at the end.

      CALL METHOD lr_qs->add_selection_param

        EXPORTING

          iv_attr_name = lv_attr_name

          iv_sign      = 'I'

          iv_option    = 'EQ'

          iv_low       = lv_low.

    ENDIF.

* for a proper display of the added / changed attribute.

    lr_search_node = get_dquery_cnode( ).

    lr_search_node->build_parameter_tab( ).

  ELSE.

* non first time call - just delegate to superclass.

    CALL METHOD super->do_prepare_output

      EXPORTING

        iv_first_time = iv_first_time.

  ENDIF.

ENDMETHOD.

Step 19 : Syntax Check, Save and Activate

Step 20 : Click on Back, now your method color is in Black.

If you click on filter,  method DO_PREPARE_OUTPUT also be shown because you added logic.

Test Result : Quotation Type is Set to ZSAG under Search->Quotations

3 Comments
Labels in this area