Symptom
Business is using "API_BILLING_DOCUMENT_SRV" API to get billing info of customer project.
When creating billing document in Customer Project, billing document API will get all the info including:
- Old billing document with previous billing amount
- Changed billing document with previous billing amount
- The newest billing document with proper billing amount
Filter needs to be applied to get only the newest billing document info, not all billing documents including changed or deleted billing document info.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Create billing document in Customer Project (billing amount e.g. 5000€)
- Create billing requirement, then create billing document
- Delete billing document
- Refuse billing requirement
- Change billing amount to e.g. 3000€ in Customer Project
- Create billing requirement and billing document again
- Get info with API_BILLING_DOCUMENT_SRV -> BillingDocumentItem (Filter = SalesDocument eq '' ")
Cause
This is a standard system behavior, and system works as designed.
Resolution
When reading billing documents with API_BILLING_DOCUMENT_SRV, all properties can be included as filters that are listed under the entities.
For instance, when querying the item text entity 'A_BillingDocumentItemText', all properties listed under Item Partner can be used as filters. Or, in case querying the billing document header entity 'A_BillingDocument', you can use all properties listed under Billing Document Header as filters.
The response will vary according to which entities are queried and which properties and values are specified as filters in the read operation.
All existing data can be either retrieved at once (no filters), or any of the properties for each service entity can be used as filters.
See Also
SAP API Business Hub - Billing Document - Read, Cancel, GetPDF
SAP Help - Billing Document - Read, Cancel, GetPDF
SAP Help - Read Billing Document
Keywords
API_BILLING_DOCUMENT_SRV, filter, A_BillingDocumentItemText, Item Partner, A_BillingDocument, Billing Document Header, API, customer project, BillingDocumentItem , KBA , SD-BIL-IV-IF-2CL , External Billing (Public Cloud) , How To