如何在SAP S/4HANA里创建自定义的partner function

Requirement: create custom partner function and consume it in Service scenario in S/4HANA for Customer Management.

As introduced in my blog One Order Partner Component model in S/4HANA for Customer Management, there are corresponding fields in flat table CRMS4D_SERV_H which stores the ID of different party roles. How about if customers would like to create their own partner functions and maintain some business partners based on those custom partner functions?

Here below are the steps in detail.

(1) Create a new extension field with type Text and length equals to 10. For detail please refer to my blog One order extensibility in S4HANA for Customer Management.

Find the technical name of this extension field in backend: ZZ1_JERRYCUSTOMPARTNER_SRH

(2) Create a custom partner function Z0000002:


tcode SM30, maintain table CRMS4C_PARTNER:
maintain the extension field name and custom partner function ID as below:

(3) Create a new partner determination procedure:

and assign the custom partner function Z0000002 to the created procedure:

Create a new transaction type and assign the custom patner determination procedure to it:

Now it is ready for test.
It is possible now to maintain business partners with custom partner function in WebUI. In my example the partner ID is 142.

This partner ID is stored in the very extension field we created in the first step:

The partner with this custom partner function could still be read out via CRM_ORDER_READ:

REPORT zread.

DATA: lt_guid       TYPE crmt_object_guid_tab,
      lv_id         TYPE crms4d_btx_h-object_id VALUE '8000000420',
      lt_partner    TYPE crmt_partner_external_wrkt,
      lt_customer_h TYPE crmt_customer_h_wrkt.

SELECT SINGLE guid INTO @DATA(guid) FROM crms4d_btx_h WHERE object_id = @lv_id.
APPEND guid TO lt_guid.

CALL FUNCTION 'CRM_ORDER_READ'
  EXPORTING
    it_header_guid = lt_guid
  IMPORTING
    et_partner     = lt_partner.

SELECT * INTO TABLE @DATA(lt_partner_fct) FROM crmc_partner_ft AS a
   FOR ALL ENTRIES IN @lt_partner WHERE a~partner_fct = @lt_partner-partner_fct AND
  spras = @sy-langu.

LOOP AT lt_partner ASSIGNING FIELD-SYMBOL(<partner>) WHERE ref_kind = 'A'.
  READ TABLE lt_partner_fct ASSIGNING FIELD-SYMBOL(<fct>) WITH KEY partner_fct =
   <partner>-partner_fct.
  IF sy-subrc = 0.
    WRITE:/ |Partner No: { <partner>-partner_no }, 'Role:' { <fct>-description }| COLOR COL_GROUP.
  ENDIF.
ENDLOOP.

Jerry’s other blogs on S/4HANA for Customer Management

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

汪子熙 CSDN认证博客专家 前端框架 Node.js SAP
JerryWang,2007年从电子科技大学计算机专业硕士毕业后加入SAP成都研究院工作至今。Jerry是SAP社区导师,SAP中国技术大使。2020年5月下旬,Jerry做了脑部肿瘤的开颅切除手术,对编程和人生又有了新的感悟。
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 博客之星2020 设计师:CY__0809 返回首页