采购需求者离职后,其他用户无法操作其创建的购物车
这个问题很多客户都有而且合情合理.照理说都到7.01了,怎么还不出标准事务代码去解决呢?
场景:
1.需求者创建购物车.
2.购物车进入审批流程.此审批流程可能长达若干周.
3.购物车被批准,进入采购员工作列表.
4.在采购员作出下一步动作前(如sourcing),需求者已离职,组织架构中该需求者被划分出去(delimited).
5.采购组织无法将购物车转给其他用户.错误代码"No address found for partner function type ***"
分析:
You have HR integration with SRM system to manage SRM users. In this case the HR system is the leading system and SRM system is a child system. When an employee leaves the company, from HR the employee validity will be delimited and the same will be replicated to SRM side. After the successful replication of this user from HR system, this user in SRM system doesn't have BP relation also the employee role related to this user will be 'EXPIRED' / Delimited. (i.e. the SU01 userid won't be deleted, only the BP relation will be delimited.) In this situation, if you try to edit the SRM documents for eg. purchase order, you will receive this error message "Partner xxxxxxxxxx not found with partner function type Goods Recipient" OR "Partner xxxxxxxxxx not found with partner function type Requestor"
解决方法:
Please find the following report Z_CHANGE_PGUID_002 which replaces the old partner with a new valid partner for this shopping cart.
字段说明:
p_number - Document number
p_ptype - Object Type
Oldbp - Invalid Business Partner number, ie., the business partnernumber which is related to the deleted userid. ( Check the requestor / recipient information of the document or refer the error message thrown when you try to modify the document)
Newbp - Valid business partner numberp_test
- If this is 'X', no data base update will happen, but the related information would be shown.
- If this is ' ', this will update the documents.
With this report you can update the Requestor / Recipient partner information with the valid business partner. Once the document is updated with valid business partner, you can further process the document.
解决局限性:
It only allows you to update one object (i.e.: 1 contract, 1 SC) at a time.
It also has no search capability. i.e.: if you know someone was terminated how do you know which all objects need to be updated.
参考Notes:
1227994 BBP_PD: Error Message BBP_PD 005 in purchasing documents
Z_CHANGE_PGUID_002. *&---------------------------------------------------------------------* *& Report Z_CHANGE_PGUID_002 * *& * *&---------------------------------------------------------------------* *& * *& * *&---------------------------------------------------------------------* REPORT z_change_pguid_002 . TABLES: crmd_partner, but000. DATA: lt_relationships LIKE bapibus1006_relations OCCURS 0, lt_return LIKE bapiret2 OCCURS 0, cs_relationship LIKE bapibus1006_relations, iv_partner_guid TYPE bapibus1006_head-partnerguid. DATA: l_partner_org TYPE bu_partner, l_addr_num TYPE ad_addrnum, l_addresses_int LIKE bapibus1006_addresses_int OCCURS 0 WITH HEADER LINE, l_return LIKE bapiret2 OCCURS 0. DATA: lt_partner TYPE STANDARD TABLE OF bbp_pds_partner, lt_partner_c TYPE STANDARD TABLE OF bbp_pds_partner, wa_partner TYPE bbp_pds_partner, lt_but000 TYPE TABLE OF but000, po_header LIKE bbp_pds_po_header_d, sc_header LIKE bbp_pds_sc_header_d, cf_header LIKE bbp_pds_conf_header_d, bid_header LIKE bbp_pds_bid_header_d, ctr_header LIKE bbp_pds_ctr_header_d, newguid LIKE crmd_partner-guid. PARAMETERS: p_number LIKE crmd_orderadm_h-object_id OBLIGATORY, p_ptype LIKE crmd_orderadm_h-process_type OBLIGATORY MATCHCODE OBJECT bbp_process_type, oldbp LIKE but000-partner OBLIGATORY, newbp LIKE but000-partner OBLIGATORY, p_test AS CHECKBOX. START-OF-SELECTION. * Need to call BP GUID of newbp SELECT SINGLE partner_guid FROM but000 INTO newguid WHERE partner = newbp. * call Document data. CASE p_ptype. WHEN 'ECPO'. CALL FUNCTION 'BBP_PD_PO_GETDETAIL' EXPORTING i_object_id = p_number IMPORTING e_header = po_header TABLES e_partner = lt_partner. PERFORM get_chgversion_partner TABLES lt_partner_c USING po_header-guid. IF NOT lt_partner_c[] IS INITIAL. APPEND LINES OF lt_partner_c TO lt_partner. ENDIF. WHEN 'SHC'. CALL FUNCTION 'BBP_PD_SC_GETDETAIL' EXPORTING i_object_id = p_number IMPORTING e_header = sc_header TABLES e_partner = lt_partner. PERFORM get_chgversion_partner TABLES lt_partner_c USING sc_header-guid. IF NOT lt_partner_c[] IS INITIAL. APPEND LINES OF lt_partner_c TO lt_partner. ENDIF. WHEN 'CONF'. CALL FUNCTION 'BBP_PD_CONF_GETDETAIL' EXPORTING i_object_id = p_number IMPORTING e_header = cf_header TABLES e_partner = lt_partner. PERFORM get_chgversion_partner TABLES lt_partner_c USING cf_header-guid. IF NOT lt_partner_c[] IS INITIAL. APPEND LINES OF lt_partner_c TO lt_partner. ENDIF. WHEN 'BID'. CALL FUNCTION 'BBP_PD_BID_GETDETAIL' EXPORTING i_object_id = p_number IMPORTING e_header = bid_header TABLES e_partner = lt_partner. PERFORM get_chgversion_partner TABLES lt_partner_c USING bid_header-guid. IF NOT lt_partner_c[] IS INITIAL. APPEND LINES OF lt_partner_c TO lt_partner. ENDIF. WHEN 'PCTR'. CALL FUNCTION 'BBP_PD_CTR_GETDETAIL' EXPORTING i_object_id = p_number IMPORTING e_header = ctr_header TABLES e_partner = lt_partner. PERFORM get_chgversion_partner TABLES lt_partner_c USING ctr_header-guid. IF NOT lt_partner_c[] IS INITIAL. APPEND LINES OF lt_partner_c TO lt_partner. ENDIF. ENDCASE. LOOP AT lt_partner INTO wa_partner WHERE partner_id = oldbp. IF p_test NE 'X'. UPDATE crmd_partner SET partner_no = newguid WHERE partner_guid = wa_partner-partner_guid. * Change address number of CRMD_PARTNER, in order to update ADDR3_DATA. SELECT SINGLE persnumber FROM but000 INTO wa_partner-addr_no WHERE partner_guid = newguid. UPDATE crmd_partner SET addr_np = wa_partner-addr_no WHERE partner_guid = wa_partner-partner_guid. iv_partner_guid = newguid. * Get organization BP number for responsible requestor. CALL FUNCTION 'BUPA_RELATIONSHIPS_GET' EXPORTING businesspartnerguid = iv_partner_guid TABLES et_relationships = lt_relationships et_return = lt_return. READ TABLE lt_relationships INTO cs_relationship INDEX 1. l_partner_org = cs_relationship-partner1. * get address from BUT020 CALL FUNCTION 'BUPA_ADDRESSES_GET' EXPORTING iv_partner = l_partner_org IMPORTING ev_standard_addrnumber = l_addr_num TABLES et_addresses = l_addresses_int et_return = l_return. IF sy-subrc = 0. * Update addr_nr UPDATE crmd_partner SET addr_nr = l_addr_num WHERE partner_guid = wa_partner-partner_guid. * Write: Display result. WRITE: / wa_partner-partner_guid, wa_partner-p_guid, wa_partner-partner_no, ' has been updated'. ELSE. WRITE: 'ERROR updating database'. ENDIF. ELSE. WRITE: / wa_partner-partner_guid, wa_partner-p_guid, wa_partner-partner_no, ' will be updated'. ENDIF. COMMIT WORK AND WAIT. ENDLOOP. IF sy-subrc <> 0. WRITE: 'BP number of old requestor is not correct'. ENDIF. *&---------------------------------------------------------------------* *& Form get_chgversion_partner *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_LT_PARTNER_C text *----------------------------------------------------------------------* FORM get_chgversion_partner TABLES p_lt_partner_c STRUCTURE bbp_pds_partner "Bitte korrekten Namen für <...> einfügen. USING p_guid TYPE crmt_object_guid. DATA: lt_it_header_guids TYPE TABLE OF bbp_guid_tab, ls_it_header_guids LIKE LINE OF lt_it_header_guids, lt_et_pdlist TYPE TABLE OF bbp_pds_version_list_internal, ls_et_pdlist LIKE LINE OF lt_it_header_guids, ls_bbp_pds_header TYPE bbp_pds_header. ls_it_header_guids-guid = p_guid. APPEND ls_it_header_guids TO lt_it_header_guids. * get the actual change version CALL FUNCTION 'BBP_PROCDOC_GET_CHANGE_VERSION' TABLES it_header_guids = lt_it_header_guids et_pdlist = lt_et_pdlist. * we need the guid of the change version READ TABLE lt_et_pdlist INDEX 1 INTO ls_et_pdlist. IF sy-subrc = 0. * get the details of the change version CALL FUNCTION 'BBP_PROCDOC_GETDETAIL' EXPORTING i_guid = ls_et_pdlist-guid IMPORTING e_header = ls_bbp_pds_header TABLES e_partner = p_lt_partner_c. ENDIF. ENDFORM. " get_chgversion_partner