My question is regarding Outbound EDI of the Advance Shipping Notice, which has produced an IDoc. The IDoc was successfully sent to the customer, but it turns out we have missing or incomplete data. This means the customer is unable to receive the goods into stock!
One of the missing pieces of information is the Customer Material Number(KDMAT). The problem is that the Goods Issue has already taken place and the Invoice sent to the customer. In the delivery it is not possible to manipulate the KDMAT field. Rather than canceling the Customer Invoice, canceling the Goods Issue, deleting the Delivery and re-creating I looked at the possibility of editing the IDoc, which is possible with transaction WE02 in change mode. This sets the IDoc status to 32 - IDoc has been edited. Next I expected to be able to use transaction BD88 - Process Outbound IDocs to resend the edited IDoc but this is where I have my problem! I get a hard error telling me that the previous status was 03 meaning that it was processed ok! I presume that it's not allowing the IDoc to be resent because it's already been successfully sent! There must be a way to do this!
Unfortunately, SAP prohibits resending an already send IDoc.
However, an incomplete IDoc should never leave the factory anyway. So it is better to catch the error before you publish it.
In the case you described the ideal solution would be building an automatic check routines in the user-exit of the function that creates the outbound IDoc. There you could either try to enrich the document, so that the missing data is there. Alternatively you set the status of the IDoc (control_record_out-status) to something other than 30, e.g. '26' (Syntax error).
But I have to tell you that I do not see a sound standard way to inhibit sending due to incorrect data while still creating the IDoc. You cannot manipulate the status or any other control parameter. You can exit the creating function module by raising an error. This will cause the IDoc creation to fail and a workflow will be starting notifying someone that the send has failed.
So far, the proper options. Now the dirty solutions. (Some say, these are my preferred solutions, who knows.)
If you want to resend just in exceptional cases you may use WE19, the test tool and recreate the IDoc as a copy of the original. WE19 will also allow to edit the IDoc properly. Since release 4.6 the tool became pretty cool to use.
Another option is a little ABAP, like the following two-liner:
PARAMETERS: docnum like edidc-docnum.
update edids set status = '30' where docnum eq docnum and status eq '03'.
Dig Deeper on SAP ABAP
Related Q&A from Axel Angeli
An SAP user is receiving an error message while integrating SAP iDoc PORDCR1 for a purchase order. Continue Reading
SAP expert Axel Angeli explains how to update the "further dates" tab information in am SAP transaction through an SAP IDoc. Continue Reading
An SAP R/3 4.7 user wants looking to post a document entry using different trading partner fields for credit and debit for function FB01. Continue Reading