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)?
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.
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).
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).
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.
Please remember that this approach is not supported by SAP and should never be used on TEST, PRD systems.