Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view P_FIARCN_CUST_BALANCE07.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- SQL view name: PVFIARCNCUSTBAL7
-- Parameters: P_CompanyCode : bukrs, P_FiscalYear : gjahr, P_Language : sylangu, P_CurrencyRole : fac_crcyrole
CREATE VIEW P_FIARCN_CUST_BALANCE07 AS
SELECT
Period.CompanyCode AS CompanyCode,
Period.FiscalYear AS FiscalYear,
Period.FiscalPeriod AS FiscalPeriod,
GLAccount,
AlternativeGLAccount,
Bal.BusinessPartner AS BusinessPartner,
Bal.Customer AS Customer,
Supplier,
SpecialGLCode,
ProfitCenter,
Segment,
BusinessArea,
AccountingDocumentType,
DisplayCurrency,
TransactionCurrency,
AssignmentReference,
case when Bal.FiscalPeriod = '000' then AmountInDisplayCurrency else cast(0 as abap.curr( 23, 2 )) end as BalCarFwdAmtInDspCrcy AS curr232endasBalCarFwdAmtInDspCrcy,
case when Bal.FiscalPeriod < Period.FiscalPeriod then AmountInDisplayCurrency else cast(0 as abap.curr( 23, 2 )) end as StartingBalAmtInDspCrcy AS curr232endasStartingBalAmtInDspCrcy,
case when Bal.FiscalPeriod <= Period.FiscalPeriod then AmountInDisplayCurrency else cast(0 as abap.curr( 23, 2 )) end as EndingBalAmtInDspCrcy AS curr232endasEndingBalAmtInDspCrcy,
case when Bal.FiscalPeriod = Period.FiscalPeriod then DebitAmountInDspCrcy else cast(0 as abap.curr( 23, 2 )) end as DebitAmountInDspCrcy AS curr232endasDebitAmountInDspCrcy,
case when Bal.FiscalPeriod = Period.FiscalPeriod then CreditAmountInDspCrcy else cast(0 as abap.curr( 23, 2 )) end as CreditAmountInDspCrcy AS curr232endasCreditAmountInDspCrcy,
case when Bal.FiscalPeriod > '000' and Bal.FiscalPeriod <= Period.FiscalPeriod then DebitAmountInDspCrcy else cast(0 as abap.curr( 23, 2 )) end as YTDDebitAmtInDspCrcy AS curr232endasYTDDebitAmtInDspCrcy,
case when Bal.FiscalPeriod > '000' and Bal.FiscalPeriod <= Period.FiscalPeriod then CreditAmountInDspCrcy else cast(0 as abap.curr( 23, 2 )) end as YTDCrdtAmtInDspCrcy AS curr232endasYTDCrdtAmtInDspCrcy,
case when Bal.FiscalPeriod = '000' then AmountInTransactionCurrency else cast(0 as abap.curr( 23, 2 )) end as BalCarFwdAmtInTransacCrcy AS curr232endasBalCarFwdAmtInTransacCrcy,
case when Bal.FiscalPeriod = Period.FiscalPeriod then DebitAmountInTransCrcy else cast(0 as abap.curr( 23, 2 )) end as DebitAmountInTransCrcy AS curr232endasDebitAmountInTransCrcy,
case when Bal.FiscalPeriod = Period.FiscalPeriod then CreditAmountInTransCrcy else cast(0 as abap.curr( 23, 2 )) end as CreditAmountInTransCrcy AS curr232endasCreditAmountInTransCrcy,
case when Bal.FiscalPeriod <= Period.FiscalPeriod then AmountInTransactionCurrency else cast(0 as abap.curr( 23, 2 )) end as EndingBalanceAmtInTransCrcy AS curr232endasEndingBalanceAmtInTransCrcy,
case when Bal.FiscalPeriod > '000' and Bal.FiscalPeriod <= Period.FiscalPeriod then DebitAmountInTransCrcy else cast(0 as abap.curr( 23, 2 )) end as YTDDebitAmtInTransCrcy AS curr232endasYTDDebitAmtInTransCrcy,
case when Bal.FiscalPeriod > '000' and Bal.FiscalPeriod <= Period.FiscalPeriod then CreditAmountInTransCrcy else cast(0 as abap.curr( 23, 2 )) end as YTDCrdtAmtInTransCrcy AS curr232endasYTDCrdtAmtInTransCrcy,
GLAccountName
FROM P_FIARCN_CUST_BALANCE04
INNER JOIN P_FIARCN_TOTAL_PERIODS ON /* join condition not captured in parsed metadata */
;