Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetIncludedStockingPoints ( 
 | 
  Units includedUnits 
 | 
) as owning StockingPoint_MPs 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Traverse Entity and get all SP included 
 | 
     
 | 
    includedStockingPoint := construct( StockingPoint_MPs ); 
 | 
     
 | 
    if( this.IsWorld() ) 
 | 
    { 
 | 
      includedStockingPoint := this.MacroPlan().StockingPoint_MP( relget ); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      includedStockingPoint := selectset( includedUnits,  
 | 
                                          Elements.StockingPoint_MP, sp, 
 | 
                                          guard( this.GetSubsetStockingPoint( sp ).IsIncluded(), true ) ); // Get derrived hierarchy from unit 
 | 
       
 | 
      // Add explicitly configured SP subset 
 | 
      includedLocalSet := selectset( this, SubsetEntityInOptimizerPuzzle, subSet, 
 | 
                                     subSet.Entity().istype( StockingPoint_MP ) 
 | 
                                     and subSet.IsIncluded() ); 
 | 
       
 | 
      includedLocalSP := selectset( includedLocalSet, Elements.Entity.astype( StockingPoint_MP ), sp, true );                                 
 | 
       
 | 
      includedStockingPoint := includedStockingPoint.Union( includedLocalSP ); 
 | 
    } 
 | 
     
 | 
    return &includedStockingPoint; 
 | 
  *] 
 | 
} 
 |