|| 您当前的位置:首页 > SAP HR资源网

公用事业ICWC:由于合同迁出,导致通过技术对象确定BP的问题解决

来源:中国护士网  作者:www.512test.com  (查看评论)

在CRM 2007的公用事业的ICWC的标识屏幕中,可以通过BP来搜索到技术主数据.同样,我们也可以通过技术主数据来搜索到对应的BP,他们之间的纽带就是IS-U合同.

 
逻辑关系是:
 
              PREMISE
                     |—- POD1
                     |      |—–IS-U Contract1
                     |                  |————Business partner1                     
                     |—–POD2
                            |—–IS-U Contract2
                                        |————Business partner2
 
    当POD出现迁入,迁出,在历史记录中挂接了2个合同以后.比如用户1把房产过户给用户2,用户1的合同会迁出,用户2会迁入一个合同.
在系统中,就出现了同一个POD关联了2个合同的情形,其中一个是无效的.但是历史记录不能清除.
 
 
     本来认为这个是SAP的一个BUG,无效的合同为什么还会筛选出来呢?但是SAP的回复也是有相当的说服力:
10.01.2009 - 03:22:46 UTC+8 - Reply by SAP    
Dear Customer,
 
When searching Premise by Account, the search will return exactly
one premise and confirms that premise. But then, since there
are two contracts, including one that has ended, related to this
premise, the application cannot automatically confirm the business
partner.
 
This is the expected behavior of our standard solution. We cannot
eliminate the contract which has ended from the query result - in some
case, your customer may be calling about a contract which has ended.
 
I suggest that when you know the business partner number to use the
search of business partner (on the left side) instead. Then in this case the premise will be confirmed automatically once the business partner
is confirmed.
 
I hope that this suggestion can solve your problem.
 
        那怎么办呢,SAP说的有道理,不代表无效的合同就不搜索出来了,但是这样的情景对我们的客户来说是不合适的,因为这个涉及到自动确定BP,毕竟用户1已经迁出了. 那么就自己动手了.其实,思路是非常简单的,把合同的有效期给加进去.过滤掉无效的合同就可以了.
 
SAP实现这个功能的类是CL_IUICMD_CUCOMD_IMPL,方法是SEARCH_ACCOUNT_VIA_PREMISE
 
 
 
  * determine confirmed premise
  call method get_confirmed_entity
    exporting
      iv_entity_name      = gc_crmpremise
    receiving
      rv_confirmed_entity = lr_premise.

  check lr_premise is bound.

* determine confirmed account
  call method get_confirmed_entity
    exporting
      iv_entity_name      = gc_account
    receiving
      rv_confirmed_entity = lr_account.

  if lr_account is bound.
*   use confirmed account for navigation
    create object lr_col
      type
        cl_crm_bol_bo_col.
    lr_col->add( lr_account ).
  else.
    check get_auto_continue_state( ) = abap_true.

    try.
*       determine related PoD’s
        call method lr_premise->get_related_entities
          exporting
            iv_relation_name = ‘PointOfDeliveryRel’         “#EC NOTEXT
          receiving
            rv_result        = lr_col.
      catch cx_crm_genil_model_error.                   “#EC NO_HANDLER
    endtry.

*   determine related contracts
    if lr_col is bound.
      lr_pod ?= lr_col->get_first( ).
      while lr_pod is bound.
        lr_contracts ?= cl_crm_iu_order_agent=>get_items_by_ref_entity( lr_pod ).
*    上面一个方法会把POD相关的所有合同都获取出来
        if lr_collection is bound.
          lr_collection->add_collection( lr_contracts ).
        else.
          create object lr_collection
            type
              cl_crm_bol_bo_col.
          lr_collection->add_collection( lr_contracts ).
        endif.

        lr_pod ?= lr_col->get_next( ).
      endwhile.
    endif.

*   determine related accounts
    clear lr_col.
    if lr_collection is bound.
      lr_contract ?= lr_collection->get_first( ).
      while lr_contract is bound.
*=================================================================
*        如果合同已经结束,不去查找相关的BP,以正确显示BP
*        修改人 :采小明
*        修改日期:20090504
        clear lv_contend .
        call method lr_contract->if_bol_bo_property_access~get_property_as_value
          exporting
            iv_attr_name = ‘CONTEND’
          importing
            ev_result    = lv_contend.                      “#EC NOTEXT
        if lv_contend <= sy-datum and lv_contend ne ‘00000000′.
          lr_contract ?= lr_collection->get_next( ).
          continue .
        endif.
*=================================================================

        try.
            call method lr_contract->get_related_entity
              exporting
                iv_relation_name = ‘IsuOrderItemAccount’    “#EC NOTEXT
              receiving
                rv_result        = lr_account.
          catch cx_crm_genil_model_error.               “#EC NO_HANDLER
        endtry.

        if lr_account is bound.
          call method lr_account->if_bol_bo_property_access~get_property_as_value
            exporting
              iv_attr_name = ‘BP_NUMBER’
            importing
              ev_result    = lv_account.                    “#EC NOTEXT

          call function ‘CONVERSION_EXIT_ALPHA_INPUT’
            exporting
              input  = lv_account
            importing
              output = lv_account.

          if not lv_account is initial.
            read table lt_account with key table_line = lv_account transporting no fields.

            if sy-subrc <> 0.
              append lv_account to lt_account.
              if not lr_col is bound.
                create object lr_col
                  type
                    cl_crm_bol_bo_col.
                lr_col->add( lr_account ).
              else.
                lr_col->add( lr_account ).
              endif.
            endif.
          endif.
        endif.

        lr_contract ?= lr_collection->get_next( ).
      endwhile.
    endif.

  endif.

* confirm account
  check lr_col is bound.
  typed_context->builheader->set_collection( lr_col ).
  if lr_col->size( ) = 1.
    if get_auto_confirm_state( ) = abap_true.
      confirm_account( ).
    endif.

考试辅导
最近更新内容
Google广告