Skip to Content
1
Jan 14, 2016 at 10:46 AM

ABAP CDS to UI5 Smart table. Annotations issue

2123 Views

I created an abap cds view with annotations . SYSTEM = 7.50.

@AbapCatalog.sqlViewName: 'z_cds_test_2'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Test 2 CDS'
@OData.publish: true
define view ZMYFLIGHTS2 
    
    as select from spfli
    association [1..1] to scarr as spfli_scarr
    on spfli.carrid = spfli_scarr.carrid
    {  
      
       @UI.selectionField: [ { position: 10 } ]
       
       @UI.lineItem: [ { position: 10 } ]
       key spfli.carrid as id,
       
       @UI.lineItem: [ { position: 20 } ]
       key spfli_scarr.carrname as carrier,
       
       @UI.lineItem: [ { position: 40 } ]
       key spfli.connid as flight,
       
      
       @EndUserText:{ quickInfo:'Some info22' } 
       @UI.lineItem: [ { position: 50 } ]
       spfli.cityfrom as departure, 
       
       @UI.lineItem: [ { position: 60 } ]
       spfli.cityto as destination 
    }

I can see the GW service is connected to a annotation model and the annotation model can be reached through:

.../sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations(TechnicalName='ZMYFLIGHTS2_CDS_VAN',Version='0001')/$value

For the UI5 part i created a simple test app:

Controller

var oModel, oView;
  oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/zmyflights2_cds", true);
  //oModel.setCountSupported(false);
  oView = this.getView();
  oView.setModel(oModel);

View

<smartTable:SmartTable id="mySmartTable" 
       entitySet="ZMYFLIGHTS2" 
       smartFilterId="smartFilterBar" 
       tableType="Table" 
       useExportToExcel="true" 
       useVariantManagement="false" 
       useTablePersonalisation="false" 
       header="Flights" 
       showRowCount="true" 
       enableAutoBinding="true">
  <!-- layout data used to make the table growing but the filter bar fixed -->
  <smartTable:layoutData>
  <FlexItemData growFactor="1"/> 
  </smartTable:layoutData>  
  </smartTable:SmartTable>

I UI5 i get an error:

Select at least one column to perform the search

What am I missing here?

Any help will be appreciated.

Regards,

Bert