| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SynchronizeDisaggregatedSalesDemandInPeriod ( | 
|   Boolean isdeleteinvalid | 
| ) | 
| { | 
|   Description: 'Create or delete disaggregatedSDiP based on fulfillment restriction.' | 
|   TextBody: | 
|   [* | 
|     // Vincent Aug-30-2016 (created) | 
|      | 
|     salesdemands := construct( SalesDemandBases ); | 
|      | 
|     // get all pispips of leaf product for considered period | 
|     traverse( this.GetLeafPISPIPs(), Elements, leafpispip ) | 
|     {  | 
|       // Get PISPIP of all the parent product level because that is where the aggregated SDiP are tied to. | 
|       traverse( leafpispip.GetParentsOfProductDimension(), Elements.astype( ProductInStockingPointInPeriodPlanning ), parentpispip ) | 
|       { | 
|         // get all the non-leaf sales demands | 
|         sds := selectset( parentpispip, SalesDemandInPeriodBase.astype(AggregatedSalesDemandInPeriod ).SalesDemand, sd, true, true ); | 
|         salesdemands := salesdemands.Union( sds ); | 
|       } | 
|     } | 
|      | 
|     traverse( salesdemands, Elements, sd ) | 
|     {            | 
|       // synchronize disaggregated sdip to create dsdip for all possible product leaf | 
|       sd.SynchronizeDisaggregatedSalesDemandInPeriod( false );  | 
|     } | 
|   *] | 
| } |