P_Productmlaccountwd

DDL: P_PRODUCTMLACCOUNTWD SQL: PPRDMLACCOUNTWD Type: view COMPOSITE

P_Productmlaccountwd is a Composite CDS View in SAP S/4HANA. It reads from 6 data sources and exposes 22 fields with key fields Draftkey, ActiveProduct, ActiveValuationArea, ActiveInventoryValuationType, ActiveProduct.

Data Sources (6)

SourceAliasJoin Type
I_Productmlaccount ActiveDocument from
I_DraftAdministrativeData DraftAdministrativeData inner
P_Productmlaccountd DraftDocument left_outer
P_Productmlaccountd DraftDocument union_all
P_ProductD DraftRootDocument inner
P_ProductValuationD DraftValuationDocument inner

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PPRDMLACCOUNTWD view
AbapCatalog.compiler.compareFilter true view
VDM.viewType #COMPOSITE view
VDM.private true view
ClientDependent true view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (22)

KeyFieldSource TableSource FieldDescription
KEY Draftkey
KEY ActiveProduct I_Productmlaccount Product
KEY ActiveValuationArea I_Productmlaccount ValuationArea
KEY ActiveInventoryValuationType I_Productmlaccount ValuationType
ParentDraftKey
Product I_Productmlaccount Product
ValuationArea I_Productmlaccount ValuationArea
ValuationType I_Productmlaccount ValuationType
IsActiveEntity
HasActiveEntity
RootDraftKey
DraftKeyasDraftKey
KEY ActiveProduct P_Productmlaccountd ActiveProduct
KEY ActiveValuationArea P_Productmlaccountd ActiveValuationArea
KEY ActiveInventoryValuationType P_Productmlaccountd ActiveInventoryValuationType
ParentDraftKey P_Productmlaccountd ParentDraftKey
product P_ProductD product
IsActiveEntity
HasActiveEntity
HasDraftEntity
RootDraftKey P_Productmlaccountd Rootdraftkey
DraftAdministrativeDataUUID
@AbapCatalog.sqlViewName: 'PPRDMLACCOUNTWD'
@AbapCatalog.compiler.compareFilter: true
//@EndUserText.label: 'Product  ML Acocunt Union (draft)'

@VDM.viewType: #COMPOSITE
@VDM.private: true
@ClientDependent: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view P_Productmlaccountwd as

    select from I_Productmlaccount as ActiveDocument
          left outer join P_Productmlaccountd as DraftDocument on  DraftDocument.ActiveProduct = ActiveDocument.Product
                                                                  and DraftDocument.ActiveValuationArea = ActiveDocument.ValuationArea
                                                                  and DraftDocument.ActiveInventoryValuationType = ActiveDocument.ValuationType
    {
        key cast ( hextobin('00000000000000000000000000000000') as sysuuid_x )      as Draftkey,
        key ActiveDocument.Product                                                    as ActiveProduct,
        key ActiveDocument.ValuationArea                                                    as ActiveValuationArea,
        key ActiveDocument.ValuationType                                                    as ActiveInventoryValuationType,
        cast ( hextobin('00000000000000000000000000000000') as sysuuid_x )          as ParentDraftKey,          
        ActiveDocument.Product,
        ActiveDocument.ValuationArea,
        ActiveDocument.ValuationType,
//        ActiveDocument.PriceCtrlInPrevPeriodInd,

//        ActiveDocument.MovingAvgPricePrevPeriod,         

//        ActiveDocument.StandardPricePrevPeriod,

//        ActiveDocument.PriceUnitPrevPeriod,

//        ActiveDocument.ValuationClassInPrevPeriod,  //pstat

//        ActiveDocument.PriceControlInPrevYearInd, //pstat:delete

//        ActiveDocument.MovingAvgPricePrevYear,

//        ActiveDocument.ValuationClassInPrevYear,  //pstat delete

//        ActiveDocument.PriceDeterminationControl,   //pstat changes  

        cast( 'X' as boole_d )                                                      as IsActiveEntity, 
        cast( ' ' as boole_d )                                                      as HasActiveEntity, 
        cast(
        case
          when DraftDocument.DraftKey is null 
          then ' ' 
          else 'X'
        end  as boole_d)                                                            as HasDraftEntity,
        cast ( hextobin('00000000000000000000000000000000') as sysuuid_x )          as RootDraftKey,
        cast(DraftDocument.Rootdraftkey as sysuuid_x )                           as DraftAdministrativeDataUUID 
    }
    
union all
    
    select from P_Productmlaccountd as DraftDocument  
        inner join P_ProductD as DraftRootDocument on DraftRootDocument.Draftkey = DraftDocument.Rootdraftkey
        inner join P_ProductValuationD as DraftValuationDocument on DraftValuationDocument.Draftkey = DraftDocument.ParentDraftKey
        inner join I_DraftAdministrativeData  as DraftAdministrativeData 
                                                on   DraftAdministrativeData.DraftUUID       = DraftDocument.Rootdraftkey
   
{
    key DraftDocument.DraftKey                                              as DraftKey, 
    key DraftDocument.ActiveProduct                                         as ActiveProduct, 
    key DraftDocument.ActiveValuationArea                                   as ActiveValuationArea,
    key DraftDocument.ActiveInventoryValuationType                          as ActiveInventoryValuationType,
    DraftDocument.ParentDraftKey                                            as ParentDraftKey , 
    DraftRootDocument.product, 
    DraftValuationDocument.valuationarea,
    DraftValuationDocument.valuationtype,
//    DraftDocument.pricectrlinprevperiodind,

//    DraftDocument.movingavgpriceprevperiod,         

//    DraftDocument.standardpriceprevperiod,

//    DraftDocument.priceunitprevperiod,

//    DraftDocument.valuationclassinprevperiod,   //pstat delete

//    DraftDocument.pricecontrolinprevyearind,  //pstat:delete

//    DraftDocument.movingavgpriceprevyear,

//    DraftDocument.valuationclassinprevyear,     //pstat delete

//    DraftDocument.pricedeterminationcontrol ,  //pstat changes

    cast( ' ' as boole_d )                                                  as IsActiveEntity,
    cast( DraftDocument.hasactiveentity as boole_d )                        as HasActiveEntity, 
    cast( ' ' as boole_d )                                                  as HasDraftEntity, 
    DraftDocument.Rootdraftkey                                              as RootDraftKey  ,
    
   cast(DraftDocument.Rootdraftkey as sysuuid_x )                           as DraftAdministrativeDataUUID 
          }
         where
        DraftAdministrativeData.CreatedByUser = $session.user or DraftAdministrativeData.InProcessByUser = $session.user
          
  
  
  
  
 /*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_DRAFTADMINISTRATIVEDATA",
"I_PRODUCTMLACCOUNT",
"P_PRODUCTD",
"P_PRODUCTMLACCOUNTD",
"P_PRODUCTVALUATIOND"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/