P_RASchedItemSub

DDL: P_RASCHEDITEMSUB SQL: PRASCHEDITEMSUB Type: view COMPOSITE Package: ODATA_FARR_REVENUESCHEDULE

Distinct and Non-distinct POB

P_RASchedItemSub is a Composite CDS View that provides data about "Distinct and Non-distinct POB" in SAP S/4HANA. It reads from 1 data source (P_RASchedAllocatedAmtPerPerd) and exposes 26 fields with key fields PerformanceObligation, FiscalYear, FiscalPeriod, RevenueAccountingContract, DeferralCategory. Part of development package ODATA_FARR_REVENUESCHEDULE.

Data Sources (1)

SourceAliasJoin Type
P_RASchedAllocatedAmtPerPerd RevAcctgAllocatedAmtPerPerd from

Annotations (7)

NameValueLevelField
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AbapCatalog.sqlViewName PRASCHEDITEMSUB view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (26)

KeyFieldSource TableSource FieldDescription
KEY PerformanceObligation P_RASchedAllocatedAmtPerPerd PerformanceObligation
KEY FiscalYear P_RASchedAllocatedAmtPerPerd FiscalYear
KEY FiscalPeriod P_RASchedAllocatedAmtPerPerd FiscalPeriod
KEY RevenueAccountingContract P_RASchedAllocatedAmtPerPerd RevenueAccountingContract
KEY DeferralCategory P_RASchedAllocatedAmtPerPerd DeferralCategory
RAPerfOblgnDistinctType P_RASchedAllocatedAmtPerPerd RAPerfOblgnDistinctType
FiscalYearPeriod
RatioUnit
AllocatedPriceInSalesDocCrcy P_RASchedAllocatedAmtPerPerd TotalEffectiveAmtInSlsDocCrcy
ContractualPrcInSlsDocCrcy P_RASchedAllocatedAmtPerPerd TotalDocAmtContractual
PerfOblgnFaceAmtInSlsDocCrcy
RATotalCostInSlsDocCrcy
TolRecognizedCostPerPerd P_RASchedAllocatedAmtPerPerd TolRecognizedCostPerPerd
PerPerdInvoicedAmtInSlsDocCrcy
RecgdCatchUpAmtInSlsDocCrcy
PostponedRevnAmtInSlsDocCrcy
RADeltaRecgdCostInSlsDocCrcy
PostponedCostAmtInSlsDocCrcy RAPerfOblgnPostpnPostPerPerd PostpnDeltaCostInSlsDocCrcy
PerfOblgnEffectiveQuantity
PerfOblgnDeltaInvoicedQuantity
RevnAcctgSenderComponent
RevnAcctgOperationalDocument
RAOperationalDocumentItem
RANumberOfOperationalDocument
UpToCurPeriodRecognizedRevenue P_RASchedAllocatedAmtPerPerd TolRecognizedAmtPerPerd
TotRecgdCatchUpAmtInSlsDocCrcy P_RASchedAllocatedAmtPerPerd TolRecgdAmtCatchupPerPerd
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'PRASCHEDITEMSUB'

@AccessControl.authorizationCheck: #NOT_REQUIRED

@ClientHandling.algorithm: #SESSION_VARIABLE

// @EndUserText.label: 'Distinct and Non-distinct POB'


@VDM.private: true
@VDM.viewType: #COMPOSITE

