Message type: E = Error
Message class:  SADL_GW_DT_CDS - Messages CDS Checks 
Message number: 040
Message text: Composition association &1 must not be used with a filter.
Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of messages in the SAP system have a message text, however this is frequently insufficient to comprehend or resolve the problem.
To make things easier, more detailed information is frequently added to describe the issue, how to fix it, and the necessary steps or configuration modifications.
Unfortunately, there isn't any extra information in this error notice.
First, use our AnswerBot below to get a possible cause and solution (requires a premium subscription).
Also, review the in-depth Common Questions & Answers listed below; you could discover a solution there or be able to connect with others who have faced similar challenges.
You can also try searching the SAP support portal (support.sap.com) but you need a special user ID to access it. It is possible that an SAP support note exists that provides additional details about the mistake or even steps for fixing it.
The SAP error message SADL_GW_DT_CDS040 typically occurs in the context of Core Data Services (CDS) views when there is an issue with the way associations are being used in a query, particularly when filters are applied to a composition association.
Cause: The error message indicates that a composition association (which is a type of association that implies a strong ownership relationship between two entities) is being used in a way that is not allowed with a filter. In SAP CDS, composition associations cannot be filtered directly because they imply a strict relationship where the lifecycle of the child entity is tied to the parent entity.
Solution: To resolve this error, consider the following approaches: Review the Association: Check the definition of the composition association in your CDS view. Ensure that you are not trying to filter on the composition association directly. Instead, you may need to filter on the parent entity or use a
 Get instant SAP help. Sign up for our Free Essentials Plan.
Get instant SAP help. Sign up for our Free Essentials Plan. 
SADL_GW_DT_CDS039 The target of the composition association &1 must be a consumption view.
What causes this issue?  Within a transactional consumption CDS view, it is only possible to define a composition association to an item view that is ...
SADL_GW_DT_CDS038 Key fields must be identical to key fields in transactional CDS view.
What causes this issue?  The key fields in the consumption CDS view must be identical to the key fields in the transactional CDS view. All key fields ...
SADL_GW_DT_CDS041 Specialization &1 of composition association can only have &2 conditions.
Self-Explanatory Message Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of...
SADL_GW_DT_CDS042 Aggregation and grouping is not allowed in consumption CDS view.
Self-Explanatory Message Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of...
Click on this link to search all SAP messages.