P_PL_SAFTSALESINVITEM

CDS View

SAF-T PL Sales Invoice Item

P_PL_SAFTSALESINVITEM is a CDS View in S/4HANA. SAF-T PL Sales Invoice Item. It contains 13 fields. 2 CDS views read from this table.

CDS Views using this table (2)

ViewTypeJoinVDMDescription
P_PL_SAFTGetSalesInvoiceData view_entity from COMPOSITE SAFT PL FA Sales Invoice Basic Data
P_PL_SAFTInvoiceItem view from CONSUMPTION SAF-T PL Invoice Items

Fields (13)

KeyField CDS FieldsUsed in Views
KEY AccountingDocument AccountingDocument 1
KEY CompanyCode CompanyCode 1
KEY FiscalYear FiscalYear 1
BillingDocumentItem BillingDocumentItem 1
BillingQuantity Quantity 1
BillingQuantityUnit UnitOfMeasure 1
CancelledBillingDocument CancelledBillingDocument 1
CompanyCodeCurrency CompanyCodeCurrency 1
IsReversal IsReversal 1
IsReversed IsReversed 1
ItemSignIsReversed ItemSignIsReversed 1
PL_SAFTInvoiceType PL_SAFTInvoiceType 1
TransactionCurrency TransactionCurrency 1
@AbapCatalog.sqlViewName: 'PPLSAFTSLSINVITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_PL_SAFTSalesInvItem
  with parameters
    P_StartDate : datum,
    P_EndDate   : datum
  as select distinct from P_PL_SAFTInvoiceHeaderBasic( P_StartDate:$parameters.P_StartDate, P_EndDate: $parameters.P_EndDate) as Entry
    inner join            I_BillingDocumentItem                                                                               as Item   on Item.BillingDocument = Entry.BillingDocument
    inner join            P_PL_SAFTBillingDocumentBasic                                                                       as Header on Header.BillingDocument            =  Item.BillingDocument
                                                                                                                                        and(
                                                                                                                                          Header.PL_SAFTInvoiceType          <> 'ZAL'
                                                                                                                                          or Header.CancelledBillingDocument is not initial
                                                                                                                                        )
    inner join            P_PL_SAFTInvoiceTax                                                                                 as Tax    on  Tax.CompanyCode        = Entry.CompanyCode
                                                                                                                                        and Tax.AccountingDocument = Entry.AccountingDocument
                                                                                                                                        and Tax.FiscalYear         = Entry.FiscalYear
                                                                                                                                        and Tax.TaxCode            = Item.TaxCode
{

  key Entry.CompanyCode,
  key Entry.AccountingDocument,
  key Entry.FiscalYear,
  key Item.BillingDocument,
  key Item.BillingDocumentItem,



      Header.PL_SAFTInvoiceType,
      Header.CancelledBillingDocument,

      case when    Header.SDDocumentCategory = 'O'  //Credit Memo

                or Header.SDDocumentCategory = 'N'  //Invoice Cancellation

                or Header.SDDocumentCategory = '4'  //Credit Memo List

           then 'X'
           else ' '
      end                             as ItemSignIsReversed,

      Item.BillingDocumentItemText,
      Item.BillingQuantityUnit,
      Item.BillingQuantity,

      @Semantics.amount.currencyCode: 'TransactionCurrency'
      cast( case when Item.BillingQuantity is not initial
        then division(Item.NetAmount,Item.BillingQuantity,2)
        else Item._SalesDocumentItem.NetPriceAmount
      end as netpr)                   as NetPriceAmount,

      @Semantics.amount.currencyCode: 'TransactionCurrency'
      cast( case when Item.BillingQuantity is not initial
        then division((Item.NetAmount + Item.TaxAmount),Item.BillingQuantity,2)
        when Item._SalesDocumentItem.NetAmount <> 0 and Item._SalesDocumentItem.NetPriceAmount <> 0
        then division(Item._SalesDocumentItem.NetAmount + Item._SalesDocumentItem.TaxAmount
          ,division(Item._SalesDocumentItem.NetAmount, Item._SalesDocumentItem.NetPriceAmount,2),2)
        else 0
      end as netpr)        as GrossPriceAmountInCCCrcy,

      @Semantics.currencyCode: true
      Entry.CompanyCodeCurrency,
      @Semantics.currencyCode: true
      Item.TransactionCurrency,
      @Semantics.amount.currencyCode: 'TransactionCurrency'
      Item.NetAmount,
      @Semantics.amount.currencyCode: 'TransactionCurrency'
      Item.NetAmount + Item.TaxAmount as GrossAmount,
      @Semantics.amount.currencyCode: 'TransactionCurrency'
      case
        when Header.BillingDocumentType = 'G2DP' and Header.PL_SAFTInvoiceType = 'KOREKTA'
            then 0
            else Item.Subtotal1Amount - Item.NetAmount
      end                             as DiscountAmount,

      Item._PricingElement[     (ConditionApplication = 'V' or ConditionApplication = 'TX')
                            and ConditionClass = 'D'
                            and ConditionCategory = 'D'
                            and ConditionInactiveReason = ''
                            and ConditionIsForStatistics = ''
                           ].TaxCode,
      Tax.PL_SAFTTaxPercentageCode,
      Entry.IsReversal,
      Entry.IsReversed

}
where
        Entry.BusinessTransactionType = 'SD00'
  and   not(
      Header.PL_SAFTInvoiceType           = 'ZAL'
      and Header.CancelledBillingDocument is not initial
    )