V_COSS_PER_2_VIEW
COSS totals: all currencies/valuations - 2
V_COSS_PER_2_VIEW is a CDS View that provides data about "COSS totals: all currencies/valuations - 2" in SAP S/4HANA. It reads from 4 data sources (finsc_cmp_versnc, finsc_curtype, finsc_ld_cmp, tka09).
Data Sources (4)
| Source | Alias | Join Type |
|---|---|---|
| finsc_cmp_versnc | b | inner |
| finsc_curtype | c | inner |
| finsc_ld_cmp | m | inner |
| tka09 | v | inner |
Annotations (6)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | V_COSS_PER_2 | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| EndUserText.label | COSS totals: all currencies/valuations - 2 | view | |
| Metadata.ignorePropagatedAnnotations | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ObjectModel.usageType.serviceQuality | #P | view |
@AbapCatalog.sqlViewName: 'V_COSS_PER_2'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'COSS totals: all currencies/valuations - 2'
//@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.serviceQuality: #P
define view V_COSS_PER_2_VIEW as
select
-- key '00' as lednr,
key a.objnr,
key a.gjahr,
-- key '04' as wrttp,
key v.versn as versn,
key a.kstar,
-- key a.hrkft as hrkft,
key a.vrgng,
key a.uspob as uspob,
key a.beknz,
key a.twaer,
key a.rldnr,
key a.perio,
a.meinh,
-- value fields
case
when m.curtph <> c.curtype then 0
when b.wtgbtr = 'WSL' then wsl
when b.wtgbtr = 'WSL2' then wsl2
when b.wtgbtr = 'WSL3' then wsl3
else 0
end as wtgbtr,
case
when m.curtph <> c.curtype then 0
when ( a.xwbuk = '' ) and ( ( bstat = 'C' and co_osl <> 0 )
or ( bstat <> 'C' and rco_ocur <> '' ) )
then co_osl
when b.wogbtr = 'HSL' then hsl
when b.wogbtr = 'OSL' then osl
when b.wogbtr = 'VSL' then vsl
when b.wogbtr = 'BSL' then bsl
when b.wogbtr = 'CSL' then csl
when b.wogbtr = 'DSL' then dsl
when b.wogbtr = 'ESL' then esl
when b.wogbtr = 'FSL' then fsl
when b.wogbtr = 'GSL' then gsl
when b.wogbtr = 'KSL' then ksl
else 0
end as wogbtr, --- 1. CO_OSL; 2. HSL
case
when ( a.xwbuk = '' ) and ( ( bstat = 'C' and co_osl <> 0 )
or ( bstat <> 'C' and rco_ocur <> '' ) )
then rco_ocur
when b.wogbtr = 'HSL' then rhcur
when b.wogbtr = 'OSL' then rocur
when b.wogbtr = 'VSL' then rvcur
when b.wogbtr = 'BSL' then rbcur
when b.wogbtr = 'CSL' then rccur
when b.wogbtr = 'DSL' then rdcur
when b.wogbtr = 'ESL' then recur
when b.wogbtr = 'FSL' then rfcur
when b.wogbtr = 'GSL' then rgcur
when b.wogbtr = 'KSL' then rkcur
else ''
end as rocur,
case
when m.curtpk <> c.curtype then 0
when b.wkgbtr = 'KSL' then ksl
when b.wkgbtr = 'OSL' then osl
when b.wkgbtr = 'VSL' then vsl
when b.wkgbtr = 'BSL' then bsl
when b.wkgbtr = 'CSL' then csl
when b.wkgbtr = 'DSL' then dsl
when b.wkgbtr = 'ESL' then esl
when b.wkgbtr = 'FSL' then fsl
when b.wkgbtr = 'GSL' then gsl
when b.wkgbtr = 'HSL' then hsl
else 0
end as wkgbtr,
case
when m.curtpk <> c.curtype then 0
when b.wkfbtr = 'KFSL' then kfsl
when b.wkfbtr = 'KFSL2' then kfsl2
when b.wkfbtr = 'KFSL3' then kfsl3
else 0
end as wkfbtr,
case b.wkgbtr
when 'KSL' then rkcur
when 'OSL' then rocur
when 'VSL' then rvcur
when 'BSL' then rbcur
when 'CSL' then rccur
when 'DSL' then rdcur
when 'ESL' then recur
when 'FSL' then rfcur
when 'GSL' then rgcur
when 'HSL' then rhcur
else ''
end as rkcur,
rocur as racur,
rvcur,
rbcur,
rccur,
rdcur,
recur,
rfcur,
rgcur,
rhcur,
case --- Amount in Freely Defined Currency 1
when m.curtpo = c.curtype then osl
else 0
end as wagbtr,
case --- Amount in Freely Defined Currency 2
when m.curtpv = c.curtype then vsl
else 0
end as wvgbtr,
case --- Amount in Freely Defined Currency 3
when m.curtpb = c.curtype then bsl
else 0
end as wbgbtr,
case --- Amount in Freely Defined Currency 4
when m.curtpc = c.curtype then csl
else 0
end as wcgbtr,
case --- Amount in Freely Defined Currency 5
when m.curtpd = c.curtype then dsl
else 0
end as wdgbtr,
case --- Amount in Freely Defined Currency 6
when m.curtpe = c.curtype then esl
else 0
end as wegbtr,
case --- Amount in Freely Defined Currency 7
when m.curtpf = c.curtype then fsl
else 0
end as wfgbtr,
case --- Amount in Freely Defined Currency 8
when m.curtpg = c.curtype then gsl
else 0
end as wggbtr,
hsl as whgbtr,
case
when m.curtpk <> c.curtype then 0
when b.pagbtr = 'PSL' then psl
when b.pagbtr = 'PSL2' then psl2
when b.pagbtr = 'PSL3' then psl3
else 0
end as pagbtr,
case
when m.curtpk <> c.curtype then 0
when b.pafbtr = 'PFSL' then pfsl
when b.pafbtr = 'PFSL2' then pfsl2
when b.pafbtr = 'PFSL3' then pfsl3
else 0
end as pafbtr,
case
when m.curtpk = c.curtype then vmsl
else 0
end as megbtr,
case
when m.curtpk = c.curtype then vmfsl
else 0
end as mefbtr,
case
when m.curtpk = c.curtype then msl
else 0
end as mbgbtr,
case
when m.curtpk = c.curtype then mfsl
else 0
end as mbfbtr,
-- cast(a.muvflg as abap.int1) as muvflg,
a.bukrs as bukrs,
bstat
-----------------------------------------
from V_COSS_PER_1_VIEW as a
inner join tka09 as v on v.kokrs = a.kokrs --- not very good right now because to many records are temporarily calculated being aggregated in V_COSP_PER
inner join finsc_cmp_versnc as b on b.bukrs = a.bukrs
and b.versn = v.versn
and b.rldnr = a.rldnr
inner join finsc_curtype as c on c.valutyp = v.valutyp
inner join finsc_ld_cmp as m on m.rldnr = b.rldnr
and m.bukrs = a.bukrs
and ( c.curtype = m.curtph
or c.curtype = m.curtpk
or c.curtype = m.curtpo
or c.curtype = m.curtpv
or c.curtype = m.curtpb
or c.curtype = m.curtpc
or c.curtype = m.curtpd
or c.curtype = m.curtpe
or c.curtype = m.curtpf
or c.curtype = m.curtpg
)
;
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"V_COSS_PER_1_VIEW",
"FINSC_CMP_VERSNC",
"FINSC_CURTYPE",
"FINSC_LD_CMP",
"TKA09"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA