@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":""
}
}*/