Unconfirmed line items getting deleted in SNC

I’m going to post this as the question and solution exchange I had over email with a fellow SNC Consultant. Hope it helps you if you have a similar issue:

The Issue:

Hello,

Need your help in understanding a strange issue we are facing in SNC.
PO confirmations sent from supplier backend system is deleting lines in the PO in SNC. For example, if the PO in SNC has 4 line items and supplier sends a PO confirmation (ROC_in XML) from his backend system for only one of those lines, the confirmation for that line gets processed successfully, but deletes the remaining 3 lines from the PO in SNC for which confirmations are not sent in the ROC_in XML. Therefore subsequent PO confirmations sent by supplier for the remaining lines fail.

Did you ever face this issue ? Any advice would be of great help.

The suggested Solution:

There is one possible explanation for this.

Note 1712211 says: SNC expects that all items of the Purchase Order are included in the ROC_in message, even those items that have cancelled status. This is a general design for handling XML messages. XML has to contain all items.

Ignore the cancellation reference. basically can you check if your inbound xml from supplier backend contains all items? That’s why its deleting the other items in SNC. Even if they are not confirmed, the items need to be in xml..

Resolution 
Provide all PO items to SNC, or Implement Badi /SCA/BIF_I_REPLORDC method after_conversion to add the missing items into the XML. Check Note 1712211 in service marktetplace.

The Response:

We implemented the BADI you mentioned below and it fixed the issue. Even if the partner sends only a sub set of line items we are able to process the confirmations successfully.