| Quintiq file version 2.0 | 
| #parent: ListScenario | 
| Response OnClick ( | 
|   structured[Scenario] selection | 
| ) id:Response_ListScenario_MenuScenarioNewMacroPlan_OnClick #extension | 
| { | 
|   Body: | 
|   [* | 
|     // To be derived - ScenarioMP | 
|      | 
|     macroPlanOld := MacroPlan; | 
|     if ( not isnull( macroPlanOld ) ) { | 
|         info( "ListScrnario.MenuScenarioNewMacroPlan.OnClick  macroPlanOld : " + [String]macroPlanOld.MDSID() ); | 
|     } | 
|      | 
|      | 
|     // Create a new Scenario | 
|     dlg := construct( ScenarioManager_DialogCreateEditMPScenario ); | 
|     parent := selection.Element( 0 ).Parent(); | 
|     scenario := dlg.NewScenario( this, ScenarioManager, parent, false ); | 
|      | 
|     if( not isnull( scenario ) ) | 
|     { | 
|       ApplicationLibMacroPlanner.AutoExpandSelection( this, scenario ); | 
|       // To make sure the active scenario on the supply chain overview panel is updated | 
|       ApplicationLibMacroPlanner.SelectScenario( scenario, Form ); | 
|        | 
|       // Launch supply chain wizard upon scenario creation | 
|       if( ScenarioManager.LaunchInitializationWizardAtScenarioCreation() ) | 
|       { | 
|         ApplicationLibMacroPlanner.LaunchInitializationWizard( MacroPlan ); | 
|       } | 
|     } | 
|      | 
|     macroPlanNew := MacroPlan; | 
|     if ( not isnull( macroPlanNew ) ) { | 
|         info( "ListScrnario.MenuScenarioNewMacroPlan.OnClick  macroPlanNew : " + [String]macroPlanNew.MDSID() ); | 
|     } | 
|     ManufactureLTImputation::Transfer( macroPlanOld, macroPlanNew ); | 
|   *] | 
|   Precondition: | 
|   [* | 
|     return not isnull( ScenarioManager ) and selection.Element( 0 ).CanCreate( feedback, true ); | 
|   *] | 
| } |