Monday, 14 September 2020 12:46

Equipment Partners

Written by Andrew Barnard
Rate this item
(0 votes)
“© 2020. SAP SE or an SAP affiliate company. All rights reserved.” “Used with permission of SAP SE”


The purpose of this blog post is to provide an orientation to reading and maintaining equipment partners from customer  developed ABAP programs. The post provides a summary of several function modules which are useful in this context.

Reading Equipment Partners


Partners of equipment can be read using the function module ALM_ME_TOB_PARTNERS. Given an equipment object number or functional location object number, the function provides a table of the partners of the technical object and the partner role.

I prefer this function module to the perhaps more commonly known PM_PARTNER_READ because (a) it is RFC enabled and (b) does some external conversions to convert the partners from internal representation to external representation.

Hint: If you need to determine the object number of the piece of equipment, then I commend function to you BAPI_EQUI_GETDETAIL

Reading Partner Details


The details of the partners can be read using the function module above. Given a partner key, the function provides details of the partner, including address information, associated SD contract information and contact persons. Partner key? Where did that come from? The partner key is returned when reading the equipment partners using ALM_ME_TOB_PARTNERS.

Maintaining Partner Details

When maintain partner details, a much more care is required. You need to consider issues such as external and internal representations and whether the configuration of the equipment allows the partner you would like to maintain.  I’ve found the function ALM_ME_EQUIPMENT_CHANGE to be a useful guide to the steps involved.

Let assume that you are starting with a table of partners like those returned by ALM_ME_TOB_PARTNERS.

Step 1: Partner role conversion


Conversion of the partner role from external to internal format

Step 2: Check partners for validity


Provides the partners and the equipment category to check whether the partners are permissible. If there are errors here, you need to correct them.

Step 3: Prepare to maintain / update partners

The function to maintain partners requires partner information in the format of the structure BAPI_IHPA.

For every partner in your table of partners, you need to extract the internal partner ID and the partner role. For that, you need to do something along the lines of

 DATA ls_ihpa type ihpa. DATA ls_bapi_ihpa type bapi_ihpa. DATA lt_bapi_ihpa type standard table of bapi_ihpa. LOOP AT equipment_partners INTO ls_partner. CLEAR ls_ihpa. CLEAR ls_bapi_ihpa. CALL FUNCTION 'ALM_ME_PARTNER_KEY_SPLIT_TPA' EXPORTING partner_key = ls_partner-partner_key IMPORTING partner_id = ls_ihpa-parnr. MOVE ls_partner-partner_role TO ls_bapi_ihpa-partn_role. MOVE ls_ihpa-parnr TO ls_bapi_ihpa-partner MOVE ls_equipment_itob-objnr TO ls_bapi_ihpa-object_no. MOVE '009' TO ls_bapi_ihpa-operation . APPEND ls_bapi_ihpa TO lt_bapi_ihpa. ENDLOOP.

Additionally, you need to read the equipment categories of the equipment to fill structure t370t needed to maintain partners in step 4. Use ITOB_CHECK_CATEGORY.


Step 4: Maintain partners


Step 5: Prepare for Update


Step 6: Trigger update


Whether commit work should be called or not is dependent upon your context


To maintain the equipment partners, I’d recommend that the above steps be combined into a class and then wrapped in a function module if needed for remote access.

Don’t forget that changing the equipment partners is part of changing a piece of equipment – so you are advised to ensure you have exclusive use of the equipment. Locking etc.

Write unit tests first!

Test thoroughly!

Read 45 times

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.