P_AllocationCycleCalc

DDL: P_ALLOCATIONCYCLECALC SQL: PALOCYCLECALC Type: view CONSUMPTION

P_AllocationCycleCalc is a Consumption CDS View in SAP S/4HANA. It reads from 1 data source (I_AllocationCycleTP) and exposes 15 fields with key fields AllocationType, AllocationCycle, AllocationCycleStartDate. It has 2 associations to related views.

Data Sources (1)

SourceAliasJoin Type
I_AllocationCycleTP I_AllocationCycleTP from

Associations (2)

CardinalityTargetAliasCondition
[0..1] P_AllocationStatus _Status $projection.AllocationType = _Status.AllocationType and $projection.AllocationCycle = _Status.AllocationCycle and $projection.AllocationCycleStartDate = _Status.AllocationCycleStartDate
[0..*] C_AllocationCycleKeyFieldTP _Field $projection.AllocationType = _Field.AllocationType and $projection.AllocationCycle = _Field.AllocationCycle and $projection.AllocationCycleStartDate = _Field.AllocationCycleStartDate

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PALOCYCLECALC view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #CUSTOMIZING view
ObjectModel.usageType.serviceQuality #A view
ObjectModel.usageType.sizeCategory #M view
VDM.viewType #CONSUMPTION view
VDM.private true view

Fields (15)

KeyFieldSource TableSource FieldDescription
KEY AllocationType AllocationType
KEY AllocationCycle AllocationCycle
KEY AllocationCycleStartDate AllocationCycleStartDate
AllocationCycleName
CompanyCode
Ledger
AllocationCycleCategory
AllocationCostElement
AllocationPostingType AllocationPostingType
AllocationActualPlanVariant AllocationActualPlanVariant
CreatedByUser CreatedByUser
AllocationCycleRunGroup AllocationCycleRunGroup
_Field _Field
_Context _Context
_ActualPlanText _ActualPlanText
@AbapCatalog.sqlViewName: 'PALOCYCLECALC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AccessControl.personalData.blocking: #NOT_REQUIRED

@ClientHandling.algorithm: #SESSION_VARIABLE

@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #M

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

//@EndUserText.label: 'Allocation Cycle Calculated Fields'

define view P_AllocationCycleCalc as 
select from I_AllocationCycleTP 
  association [0..1] to P_AllocationStatus as _Status on  $projection.AllocationType           = _Status.AllocationType
                                                      and $projection.AllocationCycle          = _Status.AllocationCycle
                                                      and $projection.AllocationCycleStartDate = _Status.AllocationCycleStartDate
                                                      
  association [0..*] to C_AllocationCycleKeyFieldTP as _Field on  $projection.AllocationType           = _Field.AllocationType
                                                              and $projection.AllocationCycle          = _Field.AllocationCycle
                                                              and $projection.AllocationCycleStartDate = _Field.AllocationCycleStartDate                                                         
{
  key AllocationType,
  key AllocationCycle,
  key AllocationCycleStartDate,
      
      cast(substring(AllocationCycle, 3, 8) as fco_alloc_cycle) as  AllocationCycleName,
      cast(case 
        when _Status[1:AllocationSegmentIsLocked = 'X'].StatusCount > 0 and _Status[1:AllocationSegmentIsLocked = ' '].StatusCount > 0
          then 'P'
        when _Status[1:AllocationSegmentIsLocked = 'X'].StatusCount > 0      
          then 'L'
        else   
          'A'
       end as fco_allocation_status) as AllocationStatus,   
       
       case 
         when _Status[1:AllocationSegmentIsLocked = 'X'].StatusCount > 0 and _Status[1:AllocationSegmentIsLocked = ' '].StatusCount > 0
           then 2 //yellow

        when _Status[1:AllocationSegmentIsLocked = 'X'].StatusCount > 0      
          then 1 //red

        else   
          3 //green

       end as CriticalityCode,
//       cast(dats_tims_to_tstmp( AllocationLastExecutedDate , 

//                          AllocationLastExecutionTime, 

//                          abap_system_timezone( $session.client,'NULL' ), 

//                          $session.client, 

//                         'NULL' ) as fco_alloc_cycle_lastexec_dt) as AllocLastExecutionDateTime,

                    
      @ObjectModel.readOnly: true
      cast( _Field[1:AllocationFieldName = 'RBUKRS'].AllocationFieldMinimumValue as fis_bukrs)       as  CompanyCode,
      @ObjectModel.readOnly: true
      cast( _Field[1:AllocationFieldName = 'RLDNR'].AllocationFieldMinimumValue as fis_rldnr)        as  Ledger,
      @ObjectModel.readOnly: true
      cast( _Field[1:AllocationFieldName = 'CATEGORY'].AllocationFieldMinimumValue as fcom_category) as  AllocationCycleCategory, // missing GFN

      @ObjectModel.readOnly: true
      cast( _Field[1:AllocationFieldName = 'RACCT'].AllocationFieldMinimumValue as vksta)            as  AllocationCostElement,  
      
      AllocationPostingType,
      AllocationActualPlanVariant,  
      CreatedByUser,          
      
//      cast(case when _Template.TopDwnDistrCycleHash <> _Template._TemplateHeader.TopDwnDistrTmplHash then 'X' else '' end as xfeld) as AllocationCycleIsInconsistent,

//    ACDOC_PA = TDD - has to be checked, non TDD cycles are always consistent

//      cast (case 

//        when _Template.TopDwnDistrCycleHash = _Template._TemplateHeader.TopDwnDistrTmplHash or ( AllocationType <> 'ACDOC_PA' and AllocationPostingType <> 'K' ) 

//          then 'X' 

//        else 

//          '' 

//      end as xfeld) as AllocationCycleIsConsistent,

      
      cast (case when AllocationType = 'ACDOC_PA' and AllocationPostingType = 'K'
              then //TDD cycle

                case when _Template.TopDwnDistrCycleHash = _Template._TemplateHeader.TopDwnDistrTmplHash
                  then 'X'
                  else ''
                end       
              else //other cycles

                'X'
      end as xfeld) as AllocationCycleIsConsistent,    
      
      AllocationCycleRunGroup,
      
      //_Template.TopDwnDistrCycleHash,

      //_Template._TemplateHeader.TopDwnDistrTmplHash,

      //cast(case when _Template.TopDwnDistrCycleHash = _Template._TemplateHeader.TopDwnDistrTmplHash then 'X' else '' end as fco_alloc_consistency) as AllocationCycleIsConsistent,

      //cast(case when _Template.TopDwnDistrCycleHash = _Template._TemplateHeader.TopDwnDistrTmplHash then 'X' else '' end as xfeld) as AllocationCycleIsConsistent,

          
                         
      _Field,
      _Context,
      _ActualPlanText                    
}