I_PT_GenLedgerBPMasterData

DDL: I_PT_GENLEDGERBPMASTERDATA Type: view_entity COMPOSITE

SAFT PT BP for Master Data

I_PT_GenLedgerBPMasterData is a Composite CDS View that provides data about "SAFT PT BP for Master Data" in SAP S/4HANA. It reads from 2 data sources (I_OperationalAcctgDocItem, I_PT_SAFTGenericSettings) and exposes 19 fields with key fields CompanyCode, FiscalYear, AccountingDocument, AccountingDocumentItem. It has 1 association to related views.

Data Sources (2)

SourceAliasJoin Type
I_OperationalAcctgDocItem Document from
I_PT_SAFTGenericSettings GenericSettings inner

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_PT_SAFTAcctgDocCustAddrHist _CustHist _CustHist.AccountingDocument = Document.AccountingDocument and _CustHist.CompanyCode = Document.CompanyCode and _CustHist.FiscalYear = Document.FiscalYear and _CustHist.Customer = Document.Customer

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
AccessControl.personalData.blocking #BLOCKED_DATA_INCLUDED view
EndUserText.label SAFT PT BP for Master Data view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.dataClass #MIXED view

Fields (19)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_OperationalAcctgDocItem CompanyCode
KEY FiscalYear I_OperationalAcctgDocItem FiscalYear
KEY AccountingDocument I_OperationalAcctgDocItem AccountingDocument
KEY AccountingDocumentItem I_OperationalAcctgDocItem AccountingDocumentItem
Customer I_OperationalAcctgDocItem Customer
Supplier I_OperationalAcctgDocItem Supplier
VATRegistration I_OperationalAcctgDocItem VATRegistration
char32asBusinessPartnerCustomer
char32asSupplierToPartner
DelivOfGoodsDestCountry
IsOneTimeAccountendasIsOneTimeAccount
AddressIDendasAddressID
_CompanyCode I_OperationalAcctgDocItem _CompanyCode
_FiscalYear I_OperationalAcctgDocItem _FiscalYear
_JournalEntry I_OperationalAcctgDocItem _JournalEntry
_Supplier I_OperationalAcctgDocItem _Supplier
_Customer I_OperationalAcctgDocItem _Customer
_CustHist _CustHist
_JournalEntryItemOneTimeData I_OperationalAcctgDocItem _JournalEntryItemOneTimeData
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@EndUserText.label: 'SAFT PT BP for Master Data'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
  serviceQuality: #X,
  sizeCategory: #S,
  dataClass: #MIXED
}
define view entity I_PT_GenLedgerBPMasterData
  as select from I_OperationalAcctgDocItem as Document
    inner join   I_PT_SAFTGenericSettings  as GenericSettings on  GenericSettings.CompanyCode    =  Document.CompanyCode
                                                              and GenericSettings.FiscalYearFrom <= Document.FiscalYear
                                                              and GenericSettings.FiscalYearTo   >= Document.FiscalYear
  association [0..1] to I_PT_SAFTAcctgDocCustAddrHist as _CustHist on  _CustHist.AccountingDocument = Document.AccountingDocument
                                                                   and _CustHist.CompanyCode        = Document.CompanyCode
                                                                   and _CustHist.FiscalYear         = Document.FiscalYear
                                                                   and _CustHist.Customer           = Document.Customer
{
      @ObjectModel.foreignKey.association: '_CompanyCode'
  key Document.CompanyCode                                               as CompanyCode,
      @ObjectModel.foreignKey.association: '_FiscalYear'
  key Document.FiscalYear                                                as FiscalYear,
      @ObjectModel.foreignKey.association: '_JournalEntry'
  key Document.AccountingDocument                                        as AccountingDocument,
  key Document.AccountingDocumentItem,
      Document.Customer,
      Document.Supplier,
      Document.VATRegistration,
      cast (case when Document.Customer is not initial
       then case Document._Customer.IsOneTimeAccount when 'X' then

             case when Document._JournalEntryItemOneTimeData.TaxID1 is not initial
            then concat(Document.Customer, concat('/', Document._JournalEntryItemOneTimeData.TaxID1 ))
           else
       case when Document.VATRegistration is initial or Document.VATRegistration is null
       then
         concat(Document.Customer, concat('/',  '999999990'))
       else
         concat(Document.Customer, concat('/',  substring(Document.VATRegistration ,3,18)))
       end end
       else

       case when _CustHist.PortugueseCustomerWithVersion is not initial
               then case when Document.DelivOfGoodsDestCountry is not initial
                           then case when Document.DelivOfGoodsDestCountry != Document._Customer.Country
                                       then concat(_CustHist.PortugueseCustomerWithVersion,concat('/',Document.DelivOfGoodsDestCountry))
                                       else _CustHist.PortugueseCustomerWithVersion
                           end
               else _CustHist.PortugueseCustomerWithVersion
               end
       when Document.Customer is not initial
       then case when Document.DelivOfGoodsDestCountry is not initial
               then case when Document.DelivOfGoodsDestCountry != Document._Customer.Country
                   then concat(Document.Customer,concat('/',Document.DelivOfGoodsDestCountry))
                   else Document.Customer
               end
               else Document.Customer
            end
       end end end as abap.char(32) )                                    as BusinessPartnerCustomer,

      cast(case when Document.DelivOfGoodsDestCountry is not initial
                    then case when Document.DelivOfGoodsDestCountry != Document._Supplier.Country
                        then concat(Document.Supplier,concat('/',Document.DelivOfGoodsDestCountry))
                        else Document.Supplier
                    end
                    else Document.Supplier

            end as abap.char(32) )                                       as SupplierToPartner,

      cast(substring ( Document.VATRegistration, 1, 2 ) as abap.char(3)) as DelivOfGoodsDestCountry,

      case when Document.Customer is not initial
      then Document._Customer.IsOneTimeAccount
      when Document.Supplier is not initial
      then Document._Supplier.IsOneTimeAccount end                       as IsOneTimeAccount,

      case $projection.IsOneTimeAccount when 'X' then
      Document._JournalEntryItemOneTimeData.AddressID
      end                                                                as AddressID,

      Document._CompanyCode,
      Document._FiscalYear,
      Document._JournalEntry,
      Document._Supplier,
      Document._Customer,
      _CustHist,
      Document._JournalEntryItemOneTimeData
}
where
  (
       Document.FinancialAccountType = 'D'
    or Document.FinancialAccountType = 'K'
  )
  and  Document.SpecialGLCode != 'F'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CUSTOMER",
"I_JOURNALENTRYITEMONETIMEDATA",
"I_OPERATIONALACCTGDOCITEM",
"I_PT_SAFTACCTGDOCCUSTADDRHIST",
"I_PT_SAFTGENERICSETTINGS",
"I_SUPPLIER"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_CUSTOMER",
"I_FISCALYEARFORCOMPANYCODE",
"I_JOURNALENTRY",
"I_JOURNALENTRYITEMONETIMEDATA",
"I_PT_SAFTACCTGDOCCUSTADDRHIST",
"I_SUPPLIER"
],
"BASE":
[
"I_OPERATIONALACCTGDOCITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/