Copper mining

Mass rejection of tax documents: finding the cause in hours, not weeks

A mass rejection by the tax authority does not always come from a change of your own. When diagnosis starts from the message rather than the system, the cause shows up fast.

Hours not weeks: root cause identified Real payload diagnosis by message, not configuration Full recovery all documents reprocessed and accepted

Client

Mining operation with high-volume invoicing to suppliers and customers, integrated from S/4HANA SD to the electronic invoicing service through SAP CPI.

Initial situation

Overnight, electronic tax documents started being rejected. The commercial team reported a growing volume of rejected documents before the technical team was aware. There had been no deployment and no change to the interface. The internal team's initial hypothesis pointed at the iFlow, and a rollback of an unrelated change was already being prepared.

Constraints

  • Invoicing halted: every hour without issuing documents hits collections directly.
  • No immediate access to the invoicing provider's logs.
  • Pressure to roll back a deployment that was in fact unrelated to the problem.
  • Volume made document-by-document review impossible.

Architecture decision

Before rolling anything back, the message actually sent in a rejected case was compared against an accepted one from the previous week. That single step — looking at the real payload rather than the configuration — narrowed the problem in under an hour: the difference was not in the iFlow but in a source value, a field that had started arriving from S/4HANA in a format the target schema used to tolerate and no longer did.

The decision not to roll back mattered as much as the diagnosis. A rollback would have consumed hours, reintroduced previous behaviour without fixing the cause, and left the team convinced the problem was solved.

The fix went into the mapping, with explicit field validation and a readable error message, rather than letting the rejection come back from the receiver.

Execution

Affected documents were identified by pattern rather than one by one, the mapping was corrected with source-side validation, and rejected documents were reprocessed in controlled batches, confirming acceptance before releasing the next. A rejection-rate alert was added so a future deviation is caught in minutes rather than when the commercial team reports it.

Outcome

Root cause identified within hours, not weeks, and invoicing normalised shortly after, with every document reprocessed and accepted. A rejection-rate alert, which did not exist before, was left in place.

Takeaways

When something breaks and nobody changed anything, somebody changed something. Starting from the actual message rather than the configuration is what separates a diagnosis of hours from one of weeks.

Stack

SAP CPI S/4HANA SD E-invoicing Groovy OAuth 2.0
Facing a similar situation? Let's talk See other case studies