Business partner mapping (REST API for Solution Manager)

When creating or updating a ChARM object via the REST API, business partners and their roles can be specified in the request in the following form, see Endpoints (REST API for SAP Solution Manager) | Business Partner .

"partner": [ { "partnerFct": "SDCR0001", "partnerLookup": "151" }, { "partnerFct": "SDCR0002", "partnerLookup": "102" } ]

The property "partnerLookup" usually contains the business partner number, which can be determined using the REST API based on the email address, see Endpoints (REST API for SAP Solution Manager) | GET /data/partner?email={emailAddress) . If the email address is not unique or does not exist in the source system, e.g. ServiceNow, it is possible to implement a customer-specific mapping for determining business partners. The prerequisite is that a unique characteristic for determining a business partner exists, which is available in the source system and in Solution Manager.

In the following example, such a unique characteristic is stored as a search term in the business partner master record.

Example where a unique characteristic identifying a business partner is stored as a search term in the business partner master record.

For the implementation of a business partner mapping, an enhancement spot named /GAL/SM_CHARM is delivered in the addon. To create an implementation, proceed as follows.

  • Call transaction SE19.

  • Enter the name /GAL/SM_CHARM in the enhancement spot field and click the "Create Impl." button.

  • In the popup that appears, enter a name for the enhancement implementation according to the naming conventions of your company and confirm the entry with the corresponding button.

  • In the next popup, the package assignment and the request for a transport request is made. Select a suitable package and transport request or create a new one.

  • In a further popup the name of the BAdI implementation and the name of the implementing class must be specified. Choose a suitable name based on your naming convention and select the entry /GAL/SM_CHARM_PARTNER_BADI as BAdI definition from the input help and confirm the entry with the corresponding button in the dialog.

  • Another popup for package assignment is displayed. Here, select the same package as in the previous popup and a corresponding transport request.

Definition of the name for the enhancement implementation

 

 

After successfully entering all relevant data, the newly created enhancement implementation is displayed.

To perform the customer-specific implementation, double-click on the "Implementing Class" node in the left tree structure and then double-click on the Implementing Class link in the right half of the screen to navigate to the SAP Class Builder. In the method /GAL/IF_EX_CHARM_PARTNER_BADI~ASSIGN_PARTNER you can implement the customer-specific logic for a business partner mapping. The method contains the following definition.

Parameter

Type

Data type

Description

Parameter

Type

Data type

Description

PROCESS_TYPE

Importing

CRMT_PROCESS_TYPE

The transaction type of the current ChaRM object for which a partner mapping is to be performed.

PARTNER_FCT

Importing

CRMT_PARTNER_FCT

The role of the partner in the ChaRM object, e.g. developer or change manager.

PARTNER_PFT

Importing

CRMT_PARTNER_PFT

The category of the partner function in the ChaRM object, e.g. employee or supplier.

LOOKUP_TEXT

Changing

STRING

The value "partnerLookup" from the REST request.

The three import parameters can be used for more complex mappings, e.g. if the mapping should be dependent on the partner function or the transaction type.

In our example we only need the value from the changing parameter LOOKUP_TEXT. The following sample implementation shows how a business partner is determined based on the second search term and the found value is returned.

METHOD /gal/if_ex_charm_partner_badi~assign_partner. DATA: l_search_results TYPE bu_partner_info_t, l_messages TYPE bapiret2_t, l_sort2 TYPE bu_sort2. FIELD-SYMBOLS: <l_search_result> LIKE LINE OF l_search_results. IF lookup_text IS NOT INITIAL. l_sort2 = lookup_text. CALL FUNCTION 'BUPA_SEARCH_2' EXPORTING iv_sort2 = l_sort2 iv_valid_date = sy-datlo iv_req_mask = '' TABLES et_search_result = l_search_results et_return = l_messages. DESCRIBE TABLE l_search_results LINES sy-tfill. IF sy-tfill = 1. READ TABLE l_search_results ASSIGNING <l_search_result> INDEX 1. IF sy-subrc = 0. lookup_text = <l_search_result>-partner. ENDIF. ENDIF. ENDIF. ENDMETHOD.