@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
@VDM.private:true
@VDM.viewType: #BASIC
@AbapCatalog.sqlViewName: 'PFSLEAFITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true
define view P_FinStmtLeafItem
as select from I_FinancialStatementItem
inner join P_FinStmtLeaf on I_FinancialStatementItem.FinancialStatementVariant = P_FinStmtLeaf.versn
and I_FinancialStatementItem.FinancialStatementItem = P_FinStmtLeaf.ergsl
and I_FinancialStatementItem.NodeType = 'P'
{
//HierarchyUniqueNodeID is null means this leaf node is assigned to unassign node
key case when P_FinStmtLeaf.HierarchyUniqueNodeID is null
then cast ( concat(concat( I_FinancialStatementItem.HierarchyNode,P_FinStmtLeaf.ktopl),P_FinStmtLeaf.saknr ) as abap.char(50) )
else P_FinStmtLeaf.HierarchyUniqueNodeID
end as HierarchyUniqueNodeID,
key case when P_FinStmtLeaf.UniqueParentID is null
then cast ( I_FinancialStatementItem.HierarchyNode as abap.char(50) )
else P_FinStmtLeaf.UniqueParentID
end as UniqueParentID,
key P_FinStmtLeaf.versn,
key P_FinStmtLeaf.ergsl,
key P_FinStmtLeaf.ktopl,
key P_FinStmtLeaf.saknr,
key P_FinStmtLeaf.fkber,
P_FinStmtLeaf.type,
P_FinStmtLeaf.Description,
P_FinStmtLeaf.xsoll,
P_FinStmtLeaf.xhabn,
I_FinancialStatementItem.HierarchyNode as id,
I_FinancialStatementItem.HierarchyNode as parent,
cast ('000000' as seu_id) as nextn,
cast ('000000' as seu_id) as child,
case type
when 'L' then
case when P_FinStmtLeaf.HierarchyUniqueNodeID is null
then cast (I_FinancialStatementItem.FinStatementHierarchyLevelVal as abap.int4) + 1
else cast (I_FinancialStatementItem.FinStatementHierarchyLevelVal as abap.int4) + 2
end
else cast (I_FinancialStatementItem.FinStatementHierarchyLevelVal as abap.int4) + 1
end as stufe, // stufe + 1 and left padding with '0'
cast ('' as ergsl) as ergs2
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_FINANCIALSTATEMENTITEM",
"P_FINSTMTLEAF"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/