@ClientHandling.algorithm: #SESSION_VARIABLE@Metadata.ignorePropagatedAnnotations: true@VDM.private:true@VDM.viewType: #BASIC@AbapCatalog.sqlViewName: 'PFSITEMHIER'
@AbapCatalog.compiler.compareFilter: truedefineview P_FinStmtHierarchy
asselectfrom I_FinancialStatementItem
innerjoin t011 on I_FinancialStatementItem.FinancialStatementVariant = t011.versn
innerjoin P_Distinct_Coa_Fagl_Zc as dis_zc on I_FinancialStatementItem.FinancialStatementVariant = dis_zc.versn
leftouterjoin P_FSHierarchy_Calc_Item as calc_item on I_FinancialStatementItem.FinancialStatementVariant = calc_item.versn
and I_FinancialStatementItem.HierarchyNode >= calc_item.id_from
and I_FinancialStatementItem.HierarchyNode < calc_item.id_to
{
keycast(I_FinancialStatementItem.HierarchyNode asabap.char(50)) as HierarchyUniqueNodeID,
keycast (I_FinancialStatementItem.ParentNode asabap.char(50)) as UniqueParentID,
key I_FinancialStatementItem.FinancialStatementVariant as versn,
key I_FinancialStatementItem.FinancialStatementItem as ergsl,
key dis_zc.ktopl as ktopl,
keycast ('' as saknr) as saknr,
keycast ('' as fkber) as fkber,
I_FinancialStatementItem.NodeType as type,
cast ('' asabap.char(50)) as Description,
t011.dspra as MaintenanceLanguage,
cast ('' as xsoll_f02e) as xsoll,
cast ('' as xhabn_f02e) as xhabn,
I_FinancialStatementItem.HierarchyNode as id,
I_FinancialStatementItem.ParentNode as parent,
I_FinancialStatementItem.ChildNode as child,
I_FinancialStatementItem.SiblingNode as nextn,
cast(I_FinancialStatementItem.FinStatementHierarchyLevelVal asabap.int4) as stufe,
I_FinancialStatementItem.OffsettingItem as ergs2,
casewhen calc_item.segment isnulland I_FinancialStatementItem.NodeType = 'R' then 'RT'
when calc_item.segment isnulland I_FinancialStatementItem.NodeType <> 'R' then 'PL'
else calc_item.segment
endas segment
// Only top level node will have value in SEGMENT field
// case I_FinancialStatementItem.FinStatementHierarchyLevelVal
// when '02' then // '01' is ROOT, '02' is ASSET, LIABILITEIS, etc
// case I_FinancialStatementItem.FinancialStatementItem
// when t011.aktva then 'BS'
// when t011.pssva then 'BS'
// when t011.anhng then 'NT'
// when t011.zuord then 'UA'
// else 'PL'
// end// else ''
// endas segment
}
unionallselectfrom P_FinStmtLeafItem
innerjoin t011 on P_FinStmtLeafItem.versn = t011.versn
leftouterjoin P_FSHierarchy_Calc_Item as calc_item on P_FinStmtLeafItem.versn = calc_item.versn
and P_FinStmtLeafItem.id >= calc_item.id_from
and P_FinStmtLeafItem.id < calc_item.id_to
{
key P_FinStmtLeafItem.HierarchyUniqueNodeID,
key P_FinStmtLeafItem.UniqueParentID,
key P_FinStmtLeafItem.versn,
P_FinStmtLeafItem.ergsl,
key P_FinStmtLeafItem.ktopl,
key P_FinStmtLeafItem.saknr,
key P_FinStmtLeafItem.fkber,
P_FinStmtLeafItem.type,
P_FinStmtLeafItem.Description,
t011.dspra as MaintenanceLanguage,
P_FinStmtLeafItem.xsoll,
P_FinStmtLeafItem.xhabn,
P_FinStmtLeafItem.id,
//cast('000000' as SEU_ID) as id,
P_FinStmtLeafItem.parent,
P_FinStmtLeafItem.child,
P_FinStmtLeafItem.nextn,
P_FinStmtLeafItem.stufe,
P_FinStmtLeafItem.ergs2,
//calc_item.segment
casewhen calc_item.segment isnullthen 'PL'
else calc_item.segment
endas segment
// Only top level node will have value in SEGMENT field
// case P_FinStmtLeafItem.stufe
// when 2 then // '01' is ROOT, '02' is ASSET, LIABILITEIS, etc
// case P_FinStmtLeafItem.ergsl
// when t011.aktva then 'BS'
// when t011.pssva then 'BS'
// when t011.anhng then 'NT'
// when t011.zuord then 'UA'
// else 'PL'
// end// else ''
// endas segment
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_FINANCIALSTATEMENTITEM",
"P_DISTINCT_COA_FAGL_ZC",
"P_FINSTMTLEAFITEM",
"P_FSHIERARCHY_CALC_ITEM",
"T011"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/