if I run first part then run SELECT ANALYZE_STATISTICS ('BSEG'); it is ok. But if I run complete code it throws exception says 'Execution error: ERROR: Unsupported use of LIMIT/OFFSET clause' what is going on ?
it all started when I tried to add field Koart to bseg. I reverted but still gets error for a few days.
First part :
DROP VIEW IF EXISTS "BSEG_UNION";
--Start of customization section
--If you extract new records though Replication Cockpit, leave this CREATE VIEW BSEG_UNION statement and delete/comment out the second one.
CREATE VIEW "BSEG_UNION" AS (
SELECT * FROM "BSID"
UNION ALL
SELECT * FROM "BSAD"
);
--If you extract new records through Data Jobs, leave this CREATE VIEW BSEG_UNION statement and delete/comment out the first one.
/*
CREATE VIEW "BSEG_UNION" AS (
SELECT
MANDT,BUKRS,KUNNR,UMSKS,UMSKZ,AUGDT, AUGBL,ZUONR,GJAHR,BELNR,BUZEI, BUDAT,CPUDT,BSCHL,SHKZG,DMBTR,WRBTR,SGTXT,ZFBDT,ZTERM,ZBD1T,ZBD2T,ZBD3T,ZBD1P,ZBD2P,SKFBT,SKNTO,WSKTO,REBZG,REBZJ,REBZZ,MANSP,MSCHL,MANST,REBZT,AUGGJ,NULL AS AUGCP,_CELONIS_CHANGE_DATE
FROM "BSID"
UNION ALL
SELECT
MANDT,BUKRS,KUNNR,UMSKS,UMSKZ,AUGDT,AUGBL,ZUONR,GJAHR,BELNR,BUZEI, NULL AS BUDAT,NULL AS CPUDT,BSCHL,SHKZG,DMBTR,WRBTR,SGTXT,ZFBDT,ZTERM,ZBD1T,ZBD2T,ZBD3T,ZBD1P,ZBD2P,SKFBT,SKNTO,WSKTO,REBZG,REBZJ,REBZZ,MANSP,MSCHL,MANST,REBZT,AUGGJ,AUGCP,_CELONIS_CHANGE_DATE
FROM "BSEG_CL"
);
*/
--End of customization section
--THIS SECTION IS COMMON FOR RC AND NON-RC SETUP
DROP TABLE IF EXISTS "BSEG" ;
CREATE TABLE "BSEG" AS(
SELECT
ROW_NUMBER()
OVER(PARTITION BY "BSEG"."MANDT", "BSEG"."BUKRS", "BSEG"."BELNR", "BSEG"."GJAHR", "BSEG"."BUZEI"
ORDER BY "BSEG"."AUGBL","BSEG"."MANDT", "BSEG"."BUKRS", "BSEG"."BELNR", "BSEG"."GJAHR", "BSEG"."BUZEI" ) AS NUM
,"BSEG".*
FROM
"BSEG_UNION" AS BSEG
);
DELETE FROM "BSEG" WHERE NUM > 1;
ALTER TABLE "BSEG" DROP COLUMN NUM CASCADE;
DROP VIEW IF EXISTS "BSEG_UNION";