Skip to Content
Author's profile photo Former Member

Did you ever wanted to link an XI/PI message with a business document?

Did you ever wanted to link a message with a business document? Often, messages are generated in the background and in hidden places like a BADI making it difficult to trace.

In my current project for example, an item that has been dunned generates an outbound message. The message is generated in a FM called in the dunning activity and this is not seen in the job logs. Wouldn’t it be interesting to make a link between the message and the item so we don’t need to search in the message payload? Or the other way around, and inbound message creates a document in my system. I would like to link the document with that message.

If the transaction that displays the ‘document’ profits from the Generic object services (GOS), this link is really easy. All we have to do is create a link between the message and the BOR used in the GOS and there are plenty of blogs/posts about it so I wont cover it here.

I’ve done this often with IDOCS, it’s quite easy and quite handy so I wanted to achieve the same, this time with XI/PI messages and …

it turned out to be already foreseen in the standard. Just have a look to methods CL_PROXY_ACCESS=>WRITE_INBOUND_MESSAGE_LINK and CL_PROXY_ACCESS=>WRITE_OUTBOUND_MESSAGE_LINK. The link is stored in table SPROXMSGREL and there is already an standard report SPROX_MESSAGELINK_DELETE for housekeeping.

The class documentation already provides some examples so I won’t duplicate that here. Instead I’ll just show the result.

  This is transaction FPE3 and displays a FI-CA document. It has the GOS toolbar enabled and by clicking on the ‘Relationships’ menu, it displays the link to the PI messages.

example_GOS_FPE3.png

A double click on the line will take the user to the message monitor transaction.

example_GOS_FPE3_list.png

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh

      Hi David

      Thanks for sharing this. I came across the CL_PROXY_ACCESS class when I was doing some inbound proxy programming previously and thought of trying it out, but eventually did not get around to it. The relationships feature is common on IDoc interfaces and is very useful for troubleshooting purposes.

      One question, for the field TYPEID of structure SIBFLPORB, should it be populated with the Business Object type, i.e. BUS6035 for Accounting Document? There is no associated value table for that Domain so it's a bit vague plus the class documentation does not provide further details.

      Rgds

      Eng Swee

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Eng,

      You can find that in the documentation of the class. Just click on the link 'Using Object Links' and it will take you to a more detailed documentation about this functionallity and even an example.

      In my example from the blog I used:

      instid = document number

      catid = 'BO'. " I link it to a BOR object.

      typeid = 'CA_DOC'. " This is the bor object type for documents used in tcode FPE3.

      Regards,

      David.

      Author's profile photo Carlos Ivan Prieto Rubio
      Carlos Ivan Prieto Rubio

      Thanks for sharing David. 🙂

      Author's profile photo Jean-Philippe Pain
      Jean-Philippe Pain

      Thanks for the information.

      Author's profile photo Former Member
      Former Member

      Very interesting. I will offer the chance to business in future developments. Thanks a lot for sharing your knowledge.

      Author's profile photo Michal Krawczyk
      Michal Krawczyk

      hi David,

      Maybe it's also useful to add the info on this report: SPROX_MESSAGELINK_DELETE

      Which allows removing the links from the system.

      Regards,

      Michal Krawczyk

      Author's profile photo Wilbert Karremans
      Wilbert Karremans

      Hi all;

      I have implemented the relationship between Sales Order (BOR type ZBUS2032) and the PI message.

      ls_objectidinstid lv_vbeln.
      ls_objectidtypeid c_my_objecttype.
      ls_objectidcatid ‘BO’.
      cl_proxy_access=>write_outbound_message_link(
      proxy     lr_prx_refund
      object_id ls_objectid                 ).

      PI message is created sucessfully, message-ID is retrieved and even table SPROXMSGREL is populated with the GUID of the PI-message:

      0050568D4BB11ED787DE59748EE880DE (GUID of PI message)

      XI_OUT_BOR

      0050568D4BB11ED787DE59748EE800DE

      CL_SWF_XI_MESSAGE_LINK

      CL

      0060532875 (VBAK-VBELN)

      ZBUS2032

      BO

      All seems OK, but when using VA03/VA02, the “Relationships” in the GOS menu is grayed-out.

      Any idea why?

      I also tried with value BUS2032.

      Best regards;

      Wilbert