0% found this document useful (0 votes)
54 views5 pages

Simple CDS View With Composite and Consumption

The document outlines the definition of two composite views, ZMM_PURC_ANALYSIS_PO and ZMM_PURC_ANALYSIS_PO1, which analyze purchase orders by joining multiple tables and aggregating relevant data. Additionally, it describes a consumption view, ZMM_PURANALYSIS_PO_CON, that presents the data from the composite views in a user-friendly format with detailed labels for each field. The views are designed for analytics purposes and include various metadata annotations for performance and access control.

Uploaded by

sakshi nikam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views5 pages

Simple CDS View With Composite and Consumption

The document outlines the definition of two composite views, ZMM_PURC_ANALYSIS_PO and ZMM_PURC_ANALYSIS_PO1, which analyze purchase orders by joining multiple tables and aggregating relevant data. Additionally, it describes a consumption view, ZMM_PURANALYSIS_PO_CON, that presents the data from the composite views in a user-friendly format with detailed labels for each field. The views are designed for analytics purposes and include various metadata annotations for performance and access control.

Uploaded by

sakshi nikam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Simple CDS View with Composite and

Consumption

1. Composite View - ZMM_PURC_ANALYSIS_PO


@AbapCatalog.sqlViewName: 'ZMM_PO'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'PO Purchase Analysis'
@VDM.viewType: #COMPOSITE
@Analytics.dataCategory: #CUBE
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking:#BLOCKED_DATA_EXCLUDED
define view zmm_purc_analysis_po
as select from ekko
left outer join ekpo on ekko.ebeln = ekpo.ebeln
left outer join mara on ekpo.matnr = mara.matnr
left outer join t023t on mara.matkl = t023t.matkl
left outer join t001w on ekpo.werks = t001w.werks
left outer join t161t on ekko.bsart = t161t.bsart
and t161t.spras = 'E'
and t161t.bstyp = 'F'
left outer join t001 on ekko.bukrs = t001.bukrs
left outer join t16fs on ekko.frggr = t16fs.frggr
and ekko.frgsx = t16fs.frgsx
left outer join lfa1 on ekko.lifnr = lfa1.lifnr

key ekko.ebeln, // as PurchasingDoc,


ekko.bukrs, // as CompanyCode,
t001.butxt,
ekko.bstyp, // as DocCategory,
ekko.bsart, // as DocumentType,
t161t.batxt,
ekko.aedat, // as CreatedOn,
ekko.ernam, // as CreatedBy,
ekpo.ebelp, // as Item,
ekpo.uniqueid, // as DocumentItem,
ekpo.txz01, // as ShortText,
ekpo.matnr, // as material,
ekpo.werks, // as Plant,
ekpo.lgort, // as StorLoc,
ekpo.matkl, // as MaterialGroup,
@DefaultAggregation: #SUM
ekpo.menge, // as Quantity,
ekpo.meins, // as UnitofMeasure,
@DefaultAggregation: #SUM
ekpo.netwr, // as NetValue,
@DefaultAggregation: #SUM
ekpo.brtwr, // as GrossValue,
@DefaultAggregation: #SUM
ekpo.netpr, // as NetPrice,
ekpo.bprme, // as OrderPriceUn,
ekpo.ko_prctr, // as ProfitCenter
t023t.wgbez,
t001w.name1,
$session.system_date as sys_date,
ekko.lifnr,
lfa1.name1 as lifnr_desc,

t16fs.frgc1,
t16fs.frgc2,
t16fs.frgc3,
t16fs.frgc4,
ekko.frggr,
ekko.frgzu,

case
when ekko.frgzu = ''
then t16fs.frgc1
when ekko.frgzu = 'X'
then t16fs.frgc2
when ekko.frgzu = 'XX'
then t16fs.frgc3
when ekko.frgzu = 'XXX'
then t16fs.frgc4
end as code

}
where
ekko.procstat = '03'
and ekko.bstyp = 'F'
and ekpo.loekz = ' '
and ekko.memory = ''

2. Composite View - ZMM_PURC_ANALYSIS_PO1


@AbapCatalog.sqlViewName: 'ZMM_PO1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'PO Pending Purchase Analysis'
@VDM.viewType: #COMPOSITE
@Analytics.dataCategory: #CUBE
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions: true
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking:#BLOCKED_DATA_EXCLUDED
define view zmm_purc_analysis_po1
as select from zmm_purc_analysis_po
inner join t16fd on zmm_purc_analysis_po.code = t16fd.frgco
and zmm_purc_analysis_po.frggr = t16fd.frggr

key ebeln,
bukrs,
butxt,
bstyp,
bsart,
batxt,
aedat,
ernam,
ebelp,
uniqueid,
txz01,
matnr,
werks,
lgort,
matkl,
@DefaultAggregation: #SUM
menge,
meins,
@DefaultAggregation: #SUM
netwr,
@DefaultAggregation: #SUM
brtwr,
@DefaultAggregation: #SUM
netpr,
bprme,
ko_prctr,
wgbez,
name1,
sys_date,
dats_days_between(aedat, sys_date) as NoofDays,
code,
t16fd.frgct,
lifnr,
zmm_purc_analysis_po.lifnr_desc

3. Consumption View - ZMM_PURANALYSIS_PO_CON

@AbapCatalog.sqlViewName: 'ZMM_PO_CON'
//@AbapCatalog.compiler.compareFilter: true
//@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Purchase Analysis for PO'
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.buffering.status: #NOT_ALLOWED
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@OData.publish: true
define view ZMM_PURANALYSIS_PO_CON
as select from zmm_purc_analysis_po1 //zmm_purc_analysis_po

@EndUserText.label: 'Purchasing Doc'


key ebeln,
@EndUserText.label: 'Company Code'
bukrs,
@EndUserText.label: 'Company Code Desc'
butxt,
@EndUserText.label: 'Doc Category'
bstyp,
@EndUserText.label: 'Document Type'
bsart,
@EndUserText.label: 'Document Type Desc'
batxt,
@EndUserText.label: 'Created On'
aedat,
@EndUserText.label: 'Created By'
ernam,
@EndUserText.label: 'Item'
ebelp,
@EndUserText.label: 'Document Item'
uniqueid,
@EndUserText.label: 'Material'
matnr,
@EndUserText.label: 'Material Desc'
txz01,
@EndUserText.label: 'Plant'
werks,
@EndUserText.label: 'Plant Desc'
name1,
@EndUserText.label: 'Storage Loc'
lgort,
@EndUserText.label: 'Material Group'
matkl,
@EndUserText.label: 'Material Grp Desc.'
wgbez,
@EndUserText.label: 'Quantity'
menge,
@EndUserText.label: 'UOM'
meins,
@EndUserText.label: 'Net Value'
netwr, //
@EndUserText.label: 'Gross Value'
brtwr,
@EndUserText.label: 'Net Price'
netpr,
@EndUserText.label: 'Order Price Unit'
bprme,
@EndUserText.label: 'Profit Center'
ko_prctr,
@EndUserText.label: 'No of Days Delayed'
NoofDays,
@EndUserText.label: 'Code'
code,
@EndUserText.label: 'Approver'
frgct,
@EndUserText.label: 'Vendor'
lifnr,
@EndUserText.label: 'Vendor Desc'
lifnr_desc

You might also like