SAP Knowledge Base Article - Public

3802709 - OData service fails due to illegal XML control characters in PR short text causing CPI parser error – SAP S/4HANA Cloud Public Edition

Symptom

  • OData service in SAP S/4HANA Cloud Public Edition fails when a control character is entered in the Purchase Requisition (PR) short text and propagated to the Purchase Order (PO), resulting in malformed XML.
  • The Cloud Integration (CPI) iFlow fails at the OData receiver with a parser error.
  • Error example: Com.ctc.wstx.exc.WstxUnexpectedCharException: Illegal character ((CTRL-CHAR, code 2)).

Environment

 SAP S/4HANA Cloud Public Edition

Reproducing the Issue

  1. Enter an invalid control character in the Purchase Requisition short text.
  2. Create or process a Purchase Order so the value is carried over.
  3. Call the relevant OData V2 service to read the affected object.
  4. Observe that the OData response contains malformed XML and CPI iFlow fails at the OData receiver with a parser error (Woodstox).

Cause

Data contains illegal XML control characters in text fields; during OData V2 serialization the response becomes malformed XML, which XML parsers (for example, Woodstox) reject.

Resolution

  1. Remove or correct illegal XML control characters in the source application data so that only XML-compliant characters are present.
  2. As an alternative integration approach, consider using the HTTP adapter to retrieve data and handle content according to your scenario’s needs.
  3. Optionally set the OData adapter’s Content-Type to JSON to avoid XML serialization; note this is not guaranteed and depends on endpoint capabilities.

Keywords

odata v2, illegal character, control character, malformed xml, woodstox, WstxUnexpectedCharException, parser error, cpi, iflow, purchase requisition, purchase order, short text, odata adapter, xml serialization, content-type json , KBA , LOD-HCI-PI-CON-OD , OData Adapters , Problem

Product

SAP S/4HANA Cloud Public Edition all versions