I_PT_SAFTCustomerSalesInvoice

DDL: I_PT_SAFTCUSTOMERSALESINVOICE Type: view_entity COMPOSITE Package: GLO_FIN_IS_SAFT_PT

Customer from Billing Document

I_PT_SAFTCustomerSalesInvoice is a Composite CDS View that provides data about "Customer from Billing Document" in SAP S/4HANA. It reads from 4 data sources (I_Customer, I_BillingDocument, I_PT_SAFTBillgDocCustAddrHist, I_PT_BillgDocDgtlSgntr) and exposes 4 fields with key fields CompanyCode, PortugueseInvoiceNumber, DocumentDate, char30asBusinessPartnerCustomer. It has 1 association to related views. Part of development package GLO_FIN_IS_SAFT_PT.

Data Sources (4)

SourceAliasJoin Type
I_Customer Cust inner
I_BillingDocument Doc inner
I_PT_SAFTBillgDocCustAddrHist Hist inner
I_PT_BillgDocDgtlSgntr Sig from

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_SAFTCustTaxRegnNmbr _CustLand Doc.PayerParty = _CustLand.CustomerNum and Doc.VATRegistrationCountry = _CustLand.Country

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #MANDATORY view
VDM.viewType #COMPOSITE view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
EndUserText.label Customer from Billing Document view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view

Fields (4)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_PT_BillgDocDgtlSgntr CompanyCode
KEY PortugueseInvoiceNumber I_PT_BillgDocDgtlSgntr PortugueseInvoiceNumber
KEY DocumentDate I_BillingDocument BillingDocumentDate
KEY char30asBusinessPartnerCustomer
@Consumption.dbHints: [ 'USE_HEX_PLAN' ]
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #MANDATORY
@VDM.viewType: #COMPOSITE
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@EndUserText.label: 'Customer from Billing Document'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
  serviceQuality: #D,
  sizeCategory: #XL,
  dataClass: #MIXED
}
define view entity I_PT_SAFTCustomerSalesInvoice
  as select from I_PT_BillgDocDgtlSgntr        as Sig

    inner join   I_BillingDocument             as Doc  on  Sig.BillingDocument = Doc.BillingDocument --NRG
                                                       and Sig.CompanyCode     = Doc.CompanyCode --NRG
    inner join   I_Customer                    as Cust on  Cust.Customer         = Doc.PayerParty
                                                       and Cust.IsOneTimeAccount = ' '

    inner join   I_PT_SAFTBillgDocCustAddrHist as Hist on  Sig.BillingDocument = Hist.BillingDocument
                                                       and Sig.CompanyCode     = Hist.CompanyCode
                                                       and Cust.Customer       = Hist.Customer

  association [0..1] to I_SAFTCustTaxRegnNmbr as _CustLand on  Doc.PayerParty             = _CustLand.CustomerNum
                                                           and Doc.VATRegistrationCountry = _CustLand.Country

{
  key     Sig.CompanyCode,
  key     Sig.PortugueseInvoiceNumber,
  key     Doc.BillingDocumentDate       as DocumentDate,
  key     cast(case when _CustLand.Country is not initial
          then
          case when Doc.VATRegistrationCountry is not initial then
            concat(Hist.PortugueseCustomerWithVersion, concat('/', Doc.VATRegistrationCountry ))
            else concat(Hist.PortugueseCustomerWithVersion, concat('/', Hist.Country)) end
          //   concat(Hist.PortugueseCustomerWithVersion, concat('/', _MultVat.CustomerCountry))

          else case when Hist.Country != Cust.Country
             then concat(Hist.PortugueseCustomerWithVersion,concat('/',Hist.Country))
             else Hist.PortugueseCustomerWithVersion
             end end  as abap.char(30)) as BusinessPartnerCustomer


}

where
      Doc.CancelledBillingDocument =  '' //Do not select cancel documents

  and Doc.BillingDocumentCategory  <> 'P' //Do not select DP Requests

  and Doc.SDDocumentCategory       <> '3'
  and Doc.SDDocumentCategory       <> '4'