define view P_RASchedItemSub
  as select from           P_RASchedAllocatedAmtPerPerd   as RevAcctgAllocatedAmtPerPerd

    // Delta Invoiced & Recognized & Catch Up Amount

    left outer to one join P_RASchedPerfOblgnAmtPerd      as RAPerfOblgnTotalAmtPerPeriod
      on  RevAcctgAllocatedAmtPerPerd.PerformanceObligation     = RAPerfOblgnTotalAmtPerPeriod.PerformanceObligation
      and RevAcctgAllocatedAmtPerPerd.FiscalYear                = RAPerfOblgnTotalAmtPerPeriod.FiscalYear
      and RevAcctgAllocatedAmtPerPerd.FiscalPeriod              = RAPerfOblgnTotalAmtPerPeriod.FiscalPeriod
      and RevAcctgAllocatedAmtPerPerd.RevenueAccountingContract = RAPerfOblgnTotalAmtPerPeriod.RevenueAccountingContract
      and RevAcctgAllocatedAmtPerPerd.DeferralCategory          = RAPerfOblgnTotalAmtPerPeriod.DeferralCategory

    // Delta Posting Amount

    left outer to one join P_RASchedPerfOblgnPostdAmtPerd as RAPerfOblgnPostedRevnPerPerd // Posted Revenue

      on  RevAcctgAllocatedAmtPerPerd.PerformanceObligation     = RAPerfOblgnPostedRevnPerPerd.PerformanceObligation
      and RevAcctgAllocatedAmtPerPerd.FiscalYear                = RAPerfOblgnPostedRevnPerPerd.FiscalYear
      and RevAcctgAllocatedAmtPerPerd.FiscalPeriod              = RAPerfOblgnPostedRevnPerPerd.FiscalPeriod
      and RevAcctgAllocatedAmtPerPerd.RevenueAccountingContract = RAPerfOblgnPostedRevnPerPerd.RevenueAccountingContract
      and RevAcctgAllocatedAmtPerPerd.DeferralCategory          = RAPerfOblgnPostedRevnPerPerd.DeferralCategory

    left outer to one join P_RAPerfOblgnPostpnPostAmtPerd as RAPerfOblgnPostpnPostPerPerd // Postpone Posting Revneue

      on  RevAcctgAllocatedAmtPerPerd.PerformanceObligation     = RAPerfOblgnPostpnPostPerPerd.PerformanceObligation
      and RevAcctgAllocatedAmtPerPerd.FiscalYear                = RAPerfOblgnPostpnPostPerPerd.FiscalYear
      and RevAcctgAllocatedAmtPerPerd.FiscalPeriod              = RAPerfOblgnPostpnPostPerPerd.FiscalPeriod
      and RevAcctgAllocatedAmtPerPerd.RevenueAccountingContract = RAPerfOblgnPostpnPostPerPerd.RevenueAccountingContract
      and RevAcctgAllocatedAmtPerPerd.DeferralCategory          = RAPerfOblgnPostpnPostPerPerd.DeferralCategory

    /*****************Effective Quantity****************************/
    left outer to one join P_RASchedCumltvEffctQtyPerPerd as RAEffectQtyPerPerd
      on  RevAcctgAllocatedAmtPerPerd.PerformanceObligation     = RAEffectQtyPerPerd.PerformanceObligation
      and RevAcctgAllocatedAmtPerPerd.FiscalYear                = RAEffectQtyPerPerd.FiscalYear
      and RevAcctgAllocatedAmtPerPerd.FiscalPeriod              = RAEffectQtyPerPerd.FiscalPeriod
      and RevAcctgAllocatedAmtPerPerd.RevenueAccountingContract = RAEffectQtyPerPerd.RevenueAccountingContract
      and RevAcctgAllocatedAmtPerPerd.DeferralCategory          = RAEffectQtyPerPerd.DeferralCategory

    /*****************Invoice Quantity****************************/
    left outer to one join P_RASchedDeltaInvcQtyPerPerd   as RAInvcAndFulfilledQtyPerPerd
      on  RAInvcAndFulfilledQtyPerPerd.PerformanceObligation     = RevAcctgAllocatedAmtPerPerd.PerformanceObligation
      and RAInvcAndFulfilledQtyPerPerd.FiscalYear                = RevAcctgAllocatedAmtPerPerd.FiscalYear
      and RAInvcAndFulfilledQtyPerPerd.FiscalPeriod              = RevAcctgAllocatedAmtPerPerd.FiscalPeriod
      and RAInvcAndFulfilledQtyPerPerd.RevenueAccountingContract = RevAcctgAllocatedAmtPerPerd.RevenueAccountingContract
      and RAInvcAndFulfilledQtyPerPerd.DeferralCategory          = RevAcctgAllocatedAmtPerPerd.DeferralCategory

  association to I_RAPerfOblgnWithoutAcctAssgmt as PerformanceObligation
    on  $projection.PerformanceObligation     = PerformanceObligation.PerformanceObligation
    and $projection.RevenueAccountingContract = PerformanceObligation.RevenueAccountingContract

