Skip to Content
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.
To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Conrad Donau

    Hi Jerry Wang

    Thanks for the update! You specified in your custom partner function a maximum cardinality of 2 partners. I suppose if you would add a second partner with the same partner function in the table crms4d_partner we would have two entries while in the crms4d_serv_h we would see only one (= the main) partner?

    Cheers

    Conrad

    (0) 

Leave a Reply