0% found this document useful (0 votes)
8 views4 pages

CDS View with Parameter

The document outlines the definitions of several composite views related to contractor inventory analysis in a database, including ZMM_CON_INV, ZMM_I_CONINV_1, and ZMM_I_CONINV2. Each view aggregates and processes inventory data, calculating quantities and values based on various conditions. The views utilize SQL annotations for optimization and access control, and they are designed to provide analytical insights into inventory management.

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)
8 views4 pages

CDS View with Parameter

The document outlines the definitions of several composite views related to contractor inventory analysis in a database, including ZMM_CON_INV, ZMM_I_CONINV_1, and ZMM_I_CONINV2. Each view aggregates and processes inventory data, calculating quantities and values based on various conditions. The views utilize SQL annotations for optimization and access control, and they are designed to provide analytical insights into inventory management.

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/ 4

CDS View with Parameter

1. Composite View – ZMM_CON_INV


@AbapCatalog.sqlViewName: 'ZMMI_CON_INV'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Contractor Inventory Analysis'
@VDM.viewType : #COMPOSITE
@Analytics.dataCategory: #CUBE
define view ZMM_CON_INV
as select from nsdm_v_mseg as mseg
inner join t001w on mseg.werks = t001w.werks
left outer join mara on mseg.matnr = mara.matnr
inner join t023t on mara.matkl = t023t.matkl
and t023t.spras = $session.system_language

{
key mseg.matnr as matnr,
key mseg.werks as werks,
t001w.name1 as name1,
budat_mkpf as budat,
mara.matkl as matkl,
t023t.wgbez as wgbez,
shkzg as shkzg,
menge as menge,
cast(salk3 as abap.dec(13,3) ) as salk3,
cast(lbkum as abap.dec(13,3) ) as lbkum,
cast(dmbtr as abap.dec(13,3) ) as dmbtr
// case when dmbtr is null then div( salk3, lbkum ) * menge else dmbtr
// end as dmbtr
// case when shkzg = 'S' then menge else 0 end as qty_in,
// case when shkzg = 'H' then menge else 0 end as qty_out,
// case when shkzg = 'S' then dmbtr else 0 end as val_in,
// case when shkzg = 'H' then dmbtr else 0 end as val_out
}

where
lgort = '0003'
// and xauto = ' '

//group by
// mseg.matnr,
// mseg.werks,
// name1,
// mara.matkl,
// t023t.wgbez,
// budat_mkpf,
// menge,
// salk3
// dmbtr
2. Composite View - ZMM_I_CONINV_2
@AbapCatalog.sqlViewName: 'ZMMI_COINV_2'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Contractor Inventory Analysis'
@VDM.viewType : #COMPOSITE
@Analytics.dataCategory: #CUBE
define view ZMM_I_CONINV_2
as select from ZMM_CON_INV
{
key matnr,
key werks,
name1,
budat,
matkl,
wgbez,
shkzg,
menge,
salk3,
lbkum,
dmbtr,
case when lbkum <> 0 then div( salk3 , lbkum ) * menge else 0 end as
dmbtr2

3. Composite View - ZMM_I_CONINV_3


@AbapCatalog.sqlViewName: 'ZMMI_COINV_3'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Contractor Inventory Analysis'
@VDM.viewType : #COMPOSITE
@Analytics.dataCategory: #CUBE
define view ZMM_I_CONINV_3 as select from ZMM_I_CONINV_2 {
key matnr,
key werks,
name1,
budat,
matkl,
wgbez,
shkzg,
menge,
salk3,
lbkum,
case when dmbtr = 0 then dmbtr2 else dmbtr end as dmbtr1
// dmbtr2
}
4. Composite View - ZMM_I_CONINV_1
@AbapCatalog.sqlViewName: 'ZMM_ICOINV_1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Contractor Inventory Analysis'
@VDM.viewType : #COMPOSITE
@Analytics.dataCategory: #CUBE
define view ZMM_I_CONINV_1 as select from ZMM_I_CONINV_3{
key matnr,
key werks,
name1,
budat,
matkl,
wgbez,
sum( case when shkzg = 'S' then menge else 0 end ) as qty_in,
sum( case when shkzg = 'H' then menge else 0 end ) as qty_out,
sum( case when shkzg = 'S' then dmbtr1 else 0 end ) as val_in,
sum( case when shkzg = 'H' then dmbtr1 else 0 end ) as val_out
}
group by
matnr,
werks,
name1,
budat,
matkl,
wgbez

5. Composite View - ZMM_CON_INV1


@AbapCatalog.sqlViewName: 'ZMMI_CON_INV1'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Contractor Inventory Analysis'
@VDM.viewType : #COMPOSITE
@Analytics.dataCategory: #CUBE
define view ZMM_CON_INV1
as select from ZMM_I_CONINV_1
{
key matnr,
key werks,
name1,
budat,
matkl,
wgbez,
qty_in,
qty_out,
val_in,
val_out,
qty_in - qty_out as menge,
val_in - val_out as dmbtr
}
6. Consumption View - ZMM_I_CONINV2
@AbapCatalog.sqlViewName: 'ZMMI_COINV2'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Inventory 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_I_CONINV2
as select from ZMM_CON_INV1

{
key matnr,
key werks,
name1,
budat,
matkl,
wgbez,
@DefaultAggregation: #SUM
qty_in,
@DefaultAggregation: #SUM
qty_out,
@DefaultAggregation: #SUM
val_in,
@DefaultAggregation: #SUM
val_out,
// @DefaultAggregation: #SUM
// menge,
// @DefaultAggregation: #SUM
// dmbtr,
@DefaultAggregation: #SUM
menge as closing_qty, //(menge + qty_in ) - qty_out
@DefaultAggregation: #SUM
dmbtr as closing_val //(dmbtr + val_in ) - val_out

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy