on 2024 Dec 18 9:02 PM
Hi guys,
When creating a CDS View with the purpose of using it as a Code List in a Custom Field I found the following:
If I create the CDS view as a View Entity, it's not shown in the "Code List based on CDS View".
This is the code I'm using to create the CDS View (I Released it for Use in Key User Apps (C1 Contract) )
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Freight Codes'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.dataCategory: #VALUE_HELP
@Search.searchable: true
@ObjectModel.representativeKey: 'FreightCode'
define view entity Y43MM_VH_FreightCode
as select from y43mm_frgtcode
{
@search.defaultSearchElement: true
@search.fuzzinessThreshold: 0.8
@search.ranking: #LOW
key freight_code as FreightCode,
@search.defaultSearchElement: true
@search.fuzzinessThreshold: 0.8
@search.ranking: #LOW
freight_code_desc as FreightCodeDesc
}But if I change the CDS View to be a Custom Entity, the view is correctly shown in the "Code List based on CDS View"
@EndUserText.label: 'Freight Codes'
@ObjectModel.dataCategory: #VALUE_HELP
@Search.searchable: true
@ObjectModel.representativeKey: 'FreightCode'
@ObjectModel: {
query: {
implementedBy: 'ABAP:Y43TMCL_CE_FREIGHTCODE'
}
}
define custom entity Y43TM_VH_FREIGHTCODE
{
@search.defaultSearchElement: true
@search.fuzzinessThreshold: 0.8
@search.ranking: #LOW
key FreightCode: y43tmdt_freight_code;
@search.defaultSearchElement: true
@search.fuzzinessThreshold: 0.8
@search.ranking: #LOW
FreightCodeDesc: y43tmdt_freight_code_desc;
}As additional information:
Let me know if you have any information that could help me with this problem.
Thanks in advance.
Request clarification before answering.
The answer to my original question was given by @georg_wilhelm inside a comment of one of the other answers, his answer was: "currently one can only use Custom Entities as value help views for Key User Custom Fields. You can not use customer created view entities...even if you release them C1 for key users. We are aware of this gap and are already working on that."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Regarding the paging issue:
How to implement paging for a custom entity is described in https://help.sap.com/docs/btp/sap-abap-restful-application-programming-model/requesting-and-setting-...
There the following note is given: "If data is requested, the method set_data must be called. If the total number of records is requested, the method set_total_number_of_records must be called. Otherwise there will be an error during runtime. The io_response->set_data( ) method is only allowed to fill elements listed by io_request->get_requested_elements( ). System may react with a failure or a short dump if these rules aren't followed. In UI scenarios with Fiori Elements the total number of records is always requested by the UI."
Regarding the available CDS views:
The field type "Code List based on CDS View" and also the restrictions regarding available CDS views is explained here: https://help.sap.com/docs/SAP_S4HANA_CLOUD/0f69f8fb28ac4bf48d2b57b9637e81fa/acb2907f362944a5a9e1b5eb...
One can sum up the restrictions as follows: "You can either select a CDS-based view (Custom CDS View/SAP delivered CDS view released according to the C1 contract), or you can select a custom entity."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@georg_wilhelmCould you please confirm if value helps based con Custom Entities also limit the number of entries they can retrieve from the Database? I ask you this because my value help is showing only 132 characters even when my table contains 400 entries:
by checking the Network tab in the browser, I notice the Odata call is sending top=132 by default:
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I answer myself.
It seems the paging on the Custom Entity class must be handled in a different way when the caller is a value help. Or at least that's my understanding.
I had to call following method before performing paging:
io_response->set_total_number_of_records( LINES( lt_FreightCode_tab ) ).
By doing this, the Value Help now shows the correct total number of entries at the top and performs the paging correctly when I scroll down.
Update
Custom fields of type "Code List based on CDS View" must not reference custom CDS views, which use artefacts defined via ADT development. The key user extensibility concept guarantees lifecycle-stable extensions, which are upgrade-proof. But ADT artefacts are managed by customers and might contain errors which prevent an activation. Therefore, custom fields need to be decoupled from ADT development artefacts to ensure successful lifecycle-events.
The creation of the custom field is being prevented as long as the select CDS view itself or a view in a lower layer of the view stack, uses artefacts defined via ADT development.
I have same issue. Custom entity comes to list but cds views are not.
I copied one of the listed CDS views (for example C_BOMMaterialVH to ZC_BOMMaterialVH) and gives C1 contract but still not listed.
For second option, I try to create cds view which includes my Z view by using "Custom CDS View" app but it is still not listed.
Because there is a filter "Recommended Data Source". When remove that filter, my custom CDS view is listed. Then new cds view which starts with YY1 is listed custom field option
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello George,
I' m little bit confused.
My requirement is using a table ( which is maintable by customer in custom fiori app ) in custom field as value help.
on the other hand, I have to give authorization for "Custom Field App" to customer maintain to list. But I don' t want to.
At least, I have to use custom entity views.
Please let me know, if I' m wrong,
Thanks,
| User | Count |
|---|---|
| 14 | |
| 8 | |
| 6 | |
| 6 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.