Symptom
How to filter by to_SlsPrcgConditionRecord/LastChangeDateTime when using ODATA interface API_SLSPRICINGCONDITIONRECORD_SRV.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- In service API_SLSPRICINGCONDITIONRECORD_SRV, query entity A_SlsPrcgCndnRecdValidity with $expand=to_SlsPrcgConditionRecord.
- Apply $filter conditions on A_SlsPrcgCndnRecdValidity properties (for example, ConditionType and SalesOrganization) and include to_SlsPrcgConditionRecord/LastChangeDateTime in $select.
- Attempt to add a filter on to_SlsPrcgConditionRecord/LastChangeDateTime within the same request together with filters on A_SlsPrcgCndnRecdValidity.
Cause
- The service has a documented constraint: it does not allow combining filters from the Condition Records entity (A_SlsPrcgConditionRecord) and the Condition Record Validity entity (A_SlsPrcgCndnRecdValidity) in a single request when using $expand. Therefore, filtering A_SlsPrcgCndnRecdValidity (for example, SalesOrganization) and to_SlsPrcgConditionRecord/LastChangeDateTime together is not supported.
Resolution
Filter A_SlsPrcgConditionRecord/LastChangeDateTime with URI like below:
/sap/opu/odata/sap/API_SLSPRICINGCONDITIONRECORD_SRV/A_SlsPrcgConditionRecord?$filter=(ConditionType eq '...') and (LastChangeDateTime gt datetimeoffset'YYYY-MM-DDThh:mm:ssZ')&$expand=to_SlsPrcgCndnRecdValidity&$select=ConditionRecord,ConditionType,ConditionRateValue,ConditionRateValueUnit,LastChangeDateTime,to_SlsPrcgCndnRecdValidity/ConditionRecord,to_SlsPrcgCndnRecdValidity/ConditionValidityStartDate,to_SlsPrcgCndnRecdValidity/ConditionValidityEndDate,to_SlsPrcgCndnRecdValidity/Material,to_SlsPrcgCndnRecdValidity/SalesOrganization,to_SlsPrcgCndnRecdValidity/DistributionChannel
See Also
Keywords
API_SLSPRICINGCONDITIONRECORD_SRV, A_SlsPrcgConditionRecord, A_SlsPrcgCndnRecdValidity, to_SlsPrcgConditionRecord, LastChangeDateTime, $filter, $expand, delta extraction, pricing condition records, OData filter, nested property filter, SalesOrganization filter, datetimeoffset, condition record validity, public cloud , KBA , SD-MD-CM-2CL , Conditions and Condition Maintenance(Public Cloud) , Problem
SAP Knowledge Base Article - Public