private int generateForecastResult(int M_Warehouse_ID){
  deleteData();
  m_period_definition_base=new MPPPeriodDefinition(getCtx(),m_run.getRef_DefinitionPeriod_ID(),get_TrxName());
  m_period_definition_target=new MPPPeriodDefinition(getCtx(),m_run.getPP_PeriodDefinition_ID(),get_TrxName());
  m_forecast_rule=(MPPForecastRule)m_run.getPP_ForecastRule();
  List<MPPPeriod> m_period_history=m_period_definition_base.getPeriodsOfHistory(m_run.getPeriodHistory());
  int selection=generateForecastRunMaster(m_run,m_forecast_definition,m_period_history.get(m_period_history.size() - 1),m_period_history.get(0));
  if (selection <= 0)   throw new IllegalArgumentException("@FindZeroRecords@");
  for (  MPPForecastRunMaster master : MPPForecastRunMaster.getLines(getCtx(),p_PP_ForecastRun_ID,get_TrxName())) {
    for (    MPPPeriod period : m_period_history) {
      createForecastRunDetail(master,period);
    }
  }
  return createForecastRunResult(M_Warehouse_ID);
}

private int generateForecastResult ( int M_Warehouse_ID ) { deleteData ( ) ; m_period_definition_base = new MPPPeriodDefinition ( getCtx ( ) , m_run . getRef_DefinitionPeriod_ID ( ) , get_TrxName ( ) ) ; m_period_definition_target = new MPPPeriodDefinition ( getCtx ( ) , m_run . getPP_PeriodDefinition_ID ( ) , get_TrxName ( ) ) ; m_forecast_rule = ( MPPForecastRule ) m_run . getPP_ForecastRule ( ) ; List < MPPPeriod > m_period_history = m_period_definition_base . getPeriodsOfHistory ( m_run . getPeriodHistory ( ) ) ; int selection = generateForecastRunMaster ( m_run , m_forecast_definition , m_period_history . get ( m_period_history . size ( ) - 1 ) , m_period_history . get ( 0 ) ) ; if ( selection <= 0 ) throw new IllegalArgumentException ( "@FindZeroRecords@" ) ; for ( MPPForecastRunMaster master : MPPForecastRunMaster . getLines ( getCtx ( ) , p_PP_ForecastRun_ID , get_TrxName ( ) ) ) { for ( MPPPeriod period : m_period_history ) { createForecastRunDetail ( master , period ) ; } } return createForecastRunResult ( M_Warehouse_ID ) ; }
generate forecast result based on forecast detail and forecast definition
