03-18-2024 10:47 AM - edited 03-18-2024 10:47 AM
Hello experts,
There is a standard CDS view we would like to extend by adding a text field. We want to add a Material_Text field, which will contain the text of the existing field Material. Material would then have the annotation sap:text='Material_Text' in the OData metadata. We already have a text view properly setup.
If we were creating the view from scratch, it would be simple. We would just need to use:
{
...
@ObjectModel.text.association: '_Text'
matnr as Material,
_Text
}
But since we are trying to extend an existing view via, the code below fails:
extend view C_ConsumerView with ZC_CONSUMER
association [0..*] to I_MaterialText as _MaterialText on $projection.Material3 = _MaterialText.Material
{
@ObjectModel.text.association: '_MaterialText'
Material,
_MaterialText
}
as we get the "The name Material is not unique" error, as it tries to add a field that already exists. @ObjectModel.text.association or sap:text also not available via metadata extension
So what would be the correct way to approach this?
Best regards,
André
In my case, I just created a reference field out of Material like this -
extend view C_ConsumerView with ZC_CONSUMER
association [0..*] to I_MaterialText as _MaterialText on $projection.Material3 = _MaterialText.Material
{
@ObjectModel.text.association: '_MaterialText'
Material as Material_2,
_MaterialText
}
and showed this field instead of existing material field by creating a CUSTOMER layered metadata extension on top of existing CORE layered metadata extension.
This way the transactions will not be impacted as data is eventually be saved to the original material field and if it's a display report, we are already set.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello!
Thanks for the reply. I had tried this option too, but when I queried the entity, I got a SHORTDUMP:
The parser produced the error: The field "MATERIALNAME" does not have a corresponding field in the work area.
But good to know this could be an option. I will investigate further what went wrong.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.