on 02-02-2023 10:08 AM
Hi Everyone,
Is it possible to make the virtual element calculated field available as a Selection Field in UI as well?
The UI.SELECTIONFIELD doesn’t work on virtual element field.
Can anyone help me know if it’s possible and how?
Regards,
Ehtram
Have a look in the documentation:
define view entity CDSProjView
as projection on CDSEntity
{
key elem_1 as Element1,
[@EndUserText.label: 'Element Label']
[@EndUserText.quickInfo: 'Quick Information']@ObjectModel.virtualElementCalculatedBy: 'ABAP:ABAPClass'
@ObjectModel.filter.transformedBy: 'ABAP:ABAPClass'
@ObjectModel.sort.transformedBy: 'ABAP:ABAPClass'
virtual ElemName : {DataElement | ABAPType } ,
...
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi marianzeis
I am actually looking to use virtual element fields selection fields whereas in the example provided in documentation, we apply filter on the cds view field. After checking similar questions on the forum, I guess it’s not yet possible to use transient field as a selection field. Let me know if i am wrong 😀
Hi eihtu ,
thats strange because i was using this approach just this week.
It´s a little bit different use case, but i was using this blog and was using it as selection field:
Hi eihtu,
Following annotation is enough to display a Virtual Element as a Selection Field in UI:
@ObjectModel.filter.enabled: true
However, to write the logic to implement the Filter/Selection on the Virtual Element, you need following additional annotation:
@ObjectModel.filter.transformedBy: 'ABAP:<class_name>'
The <class_name> must have the Interface Method 'IF_SADL_EXIT_FILTER_TRANSFORM~MAP_ATOM' implemented.
Do Note: You cannot filter the Virtual Element values though. Using the Virtual Element filter/selection input, you can apply filter on other persisted fields only.
Filtering the Virtual Element values will give you a dump with the following error:
'Element <virtual_element> is calculated in ABAP and must not be used for DB query'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
11 | |
10 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.