I need to delete a purchase order (all items) and send this information to a third-party system with IDoc. SAP is not creating an IDoc when I delete all the items in the purchase order. Can you please tell me how I can generate the IDoc for deleted purchase orders?
This is correct behavior. Purchase orders (POs) are documents. Deletion of items in business documents are not allowed once there was even one external commnunication. This is like in accounting or traditional procurement: you cannot simply go and blacken a single order item line in your files or rip out the full page. You have to strike them out and make a proper note as to why it was cancelled. Once you physically delete a line in the PO, the item line is no longer there, so there is nothing that an IDoc could ever send out. If this is the business procedure, which I don't recommend following, you can only trigger sending the full PO as an IDoc and the receiving system has to guess what lines are missing or what else has changed. However, keep in mind that, in an audited purchase order environment, this procedure is illegal (because of SOX, ISO9000, tax laws etc.). A line-item in a PO produces an Obligo in accounting; a line in accounting can only be cancelled by adding a reverse posting. Deleting the line will not do so. The correct way to proceed is to: 1. Cancel the line-item by putting the deletion marker or set the PO line to completed or quantity to 0. 2. Then the IDoc will correctly trigger as it is a normal change of an existing document.