Symptom
- When calling the Billing Document API entity A_BillingDocumentItem and filtering on the field ReferenceSDDocument, the request returns no items although the value exists on the billing document items.
- The expected behavior is that all billing document items with the specified referencesddocument value are returned.
- Observed behavior: no records are returned for the filter.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Call the Billing Document API (API_BILLING_DOCUMENT_SRV) entity A_BillingDocumentItem using an OData filter on ReferenceSDDocument
- Observe that the response contains no items, even though the value is present on corresponding billing document items.
Cause
The issue lies in the incorrect formatting of the ReferenceDocument field during billing document creation via the SOAP API billingdocumentrequest_in.
When the reference document consists only of digits and is fewer than 10 characters, it must be stored with leading zeros to a total length of 10. If created without leading zeros, subsequent GET filters on ReferenceSDDocument will return no result. Below is an example of the inaccurate API request which brings the problem:
<BillableDocument>
<ReferenceDocument>1</ReferenceDocument>
...
<BillableDocument>
Resolution
When creating billing documents via SOAP API billingdocumentrequest_in, ensure the ReferenceDocument element is left‑padded with zeros to 10 digits when it contains only digits, like below:
<BillableDocument>
<ReferenceDocument>0000000001</ReferenceDocument>
...
<BillableDocument>
See Also
Keywords
a_billingdocumentitem, api_billing_document_srv, referencesddocument, odata filter, no items returned, billing document item, reference document, leading zeros, 10-digit padding, billingdocumentrequest_in, soap api, read billing items, filter not working, s/4hana cloud public edition , KBA , SD-BIL-IV-2CL , Processing Billing Documents (Public Cloud) , Problem
SAP Knowledge Base Article - Public