/**Begin D:\PDM_UPGRADE\PDM1\MSPLAN_constraint.sql **/
 EXEC P_ALTERPK 'PK_MSPLAN_PLANSCOPE_WHS', 'T_MSPLAN_PLANSCOPE_WHS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_WHS') CREATE INDEX IDX_MSPLAN_PLANSCOPE_WHS ON T_MSPLAN_PLANSCOPE_WHS ( FPLANSCOPE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_WHS_TYPE') CREATE INDEX IDX_MSPLAN_PLANSCOPE_WHS_TYPE ON T_MSPLAN_PLANSCOPE_WHS ( FEFFECTUATE_TYPE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_WHS_O') CREATE INDEX IDX_MSPLAN_PLANSCOPE_WHS_O ON T_MSPLAN_PLANSCOPE_WHS ( FCREATEORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_WHS_W') CREATE INDEX IDX_MSPLAN_PLANSCOPE_WHS_W ON T_MSPLAN_PLANSCOPE_WHS ( FWAREHOUSE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_WHS_INW') CREATE INDEX IDX_MSPLAN_PLANSCOPE_WHS_INW ON T_MSPLAN_PLANSCOPE_WHS ( FIS_ININV_WHS );


 EXEC P_ALTERPK 'PK_MSPLAN_PLANSCOPE_L', 'T_MSPLAN_PLANSCOPE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_L_FID') CREATE INDEX IDX_MSPLAN_PLANSCOPE_L_FID ON T_MSPLAN_PLANSCOPE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_MSPLAN_PLANSCOPE', 'T_MSPLAN_PLANSCOPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_FNUM') CREATE INDEX IDX_MSPLAN_PLANSCOPE_FNUM ON T_MSPLAN_PLANSCOPE ( FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_TYPE') CREATE INDEX IDX_MSPLAN_PLANSCOPE_TYPE ON T_MSPLAN_PLANSCOPE ( FTYPE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_ORG') CREATE INDEX IDX_MSPLAN_PLANSCOPE_ORG ON T_MSPLAN_PLANSCOPE ( FCREATEORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_NAME') CREATE INDEX IDX_MSPLAN_PLANSCOPE_NAME ON T_MSPLAN_PLANSCOPE ( FNAME );


 EXEC P_ALTERPK 'PK_MSPLAN_PLANSCOPE_WHS_L', 'T_MSPLAN_PLANSCOPE_WHS_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_PLANSCOPE_WHS_L') CREATE INDEX IDX_MSPLAN_PLANSCOPE_WHS_L ON T_MSPLAN_PLANSCOPE_WHS_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_MSPLAN_MATPLASCO', 'T_MSPLAN_MATPLASCO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_MATPLASCO_M') CREATE INDEX IDX_MSPLAN_MATPLASCO_M ON T_MSPLAN_MATPLASCO ( FMATERIAL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_MATPLASCO_ORG') CREATE INDEX IDX_MSPLAN_MATPLASCO_ORG ON T_MSPLAN_MATPLASCO ( FCREATEORGID );


 EXEC P_ALTERPK 'PK_MSPLAN_MATPLASCO_L', 'T_MSPLAN_MATPLASCO_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_MATPLASCO_L') CREATE INDEX IDX_MSPLAN_MATPLASCO_L ON T_MSPLAN_MATPLASCO_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_MSPLAN_MATPLASCO_ENTRY', 'T_MSPLAN_MATPLASCO_ENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MSPLAN_MATPLASCO_ENTRY') CREATE INDEX IDX_MSPLAN_MATPLASCO_ENTRY ON T_MSPLAN_MATPLASCO_ENTRY ( FID ,FSEQ );



/**End D:\PDM_UPGRADE\PDM1\MSPLAN_constraint.sql **/
