‎2025 Mar 21 3:52 PM - edited ‎2025 Mar 21 4:02 PM
Hello, following an approach without table function to see value help in CDS view for QueryBrowser in Fiori:
1)
@AbapCatalog.sqlViewName: 'ZCDSVSOITEST1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'test for valuehelp'
define view ZCDSV_SALESOI_TEST1 as select from zddxxx
{
plant
}2) As Cube:
@AbapCatalog.sqlViewName: 'ZCDSVTESTHIST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@Analytics.dataCategory: #CUBE
@EndUserText.label: 'Hisotry'
@ObjectModel.query.implementedBy: 'ABAP:ZCL_VH'
define view ZCDSV_TEST_HIST as select from ZCDSV_SALESOI_TEST1
{
plant
}3) Query view with simple filter:
@AbapCatalog.sqlViewName: 'ZCDSVTESTQ'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@OData.publish: true
@EndUserText.label: 'q'
define view ZCDSV_TEST_Q as select from ZCDSV_TEST_HIST
{
@Consumption.filter: {selectionType: #SINGLE, multipleSelections: true, mandatory: true}
plant
}
So as usual i see the value help and values:
Now the Problem case, I need to use an RANK over function which is possible only in native sql so table function with an abap class. So I define the ZTable:
@ClientHandling.type: #CLIENT_DEPENDENT
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Test for valuehelp'
define table function ZTABLE_TEST
with parameters @Environment.systemField: #CLIENT clnt :abap.clnt
returns {
client : abap.clnt;
plant : abap.char(4); --char4
}
implemented by method ZCL_VH=>VH;Then as usual we use amdp and implement the query. For simplicity I query only plant which is sufficient for this example. Abap class:
CLASS zcl_vh DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
CLASS-METHODS:
VH FOR TABLE FUNCTION ZTABLE_TEST.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_vh IMPLEMENTATION.
METHOD VH
BY DATABASE FUNCTION
FOR HDB
LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
USING ZCDSVSOITEST1.
itab_coo1 =
SELECT
'100' as client,
plant
FROM ZCDSVSOITEST1;
RETURN SELECT * FROM :itab_coo1;
ENDMETHOD.
ENDCLASS.Now I want to query the ZTable so we adjust the history cds from before..:
@AbapCatalog.sqlViewName: 'ZCDSVTESTHIST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@Analytics.dataCategory: #CUBE
@EndUserText.label: 'Hisotry'
@ObjectModel.query.implementedBy: 'ABAP:ZCL_VH'
define view ZCDSV_TEST_HIST as select from ZTABLE_TEST(clnt:'100')
{
plant
}
Query view: Here I tried several approaches from associations to creating a search help in the dictionary nothing works. I left all the statement as comments so you can see the approach.
@AbapCatalog.sqlViewName: 'ZCDSVTESTQ'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@OData.publish: true
@EndUserText.label: 'q'
define view ZCDSV_TEST_Q as select from ZCDSV_TEST_HIST
association [0..1] to ZZ_BP_VALUEH as _countrytext on $projection.plant = _countrytext.plant
{
@Consumption.filter: {selectionType: #SINGLE, multipleSelections: true, mandatory: true}
-- @Consumption.valueHelp: '_countrytext'
-- @Consumption.valueHelpDefinition: [{entity: { name: 'ZCDSV_SALESOI_TEST1', element: 'plant' }}]
-- @Consumption.valueHelpDefinition: [{entity: { name: '_countrytext',
-- element: 'plant' }}]
@Consumption.valueHelpDefinition: [{ entity: {name: 'ZZ_TEST_VH', element: 'plant' } }]
/*@Consumption.valueHelpDefinition:
[{ entity: { name : 'ZCDSV_SALESOI_ TEST1' , element: 'plant' } ,
additionalBinding: [{ element: 'plant',
localConstant: 'plant', usage: #FILTER }]
, distinctValues: true
}]*/
-- @ObjectModel.text.association: '_countrytext'
-- .defaultSearchElement: true
plant,
_countrytext
}
@AbapCatalog.sqlViewName: 'ZZBPVALUEH'
@ObjectModel.dataCategory: #TEXT
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.supportedCapabilities: [#SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE, #CDS_MODELING_ASSOCIATION_TARGET, #LANGUAGE_DEPENDENT_TEXT]
@Search.searchable: true
@VDM.viewType: #BASIC
@EndUserText.label: 'Value Help View for Business Partner'
define view ZZ_BP_VALUEH as select distinct from zddxxx
{
@Semantics.text: true
@search.defaultSearchElement: true
key plant
}
The result is always the same without value help so i need to know the values beforehand. If I use a cds view as value help association or the dictionary search help.
Here the search help in the dictionary for which I can do also a test. Below you can see it works.
I cannot understand, because as soon as I use a table function the information seams to be lost as without it works perfectly. But on the other side the information is there an accessible everything is active (association or dictionary search help). I think it is a matter of putting the right annotations in the query view but i tried so many approaches.
I am very thankful for any help!
Request clarification before answering.
| User | Count |
|---|---|
| 11 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.