AutoInvoice
For sales order shipments interfaced to Receivables, the Import AutoInvoice process knows if a fiscal document was already generated and approved from Shipping. Autoinvoice creates the corresponding invoice as completed, and you can't generate a fiscal document in Receivables for this invoice.
The only exception is a triangular operation (Transaction Business Categories 5118, 5119, 6118, and 6119) where two fiscal documents are created in the same flow initiated with a Sales Order, one in the shipment for the goods remittance and another in the receivables for the symbolic remittance.
Here's the Grouping Rule:
One shipment can generate only one fiscal document. Also, each fiscal document generated in Shipping should be associated with only one transaction in Receivables.
Shipping passes the Fiscal Document Number (TAX_INVOICE_NUMBER) and the Fiscal Document Date (TAX_INVOICE_DATE) to the Distributed Order Orchestration (DOO) for all transactions, which in turn passes them downstream to Receivables. For AutoInvoice, the TAX_INVOICE_NUMBER is an optional attribute for the grouping rule.
Delivery Name (Shipment identification) comes from Shipping, and it is populated by DOO in INTERFACE_LINE_ATTRIBUTE7 of RA_INTERFACE_LINES_ALL table.
Define a new grouping rule that will work for all transactions coming from DOO and include TAX_INVOICE_NUMBER and INTERFACE_LINE_ATTRIBUTE7 attributes.