Skip to content

Instantly share code, notes, and snippets.

@ilyakaznacheev
Created February 25, 2019 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyakaznacheev/3aefa1006b5ec48c9c693704ca0bec36 to your computer and use it in GitHub Desktop.
Save ilyakaznacheev/3aefa1006b5ec48c9c693704ca0bec36 to your computer and use it in GitHub Desktop.
@AbapCatalog.sqlViewName: 'ZTEST_VSHOP'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #BASIC
@EndUserText.label: 'Shop Info'
define view Ztest_I_Shop
as select from ztest_shop
association [*] to Ztest_I_ShopText as _Text on _Text.ShopID = $projection.ShopID
association [*] to Ztest_I_ShopProducts as _Products on _Products.ShopID = $projection.ShopID
association [*] to Ztest_I_ShopSalesHistory as _SalesHistory on _SalesHistory.ShopID = $projection.ShopID
{
@ObjectModel.text.association: '_Text'
@ObjectModel.foreignKey.association:[ '_Products', '_SalesHistory']
key shop_id as ShopID,
@Semantics.address.label: true
address as Address,
_Text,
_Products,
_SalesHistory
}
@AbapCatalog.sqlViewName: 'ZTEST_VSHOPPROD'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #BASIC
@EndUserText.label: 'Products in shop'
define view Ztest_I_ShopProducts
as select from ztest_shop_prod
association [1..1] to I_Material as _Material on _Material.Material = $projection.Material
association [1..1] to Ztest_I_Shop as _Shop on _Shop.ShopID = $projection.ShopID
{
@ObjectModel.foreignKey.association: '_Shop'
key shop_id as ShopID,
@ObjectModel.foreignKey.association: '_Material'
key matnr as Material,
@Semantics.amount.currencyCode: 'Currency'
price as Price,
@Semantics.currencyCode: true
currency as Currency,
amount as AvailableAmount,
_Material,
_Shop
}
@AbapCatalog.sqlViewName: 'ZTEST_VSHOPHIST'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #BASIC
@EndUserText.label: 'Sales history of the shop'
define view Ztest_I_ShopSalesHistory
as select from ztest_shop_hist
association [1..1] to I_Material as _Material on _Material.Material = $projection.Material
association [1..1] to Ztest_I_Shop as _Shop on _Shop.ShopID = $projection.ShopID
{
@ObjectModel.foreignKey.association: '_Shop'
key shop_id as ShopID,
@ObjectModel.foreignKey.association: '_Material'
key matnr as Material,
key timestamp as OperationDateTime,
amount as Amount,
_Material,
_Shop
}
@AbapCatalog.sqlViewName: 'ZTEST_VSHOPTEXT'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #BASIC
@EndUserText.label: 'Shop Texts'
@ObjectModel.dataCategory: #TEXT
@ObjectModel.representativeKey: 'ShopID'
define view Ztest_I_ShopText
as select from ztest_shop_t
{
@Semantics.language: true
key spras as Language,
key shop_id as ShopID,
@Semantics.text: true
text as Text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment