Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method ExportMPSPlanToDM ( 
 | 
  LibDEF_DataRepository defrepo, 
 | 
  LibDEF_SetMeta mpsPlanSetMeta_i, 
 | 
  Boolean mpsPlanAsNew_i, 
 | 
  String mpsPlanSetName_i 
 | 
) 
 | 
{ 
 | 
  Description: 'Export mpsplan to Data Manager via MPSPlan channel' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Make sure settype is created 
 | 
    setType := defrepo.FindSetType( LibDEC_ChannelMP_Plan::CHANNEL_NAME(), LibDEC_ChannelMP_Plan::SETTYPE_NAME_MP_Plan() ); 
 | 
     
 | 
    if( isnull( setType ) ) 
 | 
    { 
 | 
      setType := LibDEF_SetType::Create( defrepo, LibDEC_ChannelMP_Plan::CHANNEL_NAME(), LibDEC_ChannelMP_Plan::SETTYPE_NAME_MP_Plan() ); 
 | 
    } 
 | 
     
 | 
    set := selectobject( defrepo, Channel.SetType.Set, s, 
 | 
                         guard( s.GUID() = mpsPlanSetMeta_i.GUID(), false ) ) 
 | 
     
 | 
    if( mpsPlanAsNew_i ) 
 | 
    { 
 | 
      this.DataTransformationDefinition().CreateSet( setType, mpsPlanSetName_i ); 
 | 
    } 
 | 
    else 
 | 
    { 
 | 
      this.DataTransformationDefinition().UpdateSet( set ); 
 | 
    } 
 | 
  *] 
 | 
} 
 |