SAPUI5 智能表不显示初始字段

SAPUI5 Smartable not showing the inital fields

我正在尝试构建一个简单的智能表,使用带注释的 CDS,我希望列会自动显示,但不会自动显示任何列或选择字段。当我尝试使用 fiori 元素创建报告时,它工作正常,但不适用于我的 freestyle 应用程序和 smarttable。缺少什么?

@AbapCatalog.sqlViewName: 'ZTEST_CDS_SHP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Test Shipment view'
@VDM.viewType: #CONSUMPTION
@VDM.private:false
@Search.searchable: true
@UI.headerInfo: { typeName: 'Order', typeNamePlural: 'Orders' }
@OData.publish: true
define view ZTESTV_CDS_SHP as select from ZRDCV_CDS_SHIPMENT 

association [0..1] to ZTESTV_CDS_DCHELP as _DCValueHelp      on $projection.DcSite = _DCValueHelp.Werks
association [0..1] to makt  as _ArticleValueHelp on $projection.Article = _ArticleValueHelp.matnr and _ArticleValueHelp.spras = $session.system_language 

{

@Search.defaultSearchElement: true
@UI.selectionField: [ { position: 10 } ]
@UI.lineItem: [ { position: 10, importance: #HIGH } ]
key    shipment             as Shipment,


@UI.selectionField: [ { position: 20 } ]
@UI.lineItem: [ { position: 20, importance: #HIGH } ]
key    exidv as Hu,
....

这里是 XML 视图

<mvc:View
    controllerName="ns.shipment1.controller.Worklist"
    xmlns="sap.m"
    xmlns:mvc="sap.ui.core.mvc"
    xmlns:semantic="sap.f.semantic"
    xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
    xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
    xmlns:smartTable="sap.ui.comp.smarttable">

    <semantic:SemanticPage
        id="page"
        headerPinnable="false"
        toggleHeaderOnTitleClick="false">

        <semantic:titleHeading>
            <Title
                text="{i18n>worklistTitle}"
                level="H2"/>
        </semantic:titleHeading>

        <semantic:content>

        <!-- use this to make the table occupy the available screen height -->
        <VBox fitContainer="true">

            <!-- FILTER BAR ******************************************** -->
            <smartFilterBar:SmartFilterBar 
            id="smartFilterBar" 
            entitySet="ZTESTV_CDS_SHP" 
            persistencyKey="SmartFilter_Explored" 
            basicSearchFieldName="Shipment" 
            enableBasicSearch="true" 
            visible="true"
            considerSelectionVariants="true"
            showFilterConfiguration="true">
            </smartFilterBar:SmartFilterBar>


            <!-- SMART TABLE ******************************************** -->
            <smartTable:SmartTable 
            id="ShipmentTable" 
            entitySet="ZTESTV_CDS_SHP" 
            smartFilterId="smartFilterBar" 
            tableType="Table" 
            useExportToExcel="true" 
            beforeExport="onBeforeExport" 
            useVariantManagement="true" 
            useTablePersonalisation="true" 
            header="Shipment Items" 
            showRowCount="true" 
            persistencyKey="SmartTableAnalytical_Explored" 
            enableAutoBinding="true" 
            class="sapUiResponsiveContentPadding"
            editTogglable="false" 
            app:useSmartField="true" 
            app:useSmartToggle="true">
            </smartTable:SmartTable>


        </VBox>

实际上,我在/IWFND/MAINT_SERVICE事务中找到了Annotation模型,通过选择服务,然后是服务实现按钮和注解模型按钮。

我在设置中添加了 annotations 属性 以及对包含注释模型的数组的引用。请注意,在我的例子中,注释模型是 ZTESTV_CDS_SHP_CDS_VAN,通常以 ANNO_MDL.

结尾
{
    "dataSources": {
        "mainService": {
            "uri": "/sap/opu/odata/sap/ZTESTV_CDS_SHP_CDS/",
            "type": "OData",
            "settings": {
                "odataVersion": "2.0",
                "annotations": [
                    "ZTESTV_CDS_SHP_CDS_ANNOTATION"
                ],
                "localUri": "localService/metadata.xml"
            }
        },
        "ZTESTV_CDS_SHP_CDS_ANNOTATION": {
            "uri": "/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations(TechnicalName='ZTESTV_CDS_SHP_CDS_VAN',Version='0001')/$value/",
            "type": "ODataAnnotation"
        }
    }
}

清单截图: