P_ALLOCATIONCYCLECALC

CDS View

Allocation Cycle Calculated Fields

P_ALLOCATIONCYCLECALC is a CDS View in S/4HANA. Allocation Cycle Calculated Fields. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_AllocationCycle view from CONSUMPTION Allocation Cycle
@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,  
      @ObjectModel.readOnly: true
      cast( _Field[1:AllocationFieldName = 'KOKRS'].AllocationFieldMinimumValue as fis_kokrs )       as ControllingArea,
      
      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                    
}