I_PT_SAFTGenLedgerCustomer is a Composite CDS View that provides data about "SAF-T PT Gen Ledger Customer" in SAP S/4HANA. It reads from 3 data sources (I_PT_SAFTIsAlternateAccount, I_PT_SAFTAcctgDocCustAddrHist, I_PT_AcctgDocDgtlSgntr) and exposes 17 fields with key fields CompanyCode, FiscalYear, AccountingDocument, Ledger. It has 2 associations to related views. Part of development package GLO_FIN_IS_SAFT_PT.
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 I_PT_SAFTGenLedgerCustomer.-- 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: IPTSAFTGLCUSTCREATE VIEW I_PT_SAFTGenLedgerCustomer ASSELECT
a.CompanyCode AS CompanyCode,
a.FiscalYear AS FiscalYear,
a.AccountingDocument AS AccountingDocument,
a.Ledger AS Ledger,
a._CompanyCode AS _CompanyCode,
a._FiscalYear AS _FiscalYear,
a._JournalEntry AS _JournalEntry,
a._Ledger AS _Ledger,
casewhen s.PortugueseInvoiceDate isnot initial then s.PortugueseInvoiceDate else a.PostingDate endas DocumentDate AS PostingDateendasDocumentDate,
casewhen s.PortugueseInvoiceNumber is initial or s.PortugueseInvoiceNumber isnullthencast(casewhen a.BusinessPartnerName1 isnot initial and a.BusinessPartnerName2 isnot initial then concat_with_space(a.BusinessPartnerName1,a.BusinessPartnerName2,1) when a.BusinessPartnerName1 isnot initial then a.BusinessPartnerName1 when a.BusinessPartnerName2 isnot initial then a.BusinessPartnerName2 endas bu_name1tx) else h.CompanyName endas CompanyName AS CompanyNameendasCompanyName,
casewhen s.PortugueseInvoiceNumber is initial or s.PortugueseInvoiceNumber isnullthencasewhen a.PostalCode isnot initial then a.PostalCode else '0000-000' endwhen s.PortugueseInvoiceNumber isnot initial thencasewhen h.PostalCode isnot initial then h.PostalCode else '0000-000' endendas PostalCode AS PostalCodeelse0000000endendasPostalCode,
casewhen s.PortugueseInvoiceNumber is initial or s.PortugueseInvoiceNumber isnullthencasewhen a.Country isnot initial then a.Country else 'Desconhecido' endwhen s.PortugueseInvoiceNumber isnot initial thencasewhen h.Country isnot initial then h.Country else 'Desconhecido' endendas Country AS CountryelseDesconhecidoendendasCountry,
a.Customer AS Customer,
casewhen s.PortugueseInvoiceNumber is initial or s.PortugueseInvoiceNumber isnullthen coalesce ( a._AddressRepresentation._PhoneNumber[ 1: PhNmbrIsCurrentOverallDefault = 'X' ].InternationalPhoneNumber , '' ) else coalesce ( h.PhoneNumber, '' ) endas PhoneNumber AS PhoneNumberendasPhoneNumber,
casewhen s.PortugueseInvoiceNumber is initial or s.PortugueseInvoiceNumber isnullthen coalesce ( a._AddressRepresentation._FaxNumber[ 1: FaxNumberIsCurrentDefault = 'X' ].InternationalFaxNumber , '') else coalesce ( h.FaxNumber , '' ) endas FaxNumber AS FaxNumberendasFaxNumber,
casewhen s.PortugueseInvoiceNumber is initial or s.PortugueseInvoiceNumber isnullthen coalesce ( a._AddressRepresentation._EmailAddress[ 1: EmailAddressIsCurrentDefault = 'X' ].EmailAddress , '' ) else coalesce( h.EmailAddress , '' ) endas EmailAddress AS EmailAddressendasEmailAddress,
casewhen s.PortugueseInvoiceNumber is initial or s.PortugueseInvoiceNumber isnullthen ' ' else coalesce ( h.SearchURLAddress , '' ) endas WebsiteURL AS SearchURLAddressendasWebsiteURL
INNERJOIN I_PT_SAFTIsAlternateAccount AS c ON /* join condition not captured in parsed metadata */
LEFTOUTERJOIN I_PT_AcctgDocDgtlSgntr AS s ON /* join condition not captured in parsed metadata */
LEFTOUTERJOIN I_PT_SAFTAcctgDocCustAddrHist AS h ON /* join condition not captured in parsed metadata */
LEFTOUTERJOIN I_PT_SAFTGenericSettings AS _b ON _b.CompanyCode = a.CompanyCode AND _b.FiscalYearFrom <= a.FiscalYear AND _b.FiscalYearTo >= a.FiscalYear AND _b.SourceLedger = a.Ledger -- association [0..1]LEFTOUTERJOIN I_SAFTCustTaxRegnNmbr AS _CustLand ON a.Customer = _CustLand.CustomerNum -- association [0..1]
;