{
      /*======Key===============================================*/
  key RevAcctgAllocatedAmtPerPerd.PerformanceObligation,
  key RevAcctgAllocatedAmtPerPerd.FiscalYear,
  key RevAcctgAllocatedAmtPerPerd.FiscalPeriod,
  key RevAcctgAllocatedAmtPerPerd.RevenueAccountingContract,
  key RevAcctgAllocatedAmtPerPerd.DeferralCategory,

      RevAcctgAllocatedAmtPerPerd.RAPerfOblgnDistinctType,

      // Acquistion cost POB and time-based POB starts very early(start period earlier than the creation period in chang type table, internal incident 2180404877)

      // have no corresponding change type entry, so the RAHigherLevelPerfOblgn is null. Here use the value in POB table. This is actually not accrute for

      // time-based POB starts very early since the distinct type maybe changed. The accrute solution is to get the high leverl POB id of creation change type entry.

      // However, since this case will normally not happen in production system, just leave it to avoid complexity.

      case
        when RevAcctgAllocatedAmtPerPerd.RAHigherLevelPerfOblgn is not initial then RevAcctgAllocatedAmtPerPerd.RAHigherLevelPerfOblgn
        else
          case PerformanceObligation.RAPerfOblgnDistinctType
            when 'N' then PerformanceObligation.RAHigherLevelPerfOblgn
            else PerformanceObligation.PerformanceObligation
          end
      end                                                                                                               as RAHigherLevelPerfOblgn,

      cast(concat(RevAcctgAllocatedAmtPerPerd.FiscalYear, RevAcctgAllocatedAmtPerPerd.FiscalPeriod) as fis_jahrper_conv)
                                                                                                                        as FiscalYearPeriod,

      cast(
        concat(RevAcctgAllocatedAmtPerPerd.FiscalPeriod, concat('.', RevAcctgAllocatedAmtPerPerd.FiscalYear))
        as fis_fiscalyearperiod_c)                                                                                      as FiscalYearPeriodCompoundText,


      @Semantics.unitOfMeasure: true
      cast('%' as farr_quantity_unit)                                                                                   as RatioUnit,

      /*======Cumulative Amount==========================================*/
      // RelatedChgTypeItem.AllocatedPriceInSalesDocCrcy,

      RevAcctgAllocatedAmtPerPerd.TotalEffectiveAmtInSlsDocCrcy                                                         as AllocatedPriceInSalesDocCrcy,

      // RelatedChgTypeItem.ContractualPrcInSlsDocCrcy,

      RevAcctgAllocatedAmtPerPerd.TotalDocAmtContractual                                                                as ContractualPrcInSlsDocCrcy,

      RevAcctgAllocatedAmtPerPerd.TotalDocAmtContractual + RevAcctgAllocatedAmtPerPerd.TotalFreeFaceValue               as PerfOblgnFaceAmtInSlsDocCrcy,

      cast(RevAcctgAllocatedAmtPerPerd.TolEffectiveCostPerPerd as farr_cost_total preserving type)                      as RATotalCostInSlsDocCrcy,

      RevAcctgAllocatedAmtPerPerd.TolRecognizedCostPerPerd,

      cast(RevAcctgAllocatedAmtPerPerd.TotalEffectiveAmtInSlsDocCrcy
        - RevAcctgAllocatedAmtPerPerd.TolRecgdAmtCatchupPerPerd
        - RevAcctgAllocatedAmtPerPerd.TolRecognizedAmtPerPerd
        as farr_open_revenue)                                                                                           as RAOpenRevnInSlsDocCrcy,

      // Open Cost

      cast(RevAcctgAllocatedAmtPerPerd.TolEffectiveCostPerPerd
        - RevAcctgAllocatedAmtPerPerd.TolRecognizedCostPerPerd
        as farr_open_cost)                                                                                              as RAOpenCostInSlsDocCrcy,

      /*======Delta Amount==========================================*/
      // Delta Invoiced Amount

      cast(RAPerfOblgnTotalAmtPerPeriod.DeltaInvoicedAmtPerPerd as farr_cds_invoiced_amount preserving type)            as PerPerdInvoicedAmtInSlsDocCrcy,

      // Delta Recognized Amount

      cast(RAPerfOblgnTotalAmtPerPeriod.DeltaRecognizedAmtPerPerd
           + RAPerfOblgnTotalAmtPerPeriod.DeltaRecgdAmtCatchupPerPerd as farr_recog_amt)                                as DeltaRecognizedAmtInSlsDocCrcy,

      // Delta Catch Up Amount

      cast(RAPerfOblgnTotalAmtPerPeriod.DeltaRecgdAmtCatchupPerPerd as farr_cds_rev_catchup_amt preserving type)        as RecgdCatchUpAmtInSlsDocCrcy,

      // Delta Posted Amount. Must use coalesce( ) to convert null to 0, otherwise it will have unexpected result when get the status icon in view I_RARevenueScheduleItem

      cast(coalesce(RAPerfOblgnPostedRevnPerPerd.TotalPostgAmtInSlsDocCrcy * -1,
                    cast(0 as abap.curr(23,2))) as farr_post_price)                                                     as PostedRevnInSlsDocCrcy,

      RAPerfOblgnPostpnPostPerPerd.PostpnDeltaRevnInSlsDocCrcy + RAPerfOblgnPostpnPostPerPerd.PostpnCatchupInSlsDocCrcy as PostponedRevnAmtInSlsDocCrcy,

      // Delta Recognized Cost

      cast(RAPerfOblgnTotalAmtPerPeriod.DeltaRecognizedCostPerPerd as farr_recog_cost)                                  as RADeltaRecgdCostInSlsDocCrcy,

      // Delta Posted Cost. Must use coalesce( ) to convert null to 0, otherwise it will have unexpected result when get the status icon in view I_RARevenueScheduleItem

      cast(coalesce(RAPerfOblgnPostedRevnPerPerd.TotalPostgCostInSlsDocCrcy,
                    cast(0 as abap.curr(23,2))) as farr_post_cost)                                                      as RAPostedCostInSlsDocCrcy,

      RAPerfOblgnPostpnPostPerPerd.PostpnDeltaCostInSlsDocCrcy                                                          as PostponedCostAmtInSlsDocCrcy,

      /*======Cumulative Quantity==========================================*/
      cast(RAEffectQtyPerPerd.PerfOblgnCumltvEffectiveQty as farr_cds_effective_quantity)                               as PerfOblgnEffectiveQuantity,


      /*======Delta Quantity==========================================*/
      // Delta Invoiced Quantity

      // @Semantics.quantity.unitOfMeasure: 'PerfOblgnContractualQtyUnit'

      cast(RAInvcAndFulfilledQtyPerPerd.PerfOblgnDeltaInvoicedQuantity  as farr_cds_invoiced_quantity)                  as PerfOblgnDeltaInvoicedQuantity,

      /*======DPC Fields==========================================*/
      cast('' as farr_cds_rai_srcco)                                                                                    as RevnAcctgSenderComponent,
      cast('' as farr_operational_doc)                                                                                  as RevnAcctgOperationalDocument,
      cast('' as farr_item_id)                                                                                          as RAOperationalDocumentItem,
      cast(0 as farr_num_of_oprational_doc)                                                                             as RANumberOfOperationalDocument,

      /*======Additional Fields for Consumer==========================================*/
      //  RevAcctgAllocatedAmtPerPerd.TotalEffectiveAmtInSlsDocCrcy as TotalEffectiveAmtInSlsDocCrcy,

      RevAcctgAllocatedAmtPerPerd.TolRecognizedAmtPerPerd                                                               as UpToCurPeriodRecognizedRevenue,
      RevAcctgAllocatedAmtPerPerd.TolRecgdAmtCatchupPerPerd                                                             as TotRecgdCatchUpAmtInSlsDocCrcy

      /*======Associated View=====================================*/
      //  RAPerformanceObligation._RevenueAccountingContract,

      //  RAPerformanceObligation._PerfOblgnStartDateType,

      //  RAPerformanceObligation._PerfObligationEventType,

      //  RAPerformanceObligation._FulfillmentType,

      //  RAPerformanceObligation._PerfOblgnDistinctType,

      //  RAPerformanceObligation._Currency,

      //  RAPerformanceObligation._PerfOblgnContractualQtyUnit,

      //  RAPerformanceObligation._PerfOblgnEffectiveQtyUnit

}