SAP Knowledge Base Article - Public

3472856 - Set filter to get only the newest billing document through Billing Document API - SAP S/4HANA Cloud

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:

  1. Old billing document with previous billing amount
  2. Changed billing document with previous billing amount
  3. 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

  1. Create billing document in Customer Project (billing amount e.g. 5000€) 
  2. Create billing requirement, then create billing document 
  3. Delete billing document 
  4. Refuse billing requirement 
  5. Change billing amount to e.g. 3000€ in Customer Project 
  6. Create billing requirement and billing document again
  7. 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

SAP Help - Billing Document Header

SAP Help - Item Partner

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

Product

SAP S/4HANA Cloud Public Edition 2402