EXEC p_AlterColumn 'T_AP_INVMATCHOBJAENTRY', 'FCURINVOICELOCALAMT', 'DECIMAL(23,10)', 'NOT NULL', '0010', '0';
EXEC p_AlterColumn 'T_AP_INVMATCHOBJBENTRY', 'FCURINVOICELOCALAMT', 'DECIMAL(23,10)', 'NOT NULL', '0010', '0';
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AP_IM_DETAIL')
 CREATE TABLE T_AP_IM_DETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL,
FINVOICETYPE BIGINT DEFAULT 0 NOT NULL,
FCURRENCY BIGINT DEFAULT 0 NOT NULL,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FCURMATCHQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURMATCHBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMEASUREUNIT BIGINT DEFAULT 0 NOT NULL,
FBASEUNIT BIGINT DEFAULT 0 NOT NULL,
FCURMATCHAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURMATCHTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURMATCHTOTALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEQTYDIFF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMTDIFF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXDIFF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICETOTALDIFF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVOICEID BIGINT DEFAULT 0 NOT NULL,
FINVOICEENTRYID BIGINT DEFAULT 0 NOT NULL,
FMATCHRECORDID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AP_IM_DETAILENTRY')
 CREATE TABLE T_AP_IM_DETAILENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBIZTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATCHOBJECT NVARCHAR(36) DEFAULT ' ' NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FMEASUREUNIT BIGINT DEFAULT 0 NOT NULL,
FBASEUNIT BIGINT DEFAULT 0 NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FCURMATCHQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURMATCHBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURMATCHAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURMATCHTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURMATCHTOTALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICEDIFF DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURINVOICEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURINVOICEBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURINVOICEAMT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURINVOICETAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURINVOICETOTALAMT DECIMAL(23,10) DEFAULT 0 NOT NULL
);


