C_PT_SAFTWorkingDocItemRef

DDL: C_PT_SAFTWORKINGDOCITEMREF SQL: CPTSAFWDOCIR Type: view CONSUMPTION Package: GLO_FIN_IS_SAFT_PT

SAF-T PT WorkingDocument Item References

C_PT_SAFTWorkingDocItemRef is a Consumption CDS View that provides data about "SAF-T PT WorkingDocument Item References" in SAP S/4HANA. It reads from 3 data sources (I_PT_SAFTBillingItem, I_SDDocumentMultiLevelProcFlow, I_PT_BillgDocDgtlSgntr) and exposes 7 fields with key fields CompanyCode, PortugueseInvoiceNumber, DocumentItemNumber, InvoiceReference. Part of development package GLO_FIN_IS_SAFT_PT.

Data Sources (3)

SourceAliasJoin Type
I_PT_SAFTBillingItem a from
I_SDDocumentMultiLevelProcFlow b inner
I_PT_BillgDocDgtlSgntr ReferenceSignedInvoice left_outer

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName CPTSAFWDOCIR view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label SAF-T PT WorkingDocument Item References view

Fields (7)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_PT_SAFTBillingItem CompanyCode
KEY PortugueseInvoiceNumber I_PT_SAFTBillingItem PortugueseInvoiceNumber
KEY DocumentItemNumber I_PT_SAFTBillingItem DocumentItemNumber
KEY InvoiceReference I_PT_BillgDocDgtlSgntr PortugueseInvoiceNumber
SDDocumentReason I_PT_SAFTBillingItem SDDocumentReason
_CompanyCode _CompanyCode
_SDDocumentReason _SDDocumentReason
@AbapCatalog.sqlViewName: 'CPTSAFWDOCIR'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #D
@AccessControl.personalData.blocking: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'SAF-T PT WorkingDocument Item References'
@Consumption.dbHints: [ 'USE_HEX_PLAN' ]
define view C_PT_SAFTWorkingDocItemRef
  as select from    I_PT_SAFTBillingItem           as a
    inner join      I_SDDocumentMultiLevelProcFlow as b                      on  a.BillingDocument     = b.SubsequentDocument
                                                                             and a.BillingDocumentItem = b.SubsequentDocumentItem


    left outer join I_PT_BillgDocDgtlSgntr         as ReferenceSignedInvoice on ReferenceSignedInvoice.BillingDocument = b.PrecedingDocument



{
  key a.CompanyCode,
  key a.PortugueseInvoiceNumber,
  key a.DocumentItemNumber,
  key ReferenceSignedInvoice.PortugueseInvoiceNumber                                  as InvoiceReference,    //Reference  4.3.4.14.10.1

      a.SDDocumentReason                                                              as SDDocumentReason,
      case when a.SDDocumentReason is not initial then
          coalesce(a._SDDocumentReason._Text[1: Language = 'P'].SDDocumentReasonText,
          coalesce(a._SDDocumentReason._Text[1: Language = 'E'].SDDocumentReasonText,
          coalesce(a._SDDocumentReason._Text[1: Language = $session.system_language].SDDocumentReasonText,
                   '')))
      else
        ''
      end                                                                             as SDDocumentReasonText,   //Reason  4.3.4.14.10.2

      
  _CompanyCode,
  _SDDocumentReason
}
where
        b.PrecedingDocumentCategory = 'M'
  or    b.PrecedingDocumentCategory = '5' 
  and   a.SalesDocumentIsWorkingDocument = 'X'