Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Populating Sales organization & Distribution channel details

Hi,

we have a requirement to populate sales orgnization & distribution channel detials in Product search page(PRD01QR/ SearchHelp).

scenario: Role : IC Agent, While placing a customer order (BT115H_SLSO/SOHOverView ), in a items assigment block(BT115IT_SLSO/Items) there is a product field, with f4 help, when we click f4, there are a page for product search. on this page I need to retrive sales organization, and distribution channel detials with respect to customer.

I am new to WebUI, if it is not clear. Kindly reply with some questions.

Thanks,

Devender

Edited by: devender on Jun 1, 2011 10:02 AM

Tags:
Former Member
Former Member replied

Redefine the outbound plug OP_SEARCH_ORDERED_PROD of the BT115IT_SLSO/Items and all the following code (most of the code are from the original, those I added are marked).

This will pass the Sales Org and Distribution Channel to the search help window.

METHOD op_search_ordered_prod.

  CONSTANTS lc_query_name  TYPE crmt_ext_obj_name VALUE 'ProdAdvSearchRgProducts'.

  DATA: lv_event_string TYPE string,
        lv_title        TYPE string,
        lv_value        TYPE string.

  DATA: lr_cw            TYPE REF TO cl_bsp_wd_collection_wrapper,
        lr_it            TYPE REF TO if_bol_bo_col_iterator,
        lr_col           TYPE REF TO if_bol_bo_col,
        lr_current       TYPE REF TO if_bol_bo_property_access,
        lr_qs            TYPE REF TO cl_crm_bol_dquery_service.
***
 DATA: lr_org_ent TYPE REF TO if_bol_bo_property_access.  "<--INSERT
 DATA: lv_sales_org TYPE STRING,  "<-- INSERT
             lv_dis_channel TYPE STRING.  "<-- INSERT


  cl_chtmlb_config_utility=>outbound_plug_event_info( EXPORTING iv_event_string = lv_event_string
                                                      IMPORTING ev_index        = gv_index ).

* call advanced product search popup
  IF prodsearch_popup IS NOT BOUND.
    lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/PRODUCT_SEARCH' ).

    prodsearch_popup = comp_controller->window_manager->create_popup(
    iv_interface_view_name = 'SearchHelpWindow'            
    iv_usage_name = 'CUProdSearchPopup'                   
    iv_title = lv_title ).
  ENDIF.

  prodsearch_popup->set_on_close_event( iv_view = me iv_event_name = 'SELECT_ORDERED_PROD' ).
  prodsearch_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).

* make sure the existing entry for ordered_prod is passed to the valuehelp if it contains
* an asterix.
  lr_cw      = get_collection_wrapper( gc_context_node_admini ).
  lr_it      = lr_cw->get_iterator( ).
  lr_current = lr_it->get_by_index( iv_index = gv_index ).

  CHECK lr_current IS BOUND.
  lv_value = lr_current->get_property_as_string( iv_attr_name = 'ORDERED_PROD' ).

  IF NOT lv_value CS '*'.
    CLEAR lv_value.
  ENDIF.


*<-- INSERT
  lr_org_ent ?= lr_current->get_related_entity( 'BTItemOrgmanSet' ).  "Get ORGMAN BO
  lv_sales_org = lr_org_ent->get_property_as_string( iv_attr_name = 'SALES_ORG' ). "Get Sales Org
  lv_dis_channel =  lr_org_ent->get_property_as_string( iv_attr_name = 'DIS_CHANNEL' ). "Get Dist Channel
*--> INSERT


  CALL METHOD cl_crm_bol_dquery_service=>get_instance
    EXPORTING
      iv_query_name = lc_query_name
    RECEIVING
      rv_result     = lr_qs.

* fill selection conditons for product again
  CALL METHOD lr_qs->add_selection_param
    EXPORTING
      iv_attr_name = 'PRODUCT_ID'
      iv_sign      = 'I'
      iv_option    = 'EQ'
      iv_low       = lv_value.



*<-- INSERT (Passing Sales Org and Distribution Channel to the search BO)
  CALL METHOD lr_qs->add_selection_param
    EXPORTING
      iv_attr_name = 'SALES_ORG'
      iv_sign      = 'I'
      iv_option    = 'EQ'
      iv_low       = lv_sales_org.

  CALL METHOD lr_qs->add_selection_param
    EXPORTING
      iv_attr_name = 'DISTR_CHAN'
      iv_sign      = 'I'
      iv_option    = 'EQ'
      iv_low       = lv_sales_org.

*--> INSERT



  CREATE OBJECT lr_col
    TYPE
      cl_crm_bol_bo_col.
  lr_col->add( lr_qs ).

  IF can_have_iobject( ) = abap_true.
    prodsearch_popup->open( iv_inbound_plug = 'SEARCHPRODANDOBJECTS'
                            iv_collection = lr_col             ).
  ELSE.
    prodsearch_popup->open( iv_inbound_plug = 'SEARCHPRODUCTS'
                            iv_collection = lr_col             ).
  ENDIF.

ENDMETHOD.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question