Wednesday, April 17, 2013

SAP CRM add message Web UI




lr_msg_srv  type ref to cl_bsp_wd_message_service.
 lr_msg_srv = me->view_manager->get_message_service( ).
    lr_msg_srv->add_message( iv_msg_type   = 'I'
                             iv_msg_id     = 'CRM_UIU_SEARCH'
                             iv_msg_number = '001'  ).

SAP CRM Advanced Query




  CALL METHOD cl_crm_advs_qheader_list=>create
    EXPORTING
      is_header_data = ls_qheader
    IMPORTING
      ev_guid        = lv_qid.

  ls_qterm-fieldname ='PROSPECT'."'CURR_PHASE'.
  ls_qterm-sign = 'I'.
  ls_qterm-operator = 'EQ'.
  ls_qterm-low = '1'.

  CALL METHOD cl_crm_advs_qterm_list=>create
    EXPORTING
      iv_header_guid = lv_qid
      is_attributes  = ls_qterm.


  DATA lv_catguid TYPE comt_category_guid.

  SELECT SINGLE category_guid FROM comv_cat_hiernew
         INTO lv_catguid
         WHERE category_id = ls_selected_pr-dkey.
  IF sy-subrc IS INITIAL.
    ls_qterm-fieldname ='PROD_HIERARCHY'.
    ls_qterm-sign = 'I'.
    ls_qterm-operator = 'EQ'.
    ls_qterm-low = lv_catguid.

    CALL METHOD cl_crm_advs_qterm_list=>create
      EXPORTING
        iv_header_guid = lv_qid
        is_attributes  = ls_qterm.

  ENDIF.

  CALL METHOD cl_ppm_dyns_filter_impl=>fire_query
    EXPORTING
      iv_queryid    = lv_qid
    IMPORTING
      ev_bol_entity = lr_opp_col.

SAP CRM Dynamic query






DATA: lr_core TYPE REF TO cl_crm_bol_core,
  lr_query TYPE REF TO cl_crm_bol_dquery_service,
  lr_result TYPE REF TO if_bol_entity_col.
  "lr_entity TYPE REF TO cl_crm_bol_entity.


  lr_core = cl_crm_bol_core=>get_instance( ).
  lr_core->load_component_set( 'BTBP' ).

  lr_query = cl_crm_bol_dquery_service=>get_instance(
  iv_query_name = 'BTQOpp' ).


  CALL METHOD lr_query->add_selection_param
    EXPORTING
      iv_attr_name = 'PROSPECT'
      iv_sign      = 'I'
      iv_option    = 'EQ'
      iv_low       = '0001000426'
*     iv_high      =   iv_high
    .

  lr_opp_col = lr_query->get_query_result( ).