和SAP Sales Organization相关的一些有用函数

Created by Jerry Wang, last modified on Jun 11, 2015

根据sales org id取得对应的description

CALL FUNCTION 'COM_OM_ORGOBJECT_TEXTS_GET'
        EXPORTING
          OTYPE     = LV_SALES_ORG(2) - O 
          OBJID     = LV_SALES_ORG+2(12) - 50000732
          SELDATE   = SY-DATUM
        IMPORTING
          SHORT     = LV_SALES_ORG_SHORT - CCNEXT

取得order item level的sales org id和distribution channel:

 call function 'CRM_ORGMAN_READ_OW'
      exporting
        iv_ref_guid   = iv_guid
        iv_ref_kind   = gc_object_ref_kind-orderadm_i
      importing
        es_orgman_wrk = ls_orgman_wrk
      exceptions
        others        = 1.
    lv_sales_org  = ls_orgman_wrk-sales_org. - O 50000732
    lv_distr_chan = ls_orgman_wrk-dis_channel. - 01

取得product sales area信息:

call function 'CRM_PRODUCT_SALES_READ_API'
      exporting
        i_product_guid        = iv_product_guid
        i_sales_org           = lv_sales_org - O 50000732
        i_distr_chan          = lv_distr_chan - 01
      importing
        es_product_sales_data = cs_product_sales_data

检查product的sales org信息:

"check, if sales data for products is available:
*-----------------------------------------------------------------------------
    ls_rel-product_guid = is_product-product_guid.
    ls_rel-sales_org = ls_distr_chain-sales_org.
    ls_rel-distr_chan = ls_distr_chain-dis_channel.
    CALL FUNCTION 'CRM_CRMM_PR_SALESA_GET'
      EXPORTING
        iv_product_guid    = is_product-product_guid
        is_rel             = ls_rel
        iv_current         = i_current
        iv_timestamp       = i_timestamp
*       IV_UPDATE_BUFFER   = 'X'
*       IV_READ_DB_VALUES  = ' '
      IMPORTING
        es_set_maintain    = ls_set_maintain_a
*       ES_SET_MAINTAIN_DB =
      EXCEPTIONS
        not_found          = 1
        OTHERS             = 2.

读取item 状态

  CALL FUNCTION 'CRM_STATUS_READ_OW'
          EXPORTING
            it_guid              = lt_item_guids
            iv_only_active       = true
            iv_only_systemstatus = true
            iv_lean_read         = true
          IMPORTING
            et_status_wrk        = lt_status_wrk

根据输入信息determine出pricing procedure

CALL FUNCTION 'CRM_PRIDOC_COM_PRCPROC_DET_SEL'
    EXPORTING
      iv_sales_org                = ls_orgman-sales_org
      iv_dis_channel              = ls_orgman-dis_channel
      iv_division                 = ls_orgman-division
      iv_cust_pric_proc           = ls_pricing_wrk-cust_pric_proc
      iv_doc_pric_proc            = sv_doc_pric_proc
    IMPORTING
      es_prcproc_det              = ls_prcproc_det

Get team colleagues list

CALL FUNCTION 'CRM_ORGMAN_EMPL_ENVOIREM_GET'
  EXPORTING
     iv_keydate = sy-datum 
     iv_realo = lv_realo
  TABLES
     employes_of_orgunit = lt_emps[].

get corresponding handler function module name by object name

CALL FUNCTION 'CRM_OBJECT_NAMES_DETERMINE'
EXPORTING
iv_object_name = iv_object_name
IMPORTING
ev_func_name_create_ow = lv_func_name_create_ow
ev_wrk_structure_name = lv_wrk_structure_name
ev_func_name_merge_mdata_ow = lv_func_name_merge_mdata_ow.

读取order对应的organization unit信息

CALL FUNCTION 'CRM_LINK_GET_OW'
EXPORTING
iv_guid_hi = 
iv_objname_hi = lv_objname_hi - ORDERADM_H
iv_objname_set = iv_object_name - ORGMAN
iv_inherit_from_str = true
IMPORTING
et_link = lt_link_com

CRMC_SALES_HEAD: 维护transaction type对应的pricing document类型:

你可能感兴趣的:(CRM,ABAP)