on 03-23-2020 7:21 PM
Does anyone know how to dynamically set the @UI.Hidden annotation using CDS Annotations? I can do it with XML Annotations (<Annotation Term="UI.Hidden" Path="anXfeld">) and it works perfectly. Can't figure out how to do it with CDS. Seems @UI.Hidden can't use a path?
<Annotations Target="Metadata.xDSNxC_CM_CONTType">
<Annotation Term="UI.FieldGroup" Qualifier="cont_checkboxes">
<Record Type="UI.FieldGroupType">
<PropertyValue Property="Data">
<Collection>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="fundingcontrol"/>
<PropertyValue Property="Label" String="Funding Control"/>
</Record>
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="extfundingsource"/>
<PropertyValue Property="Label" String="Ext Funding"/>
<Annotation Term="UI.Hidden" Path="fundingcontrol"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
I figured this out by reverse engineering the generated XML annotations and comparing them to XML that I knew worked.
for somereason adding @UI.hidden: #(fieldname) didn't work putting it directly on the field. I had to add it to the fieldgroup annotation i.e.
@UI.fieldGroup: [{ label: 'Funding Control',
qualifier: 'cont_checkboxes',
position: 130,
hidden: #(modcontrol) }]
fundingcontrol;
This will hide fundingcontrol if modcontrol is checked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for sharing, Paul. It's some hidden/unreleased feature i guess 🙂
Such a simple and helpful solution.
Totally worked for me !
Thanks.
Hi Paul,
Thank you very much for this post.
I would like to add that "modcontrol" must be of type boolean.
I first tried it with
virtual HideLink : abap.char( 1 ),
but this did not work.
Only after having changed the definition of my virtual field to
virtual HideLink : abap_boolean,
the field (that contains a URL) was hidden.
Hi Andre Fischer,
do you know what the reason is that this is not done via the instance features of RAP, like read only etc.?
I find this rather impractical/unattractive that in the worst case I need a virtual element for each field which I want to hide, when they have different conditions.
Thanks in advance, Florian
Hey Florian,
did you found an answer for your question? I'm also curious why I can't use the dynamic feature control for hiding fields. It is really impractical to implement field control with SADL/virtual elements to hide fields and to implement the dynamic feature control for make fields read-only or mandatory. We have over 100 fields.
Did you get it working with virtual elements to hide a column in a table inside an ObjectPage? I didn't find any solution so far for this problem. It is only working for me to hide field inside the object page.
Thanks & Cheers
Andreas
User | Count |
---|---|
74 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.