Skip to Content
Author's profile photo Michal Krawczyk

Michal’s PI tips: How to restart a successfully processed PI message on Java stack

There are times when it’s not possible to get a new message on PI and the easiest way would be to restart the same message which was already processed. On ABAP stack messages it was possible to achive this with the use of the functionality presented in one of my articles: Michal’s PI tips: Restarting successfully processed messages.

How to do it on PI’s Java stack messages (single stack PI’s – AEX for example)?

Assumptions:

a) we should only try to restart successfully processed messages on development environments (never on TEST nor PRD)

b) you need to know that this approach is not supported by SAP and can cause serious issues in case you do it incorrectly

c) this approach is valid for >= PI 7.11 (where messages are stored in BC_MSG table) 

It seems it’s possible to build a simple application which will do a few changes in SAP PI DB tables and this will allow restarting successfully processed messages. I will not show the application as it’s not necessary at this point, only the idea on how to achive the reqirement.

Our potencial message can look as shown in Figure below.

/wp-content/uploads/2012/07/delivered_111_122264.jpg

In order to change be able to restart it, first thing we need to do is to change it’s status from “DLVD” to “NDLV” (from delivered to not delivered) in BC_MSG table.

update BC_MSG set status = ‘NDLV’ where MSG_ID = ‘MESSAGE_ID_WHICH_WE_RE_REPROCESSING’

This statement will change the status of the message to Not Delivered (second message).

/wp-content/uploads/2012/07/not_delivered1111_122265.jpg

In case our adapter is using a duplicate check we won’t be able to reprocess it yet – we’d need to make sure it’s not visible in another table as well – XI_AF_SVC_ID_MAP. That’s why we need to remove records from this table too and there can be more then one – not only message ID but also message ID and direction – (INBOUND).

/wp-content/uploads/2012/07/removing1111_122266.jpg

You can use one statement (in this case two to highlight that there can be more then one rows for one message).

delete from XI_AF_SVC_ID_MAP where MSG_ID1 = ‘MESSAGE_ID_WHICH_WE_RE_REPROCESSING’  

delete from XI_AF_SVC_ID_MAP where MSG_ID1 = ‘MESSAGE_ID_WHICH_WE_RE_REPROCESSING(INBOUND)’  

This should allow you to reprocess the message from PI tools – RWB, MDT.

Note:

Please remember that this approach is not supported by SAP and should never be used on TEST, PRD systems.

Assigned Tags

      17 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Agasthuri Doss
      Agasthuri Doss

      Thanks Michal for sharing  & also for the Note ..

      Cheers

      Agasthuri

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      thank you mate ๐Ÿ™‚

      Regards,

      Michal Krawczyk

      Author's profile photo Sunil Chandra
      Sunil Chandra

      Michal.. Your blog is always such a pleasure to visit.. where do your out of box ideas come from.. do you have some secret idea generating machine ๐Ÿ˜‰  

      Keep those ideas flowing..keep blogging.

      Cheers,

      Sunil Chandra

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      Hi,

      >>>do you have some secret idea generating machine

      indeed - working on many things and experiencing many issues which need to be solved ๐Ÿ™‚

      Regards,

      Michal Krawczyk

      Author's profile photo Former Member
      Former Member

      Trickster Michal at it again ๐Ÿ™‚

      I like the disclaimer too and the fact that it was mentioned a couple of times ๐Ÿ˜ˆ .

      One always needs these workarounds though...:-)

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      Hi Trevor,

      disclaimer is my second name ๐Ÿ™‚ expecially when I show how to update tables ๐Ÿ˜‰

      Regards,

      Michal Krawczyk

      Author's profile photo Prateek Raj Srivastava
      Prateek Raj Srivastava

      Was I searching for wiki with "simple application" code? 😏

      Always exciting stuff!

      Cheers,

      Prateek Raj Srivastava

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      hehe ๐Ÿ™‚   complex things in simple ways is my name LOL ๐Ÿ™‚

      Regards,

      Michal Krawczyk

      Author's profile photo Nageshwar Reddy
      Nageshwar Reddy

      With increased security consciousness in the organizations and considering SAP recommendation to leave alone the database, the usability of this approach is very limited. Often, other alternatives of recreating the message might be easier to deal with.

      Thanks for sharing.

      Author's profile photo Former Member
      Former Member

      Hi Michal,

      Could you let me know why it should not be use in TEST system but can be use in DEV system?

      Generally we use test system for testing purpose.

      Regards,

      Abhijit

      Author's profile photo Former Member
      Former Member

      Hi Michael,

      Thanks for your tip. Can you please share which role is required to view the table XI_AF_SVC_ID_MAP in open SQL Data Browser in NWA?

      Thanks

      Dingjun

      Author's profile photo Avinash Ayanala
      Avinash Ayanala

      Hi Michael,

      Wow it was very informative i never thought that it is possible to process again the successfully processed message thanks for the info.

      Regards,

      Avinash

      Author's profile photo Former Member
      Former Member

      I tried running the same statement in SQL Command Editor in DBACOCKPIT. But I get the following error:

      update BC_MSG set status = 'NDLV' where MSG_ID = '53bb3f5b-4f28-1760-e100-8000a1f1ff54'

      ORA-00903: invalid table name.

      But when I run a select statement ( select status from bc_msg ) on bc_msg table it works fine.

      Please advice.

      Author's profile photo Mayur Patel
      Mayur Patel

      Michael,

      Thanks for the blog... it is very similar to what we are trying to achieve. We are trying to achieve message reprocessing but, on a mass scale and in an automatic fashion on time based trigger. Is it possible to kick of reprocessing without going to RWB and manually? We would like to reprocess all messages between two timeframes.

      Thanks.

      Author's profile photo Rashmi Joshi
      Rashmi Joshi

      Hi Michal,


      Very nice blog. Thanks for sharing.

      <it's possible to build a simple application>


      Do we have any application handy?


      BR,

      Rashmi

      Author's profile photo PO Team
      PO Team

      Hi Michal,

       

      Is it possible to use the same approach to mark the status as 'CANCEL' for the messages which are in 'Error' so that those can be deleted from DB. Our PO system is 7.4 Single stack. There is a mass cancellation functionality available but our current SP do not support and it will take some time to update latest patch.

       

      Regards,

      Sharada

      Author's profile photo Sampathi Geetha
      Sampathi Geetha
      Hi Michal,
      Is it possible to use the same approach to mark the status as โ€˜CANCELโ€™ for the messages which are in โ€˜Errorโ€™ from Adapter engine Message monitor .Our PI system is 7.31.

      Or automaticallyย  cancel the error messages from adapter engine monitor .Please suggest any possible solutions.