DB table in ER9/001:

cube view:

@EndUserText.label: 'Jerry cube view'
@Analytics.dataCategory: #CUBE
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck:#CHECK
@AbapCatalog.sqlViewName: 'zprdcube'
define view Z_C_Prod_Cube as select from zprd_query{
   key zprd_query.prod_id,
  zprd_query.prod_text,
  @DefaultAggregation: #MAX
  zprd_query.quantity
}    
Copy the code

query view

@EndUserText.label: 'Jerry query verification'
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@AccessControl.authorizationCheck:#NOT_ALLOWED
@AbapCatalog.sqlViewName: 'zprdquery'
@OData.publish: true
define view Z_C_Product as select from Z_C_Prod_Cube {
  key Z_C_Prod_Cube.prod_id,
  Z_C_Prod_Cube.prod_text,
  @DefaultAggregation: #MAX
  Z_C_Prod_Cube.quantity
}      
Copy the code

Test on ER9/001 using the following ABAP code:

data: lt_result TYPE TABLE OF Z_C_Prod_Cube,
      lv_max TYPE int4,
      lv_max2 TYPE int4.
select * INTO TABLE @lt_result FROM Z_C_Prod_Cube.

SELECT max( quantity ) FROM Z_C_Prod_Cube INTO @lv_max.

SELECT max( quantity ) FROM zprd_query INTO @lv_max2.
BREAK-POINT.
Copy the code

For more of Jerry’s original articles, please follow the public account “Wang Zixi “: