Sei sulla pagina 1di 28

To Restore Older Aging Snapshots When A Full ETL Is Run

Versions Applicable: Oracle BI Applications, Financial Analytics, 7.9.6.1, 7.9.6.2,


7.9.6.3, 7.9.6.4

Problem Description: Note that anytime a full ETL is done then the financial aging
aggregate tables are truncated and reloaded which means all past snapshots will be lost.
To overcome this problem we are providing a manual fix to restore the older snapshots
if backups of the aging aggregate tables are already taken.
This document explains in details the solution/steps that should be performed to
restore the aggregates.

Design Overview

Section1:

• This section is applicable only when the customer has taken a backup of their
older warehouse or atleast the backup of the aging tables and if a full load is
already run and they are seeing that their older snapshots are missing after full
ETL.
• We have provided manual sql scripts (DDL and DML) to restore the older
snapshots from the aging backup tables into the actual aging tables which
customer has to run on their warehouse.
• We know that once a full load is run then the dimensional wids would change
and we wont be able to use the older snapshots in the backup table as is
because they would be pointing to older wids and hence reports wont render
any data.
• Therefore first we are updating the new dimension wids for the older snapshots
present in the backup tables and then push the aging data into the actual aging
table.
• This way we will restore the older snapshots into the aging table.

Section2:

• This is a long-term automated solution to restore snapshots after each full load.
• This requires just one time manual intervention where the sql scripts are directly
incorporated into SIL and PLP informatica sessions.
• This will ultimately take care of restoring the older snapshots into the aging
tables after the full load.
Note1: Steps under SECTION1 are to be followed only if there is a backup of the older
warehouse or at least the backup of the aging tables and if a full load is already run.

If the backup of the older warehouse or aging tables is not taken and a customer wishes
to run Full load then skip SECTION1 and directly follow the steps in SECTION2.

Note2: If the data model between two full loads is different (say if customer moves
from one release to another and a new wid is added in the aging tables in latest
release). The below scripts will still work but the new wid will be null (not 0) for the
older snapshots.

Design:

SECTION 1

For the first time manual fix has to be performed:

AP Fixes

To Fix W_AP_AGING_INVOICE_A

Step1: Updating the AP invoice aging backup temp table with the latest dimension
WIDs

Note: If the aging backup tables are available in a different db , please create a dblink
and then use that in the below scripts.

Pre-requisite Step:

• The below sql statements will create the backup tables from the backed up
warehouse or aging table backups taken before full load for further processing.

Run the below statements:


CREATE TABLE W_AP_AGING_INVOICE_A_BKP AS SELECT * FROM
W_AP_AGING_INVOICE_A@<DBLinkName>;--W_AP_AGING_INVOICE_A@<DBLinkName>
is the back up table taken before full load

CREATE TABLE W_AP_AGING_INVOICE_A_OLD AS SELECT * FROM


W_AP_AGING_INVOICE_A@<DBLinkName>;--W_AP_AGING_INVOICE_A@<DBLinkName>
is the back up table taken before full load

CREATE TABLE W_AP_AGING_SUPPLIER_A_BKP AS SELECT * FROM


W_AP_AGING_SUPPLIER_A@<DBLinkName>;--W_AP_AGING_SUPPLIER_A@<DBLinkName>
is the back up table taken before full load
• The below sql statements will delete snapshots from the backup tables if there
are any overlapping snapshots between the current warehouse and backed up
warehouse.

Run the below statements:


DELETE FROM W_AP_AGING_INVOICE_A_BKP OL
WHERE EXISTS(
SELECT * FROM W_AP_AGING_INVOICE_A CU
WHERE
OL.SNAPSHOT_DT_WID = CU.SNAPSHOT_DT_WID
AND
OL.MCAL_CAL_WID=CU.MCAL_CAL_WID
AND
OL.DATASOURCE_NUM_ID=CU.DATASOURCE_NUM_ID);

DELETE FROM W_AP_AGING_INVOICE_A_OLD OL


WHERE EXISTS(
SELECT * FROM W_AP_AGING_INVOICE_A CU
WHERE
OL.SNAPSHOT_DT_WID = CU.SNAPSHOT_DT_WID
AND
OL.MCAL_CAL_WID=CU.MCAL_CAL_WID
AND
OL.DATASOURCE_NUM_ID=CU.DATASOURCE_NUM_ID);

DELETE FROM W_AP_AGING_SUPPLIER_A_BKP OL


WHERE EXISTS(
SELECT * FROM W_AP_AGING_SUPPLIER_A CU
WHERE
OL.SNAPSHOT_DT_WID = CU.SNAPSHOT_DT_WID
AND
OL.MCAL_CAL_WID=CU.MCAL_CAL_WID
AND
OL.DATASOURCE_NUM_ID=CU.DATASOURCE_NUM_ID);

• The below sql statements update the backup invoice aging table's dimension
WIDs using latest base fact table's dimension WIDs. Backup aging table rows will
be matched with latest base fact table rows via purch_invoice_num.
• The second update statement updates the backup invoice aging table's
DOC_STATUS_WID with the open status from the latest status dimension table
since aging considers only the open status records and now in the latest base
fact these might have got a cleared status. So explicitly we are updating them
with latest wid having the open status.

Run the below statements:


UPDATE W_AP_AGING_INVOICE_A_BKP
SET
(SUPPLIER_WID,SPLR_ACCT_WID,PURCH_REP_WID,PRODUCT_WID,INVENTORY_PROD_WI
D,SUPPLIER_PROD_WID,COMPANY_LOC_WID,PLANT_LOC_WID,OPERATING_UNIT_ORG_WI
D,PAYABLES_ORG_WID,LEDGER_WID,COMPANY_ORG_WID,BUSN_AREA_ORG_WID,CTRL_AR
EA_ORG_WID,PURCH_ORG_WID,ISSUE_ORG_WID,DOC_TYPE_WID,REF_DOC_TYPE_WID,PO
STING_TYPE_WID,COST_CENTER_WID,PROFIT_CENTER_WID,TAX_WID,PAY_TERMS_WID,
PAYMENT_METHOD_WID,SOURCE_WID,CREATED_BY_WID,CHANGED_BY_WID,MCAL_CAL_WI
D,PROJECT_WID,EXPENDITURE_ORG_WID)
=
(SELECT
W_AP_XACT_F.SUPPLIER_WID,
W_AP_XACT_F.SPLR_ACCT_WID,
W_AP_XACT_F.PURCH_REP_WID,
W_AP_XACT_F.PRODUCT_WID,
W_AP_XACT_F.INVENTORY_PROD_WID,
W_AP_XACT_F.SUPPLIER_PROD_WID,
W_AP_XACT_F.COMPANY_LOC_WID,
W_AP_XACT_F.PLANT_LOC_WID,
W_AP_XACT_F.OPERATING_UNIT_ORG_WID,
W_AP_XACT_F.PAYABLES_ORG_WID,
W_AP_XACT_F.LEDGER_WID,
W_AP_XACT_F.COMPANY_ORG_WID,
W_AP_XACT_F.BUSN_AREA_ORG_WID,
W_AP_XACT_F.CTRL_AREA_ORG_WID,
W_AP_XACT_F.PURCHASE_ORG_WID,
W_AP_XACT_F.ISSUE_ORG_WID,
W_AP_XACT_F.DOC_TYPE_WID,
W_AP_XACT_F.REF_DOC_TYPE_WID,
W_AP_XACT_F.POSTING_TYPE_WID,
W_AP_XACT_F.COST_CENTER_WID,
W_AP_XACT_F.PROFIT_CENTER_WID,
W_AP_XACT_F.TAX_TYPE_WID,
W_AP_XACT_F.PAY_TERMS_WID,
W_AP_XACT_F.PAY_METHOD_WID,
W_AP_XACT_F.SOURCE_WID,
W_AP_XACT_F.CREATED_BY_WID,
W_AP_XACT_F.CHANGED_BY_WID,
W_AP_XACT_F.MCAL_CAL_WID,
W_AP_XACT_F.PROJECT_WID,
W_AP_XACT_F.EXPENDITURE_ORG_WID
FROM
W_AP_XACT_F,
W_XACT_TYPE_D
WHERE
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=
W_AP_XACT_F.DATASOURCE_NUM_ID AND
W_AP_XACT_F.DATASOURCE_NUM_ID=W_XACT_TYPE_D.DATASOURCE_NUM_ID AND
W_AP_AGING_INVOICE_A_BKP.PURCH_INVOICE_NUM =
W_AP_XACT_F.PURCH_INVOICE_NUM AND
W_AP_AGING_INVOICE_A_BKP.REF_DOC_NUM = W_AP_XACT_F.REF_DOC_NUM AND
W_AP_XACT_F.DOC_TYPE_WID=W_XACT_TYPE_D.ROW_WID AND
W_XACT_TYPE_D.W_XACT_TYPE_CODE IN ('ORIGINAL'));

COMMIT;
UPDATE W_AP_AGING_INVOICE_A_BKP SET DOC_STATUS_WID = (SELECT ROW_WID
FROM W_STATUS_D WHERE W_SUBSTATUS_CODE='OPEN~UNPOSTED' AND
W_STATUS_CLASS='ACCT_DOC'
AND
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=W_STATUS_D.DATASOURCE_NUM_ID
);

COMMIT;

To Fix W_AP_AGING_SUPPLIER_A

Step2: Updating the AP supplier aging backup temp table with the latest dimension
WIDs

• The below sql statements update the backup supplier aging table's dimension
WIDs with the latest dimension wids using the updated invoice aging table’s
dimension wids (updated in previous step) and the older invoice aging backup
(W_AP_AGING_INVOICE_A_OLD).
• Note updated backup invoice aging table’s rows will be matched with older
invoice aging backup table rows via purch_invoice_num.
• And the latest dimension wids will be updated in the supplier-aging backup by
matching the existing dimension wids of supplier aging backup with the older
dimension wids of older invoice aging backup and getting the new dimension
wids from the updated invoice aging backup table.

Run the below statements:


UPDATE W_AP_AGING_SUPPLIER_A_BKP SET
(MCAL_CAL_WID,SUPPLIER_WID,SPLR_ACCT_WID,COMPANY_LOC_WID,OPERATING_UNIT
_ORG_WID,PAYABLES_ORG_WID,LEDGER_WID,COMPANY_ORG_WID,BUSN_AREA_ORG_WID,
EXPENDITURE_ORG_WID)
=
(SELECT DISTINCT
MCAL_CAL_WID_NEW,
SUPPLIER_WID_NEW,
SPLR_ACCT_WID_NEW,
COMPANY_LOC_WID_NEW,
OPERATING_UNIT_ORG_WID_NEW,
PAYABLES_ORG_WID_NEW,
LEDGER_WID_NEW,
COMPANY_ORG_WID_NEW,
BUSN_AREA_ORG_WID_NEW,
EXPENDITURE_ORG_WID_NEW

FROM
(SELECT DISTINCT
W_AP_AGING_INVOICE_A_BKP.MCAL_CAL_WID MCAL_CAL_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.MCAL_CAL_WID MCAL_CAL_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.SUPPLIER_WID SUPPLIER_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.SUPPLIER_WID SUPPLIER_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.SPLR_ACCT_WID SPLR_ACCT_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.SPLR_ACCT_WID SPLR_ACCT_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.COMPANY_LOC_WID COMPANY_LOC_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.COMPANY_LOC_WID COMPANY_LOC_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.PAYABLES_ORG_WID PAYABLES_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.PAYABLES_ORG_WID PAYABLES_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.LEDGER_WID LEDGER_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.LEDGER_WID LEDGER_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.COMPANY_ORG_WID COMPANY_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.COMPANY_ORG_WID COMPANY_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.EXPENDITURE_ORG_WID EXPENDITURE_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.EXPENDITURE_ORG_WID EXPENDITURE_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID DATASOURCE_NUM_ID
FROM
W_AP_AGING_INVOICE_A_BKP,
W_AP_AGING_INVOICE_A_OLD
WHERE
W_AP_AGING_INVOICE_A_BKP.PURCH_INVOICE_NUM=W_AP_AGING_INVOICE_A_OLD.PUR
CH_INVOICE_NUM AND
W_AP_AGING_INVOICE_A_BKP.REF_DOC_NUM=W_AP_AGING_INVOICE_A_OLD.REF_DOC_N
UM AND
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=W_AP_AGING_INVOICE_A_OLD.
DATASOURCE_NUM_ID AND
W_AP_AGING_INVOICE_A_BKP.SNAPSHOT_DT_WID=W_AP_AGING_INVOICE_A_OLD.
SNAPSHOT_DT_WID
) TMP_WIDS
WHERE
W_AP_AGING_SUPPLIER_A_BKP.DATASOURCE_NUM_ID=TMP_WIDS.DATASOURCE_N
UM_ID AND
W_AP_AGING_SUPPLIER_A_BKP.SUPPLIER_WID=TMP_WIDS.SUPPLIER_WID_OLD
AND
W_AP_AGING_SUPPLIER_A_BKP.MCAL_CAL_WID=TMP_WIDS.MCAL_CAL_WID_OLD
AND
W_AP_AGING_SUPPLIER_A_BKP.SPLR_ACCT_WID=TMP_WIDS.SPLR_ACCT_WID_OL
D AND
W_AP_AGING_SUPPLIER_A_BKP.COMPANY_LOC_WID=TMP_WIDS.COMPANY_LOC_WI
D_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.OPERATING_UNIT_ORG_WID=TMP_WIDS.OPERATI
NG_UNIT_ORG_WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.PAYABLES_ORG_WID=TMP_WIDS.PAYABLES_ORG_
WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.LEDGER_WID=TMP_WIDS.LEDGER_WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.COMPANY_ORG_WID=TMP_WIDS.COMPANY_ORG_WI
D_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.BUSN_AREA_ORG_WID=TMP_WIDS.BUSN_AREA_OR
G_WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.EXPENDITURE_ORG_WID=TMP_WIDS.EXPENDITUR
E_ORG_WID_OLD );
COMMIT;
Step3: Inserting the updated data from the AP invoice aging backup table and AP
supplier aging backup table into the main aggregate tables.

• The below sql statements insert back the updated older aging snapshot data
back into the latest invoice aging and supplier aging tables from the updated
invoice aging backup and updated supplier aging backup tables updated in the
previous steps respectively.
• Finally the previously created backup tables are dropped.

Run the below statements:


INSERT INTO W_AP_AGING_INVOICE_A (SELECT * FROM
W_AP_AGING_INVOICE_A_BKP);

COMMIT;

INSERT INTO W_AP_AGING_SUPPLIER_A (SELECT * FROM


W_AP_AGING_SUPPLIER_A_BKP);

COMMIT;

DROP TABLE W_AP_AGING_INVOICE_A_BKP;

DROP TABLE W_AP_AGING_INVOICE_A_OLD;

DROP TABLE W_AP_AGING_SUPPLIER_A_BKP;

The above steps should restore the older snapshots.


AR Fixes

To Fix W_AR_AGING_INVOICE_A

Step1: Updating the AR invoice aging backup temp table with the latest dimension
WIDs

Note: If the aging backup tables are available in a different db , please create a dblink
and then use that in the below scripts.

Pre-requisite Step:

• The below sql statements will create the backup tables from the backed up
warehouse or aging table backups taken before full load for further processing.

Run the below statements

CREATE TABLE W_AR_AGING_INVOICE_A_BKP AS SELECT * FROM


W_AR_AGING_INVOICE_A@<DBLinkName>;--W_AR_AGING_INVOICE_A@<DBLinkName>
is the back up table taken before full load

CREATE TABLE W_AR_AGING_INVOICE_A_OLD AS SELECT * FROM


W_AR_AGING_INVOICE_A@<DBLinkName>;--W_AR_AGING_INVOICE_A@<DBLinkName>
is the back up table taken before full load

CREATE TABLE W_AR_AGING_CUSTOMER_A_BKP AS SELECT * FROM


W_AR_AGING_CUSTOMER_A@<DBLinkName>;--W_AR_AGING_CUSTOMER_A@<DBLinkName>
is the back up table taken before full load

• The below sql statements will delete snapshots from the backup tables if there
are any overlapping snapshots between the current warehouse and backed up
warehouse.

Run the below statements:


DELETE FROM W_AR_AGING_INVOICE_A_BKP OL
WHERE EXISTS(
SELECT * FROM W_AR_AGING_INVOICE_A CU
WHERE
OL.SNAPSHOT_DT_WID = CU.SNAPSHOT_DT_WID
AND
OL.MCAL_CAL_WID=CU.MCAL_CAL_WID
AND
OL.DATASOURCE_NUM_ID=CU.DATASOURCE_NUM_ID);

DELETE FROM W_AR_AGING_INVOICE_A_OLD OL


WHERE EXISTS(
SELECT * FROM W_AR_AGING_INVOICE_A CU
WHERE
OL.SNAPSHOT_DT_WID = CU.SNAPSHOT_DT_WID
AND
OL.MCAL_CAL_WID=CU.MCAL_CAL_WID
AND
OL.DATASOURCE_NUM_ID=CU.DATASOURCE_NUM_ID);

DELETE FROM W_AR_AGING_CUSTOMER_A_BKP OL


WHERE EXISTS(
SELECT * FROM W_AR_AGING_CUSTOMER_A CU
WHERE
OL.SNAPSHOT_DT_WID = CU.SNAPSHOT_DT_WID
AND
OL.MCAL_CAL_WID=CU.MCAL_CAL_WID
AND
OL.DATASOURCE_NUM_ID=CU.DATASOURCE_NUM_ID);

• The below sql statements update the backup invoice aging table's dimension
WIDs using latest base fact table's dimension WIDs. Backup aging table rows will
be matched with latest base fact table rows via sales_invoice_num and
ref_doc_num.

Run the below statements:


UPDATE W_AR_AGING_INVOICE_A_BKP
SET
(CUSTOMER_WID,CUSTOMER_ACCNT_WID,CUSTOMER_FIN_PROFL_WID,TERRITORY_WID,S
ALES_GROUP_ORG_WID,CUSTOMER_CONTACT_WID,CUSTOMER_SOLD_TO_LOC_WID,CUSTOM
ER_SHIP_TO_LOC_WID,CUSTOMER_BILL_TO_LOC_WID,CUSTOMER_PAYER_LOC_WID,SALE
S_REP_WID,PRODUCT_WID,SALES_PRODUCT_WID,COMPANY_LOC_WID,SALES_OFC_LOC_W
ID,OPERATING_UNIT_ORG_WID,RECEIVABLES_ORG_WID,LEDGER_WID,COMPANY_ORG_WI
D,BUSN_AREA_ORG_WID,CTRL_AREA_ORG_WID,SALES_ORG_WID,COST_CENTER_WID,PRO
FIT_CENTER_WID,PAY_TERMS_WID,PAYMENT_METHOD_WID,CREATED_BY_WID,CHANGED_
BY_WID,MCAL_CAL_WID,PROJECT_WID,AGREEMENT_WID,PROJECT_ORG_WID

)
=
(SELECT
W_AR_XACT_F.CUSTOMER_WID,
W_AR_XACT_F.CUSTOMER_ACCNT_WID,
W_AR_XACT_F.CUSTOMER_FIN_PROFL_WID,
W_AR_XACT_F.TERRITORY_WID,
W_AR_XACT_F.SALES_GROUP_ORG_WID,
W_AR_XACT_F.CUSTOMER_CONTACT_WID,
W_AR_XACT_F.CUSTOMER_SOLD_TO_LOC_WID,
W_AR_XACT_F.CUSTOMER_SHIP_TO_LOC_WID,
W_AR_XACT_F.CUSTOMER_BILL_TO_LOC_WID,
W_AR_XACT_F.CUSTOMER_PAYER_LOC_WID,
W_AR_XACT_F.SALES_REP_WID,
W_AR_XACT_F.PRODUCT_WID,
W_AR_XACT_F.SALES_PRODUCT_WID,
W_AR_XACT_F.COMPANY_LOC_WID,
W_AR_XACT_F.SALES_OFC_LOC_WID,
W_AR_XACT_F.OPERATING_UNIT_ORG_WID,
W_AR_XACT_F.RECEIVABLES_ORG_WID,
W_AR_XACT_F.LEDGER_WID,
W_AR_XACT_F.COMPANY_ORG_WID,
W_AR_XACT_F.BUSN_AREA_ORG_WID,
W_AR_XACT_F.CTRL_AREA_ORG_WID,
W_AR_XACT_F.SALES_ORG_WID,
W_AR_XACT_F.COST_CENTER_WID,
W_AR_XACT_F.PROFIT_CENTER_WID,
W_AR_XACT_F.PAY_TERMS_WID,
W_AR_XACT_F.PAYMENT_METHOD_WID,
W_AR_XACT_F.CREATED_BY_WID,
W_AR_XACT_F.CHANGED_BY_WID,
W_AR_XACT_F.MCAL_CAL_WID,
W_AR_XACT_F.PROJECT_WID,
W_AR_XACT_F.AGREEMENT_WID,
W_AR_XACT_F.PROJECT_ORG_WID
FROM
W_AR_XACT_F,
W_XACT_TYPE_D
WHERE
W_AR_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=
W_AR_XACT_F.DATASOURCE_NUM_ID AND
W_AR_XACT_F.DATASOURCE_NUM_ID=W_XACT_TYPE_D.DATASOURCE_NUM_ID AND
W_AR_AGING_INVOICE_A_BKP.SALES_INVOICE_NUM =
W_AR_XACT_F.SALES_INVOICE_NUM AND
W_AR_AGING_INVOICE_A_BKP.REF_DOC_NUM = W_AR_XACT_F.REF_DOC_NUM AND
W_AR_XACT_F.DOC_TYPE_WID=W_XACT_TYPE_D.ROW_WID AND
W_XACT_TYPE_D.W_XACT_TYPE_CODE = 'ORIGINAL' AND
W_XACT_TYPE_D.W_XACT_SUBTYPE_CODE IN ('INVOICE','CR MEMO','DR
MEMO'));

COMMIT;

To Fix W_AR_AGING_CUSTOMER_A

Step2: Updating the AR customer aging backup temp table with the latest dimension
WIDs

• The below sql statements update the backup supplier aging table's dimension
WIDs with the latest dimension wids using the updated invoice aging table’s
dimension wids (updated in previous step) and the older invoice aging backup
(W_AR_AGING_INVOICE_A_OLD).
• Note updated backup invoice aging table’s rows will be matched with older
invoice aging backup table rows via sales_invoice_num.
• And the latest dimension wids will be updated in the supplier-aging backup by
matching the existing dimension wids of supplier aging backup with the older
dimension wids of older invoice aging backup and getting the new dimension
wids from the updated invoice aging backup table.
Run the below statements:

UPDATE W_AR_AGING_CUSTOMER_A_BKP
SET
(MCAL_CAL_WID,CUSTOMER_WID,CUSTOMER_ACCNT_WID,TERRITORY_WID,SALES_GROUP
_ORG_WID,COMPANY_LOC_WID,SALES_OFC_LOC_WID,
OPERATING_UNIT_ORG_WID,SALES_ORG_WID,LEDGER_WID,
COMPANY_ORG_WID,BUSN_AREA_ORG_WID,RECEIVABLES_ORG_WID,SALES_REP_WID,PRO
JECT_ORG_WID
)
=
(SELECT DISTINCT
MCAL_CAL_WID_NEW,
CUSTOMER_WID_NEW,
CUSTOMER_ACCNT_WID_NEW,
TERRITORY_WID_NEW,
SALES_GROUP_ORG_WID_NEW,
COMPANY_LOC_WID_NEW,
SALES_OFC_LOC_WID_NEW,
OPERATING_UNIT_ORG_WID_NEW,
SALES_ORG_WID_NEW,
LEDGER_WID_NEW,
COMPANY_ORG_WID_NEW,
BUSN_AREA_ORG_WID_NEW,
RECEIVABLES_ORG_WID_NEW,
SALES_REP_WID_NEW,
PROJECT_ORG_WID_NEW

FROM

(SELECT DISTINCT
W_AR_AGING_INVOICE_A_BKP.MCAL_CAL_WID MCAL_CAL_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.MCAL_CAL_WID MCAL_CAL_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.CUSTOMER_WID CUSTOMER_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.CUSTOMER_WID CUSTOMER_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.CUSTOMER_ACCNT_WID CUSTOMER_ACCNT_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.CUSTOMER_ACCNT_WID CUSTOMER_ACCNT_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.TERRITORY_WID TERRITORY_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.TERRITORY_WID TERRITORY_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_GROUP_ORG_WID SALES_GROUP_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_GROUP_ORG_WID SALES_GROUP_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.COMPANY_LOC_WID COMPANY_LOC_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.COMPANY_LOC_WID COMPANY_LOC_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_OFC_LOC_WID SALES_OFC_LOC_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_OFC_LOC_WID SALES_OFC_LOC_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_ORG_WID SALES_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_ORG_WID SALES_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.LEDGER_WID LEDGER_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.LEDGER_WID LEDGER_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.COMPANY_ORG_WID COMPANY_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.COMPANY_ORG_WID COMPANY_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.RECEIVABLES_ORG_WID RECEIVABLES_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.RECEIVABLES_ORG_WID RECEIVABLES_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_REP_WID SALES_REP_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_REP_WID SALES_REP_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.PROJECT_ORG_WID PROJECT_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.PROJECT_ORG_WID PROJECT_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID DATASOURCE_NUM_ID
FROM
W_AR_AGING_INVOICE_A_BKP,
W_AR_AGING_INVOICE_A_OLD
WHERE
W_AR_AGING_INVOICE_A_BKP.SALES_INVOICE_NUM =
W_AR_AGING_INVOICE_A_OLD.SALES_INVOICE_NUM AND
W_AR_AGING_INVOICE_A_BKP.REF_DOC_NUM =
W_AR_AGING_INVOICE_A_OLD.REF_DOC_NUM AND
W_AR_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=
W_AR_AGING_INVOICE_A_OLD.DATASOURCE_NUM_ID AND
W_AR_AGING_INVOICE_A_BKP.SNAPSHOT_DT_WID=
W_AR_AGING_INVOICE_A_OLD.SNAPSHOT_DT_WID) TMP_WIDS
WHERE
W_AR_AGING_CUSTOMER_A_BKP.DATASOURCE_NUM_ID =
TMP_WIDS.DATASOURCE_NUM_ID AND
W_AR_AGING_CUSTOMER_A_BKP.CUSTOMER_WID = TMP_WIDS.CUSTOMER_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.MCAL_CAL_WID = TMP_WIDS.MCAL_CAL_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.CUSTOMER_ACCNT_WID =
TMP_WIDS.CUSTOMER_ACCNT_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.TERRITORY_WID = TMP_WIDS.TERRITORY_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_GROUP_ORG_WID =
TMP_WIDS.SALES_GROUP_ORG_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.COMPANY_LOC_WID =
TMP_WIDS.COMPANY_LOC_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_OFC_LOC_WID =
TMP_WIDS.SALES_OFC_LOC_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.OPERATING_UNIT_ORG_WID =
TMP_WIDS.OPERATING_UNIT_ORG_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_ORG_WID = TMP_WIDS.SALES_ORG_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.LEDGER_WID = TMP_WIDS.LEDGER_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.COMPANY_ORG_WID =
TMP_WIDS.COMPANY_ORG_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.BUSN_AREA_ORG_WID =
TMP_WIDS.BUSN_AREA_ORG_WID_OLD AND

W_AR_AGING_CUSTOMER_A_BKP.RECEIVABLES_ORG_WID=TMP_WIDS.RECEIVABLES_ORG_
WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_REP_WID = TMP_WIDS.SALES_REP_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.PROJECT_ORG_WID =
TMP_WIDS.PROJECT_ORG_WID_OLD );

COMMIT;
Step3: Inserting the updated data from the AR invoice aging backup table and AR
customer aging backup table into the main aggregate tables.

• The below sql statements insert back the updated older aging snapshot data
back into the latest invoice aging and supplier aging tables from the updated
invoice aging backup and updated supplier aging backup tables updated in the
previous steps respectively.
• Finally the previously created backup tables are dropped.

Run the below statements:


INSERT INTO W_AR_AGING_INVOICE_A (SELECT * FROM
W_AR_AGING_INVOICE_A_BKP);

COMMIT;

INSERT INTO W_AR_AGING_CUSTOMER_A (SELECT * FROM


W_AR_AGING_CUSTOMER_A_BKP);

COMMIT;

DROP TABLE W_AR_AGING_INVOICE_A_BKP;

DROP TABLE W_AR_AGING_INVOICE_A_OLD;

DROP TABLE W_AR_AGING_CUSTOMER_A_BKP;

The above steps should restore the older snapshots.


SECTION 2

For the subsequent fix for the next Full ETL

The below steps should be implemented in informatica sessions for restoring the aging
snapshots automatically when a full load is done subsequently.

AP Fixes

Step1:
-----------SIL Phase------------

1. Checkout the Informatica session : SIL_APTransactionFact_Full under SILOS


folder from the Informatica workflow manager.
2. Go to the Mappings Tab

3. Select the Targets (W_AP_XACT_F)


4. Go to Properties tab and paste the below sql statements in the Post SQL (in box)
Flow:
• The below sql statements will create the backup tables from the existing
aging tables for further processing as a first step after the SIL runs and
loads the latest data into the base fact table.
• Next they update the backup invoice aging table's dimension WIDs using
latest base fact table's dimension WIDs. Backup aging table rows will be
matched with latest base fact table rows via purch_invoice_num.
• The second update statement updates the backup invoice aging table's
DOC_STATUS_WID with the open status from the latest status dimension
table since aging considers only the open status records and now in the
latest base fact these might have got cleared. So explicitly we are
updating them with latest wid having the open status.
• The third update statement updates the backup supplier aging table's
dimension WIDs using the updated invoice aging table’s dimension wids
(updated in previous step) and the existing invoice aging table
(W_AP_AGING_INVOICE_A which is still available in the warehouse as
PLP phase has not yet started and truncated the invoice aging table).
• Note updated backup invoice aging table‘s rows will be matched with
existing invoice aging table’s rows via purch_invoice_num.
• And the latest dimension wids will be updated in the supplier aging
backup by matching the existing dimension wids of supplier aging backup
with the older dimension wids of existing invoice aging table and getting
the new dimension wids from the updated invoice aging backup table.

CREATE TABLE W_AP_AGING_INVOICE_A_BKP AS SELECT * FROM


W_AP_AGING_INVOICE_A;

CREATE TABLE W_AP_AGING_INVOICE_A_OLD AS SELECT * FROM


W_AP_AGING_INVOICE_A;

CREATE TABLE W_AP_AGING_SUPPLIER_A_BKP AS SELECT * FROM


W_AP_AGING_SUPPLIER_A;

CREATE INDEX "W_AP_XACT_F_UP1" ON "W_AP_XACT_F" ("DATASOURCE_NUM_ID",


"PURCH_INVOICE_NUM","REF_DOC_NUM")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OLAP_TS"
PARALLEL;

CREATE BITMAP INDEX "W_AP_AGN_INV_A_BKP" ON


"W_AP_AGING_INVOICE_A_BKP" ("DATASOURCE_NUM_ID",
"PURCH_INVOICE_NUM","REF_DOC_NUM")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OLAP_TS"
PARALLEL ;

CREATE BITMAP INDEX "W_AP_AGN_INV_A_OLD" ON


"W_AP_AGING_INVOICE_A_OLD" ("DATASOURCE_NUM_ID",
"PURCH_INVOICE_NUM","REF_DOC_NUM")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OLAP_TS"
PARALLEL ;

UPDATE W_AP_AGING_INVOICE_A_BKP
SET
(SUPPLIER_WID,SPLR_ACCT_WID,PURCH_REP_WID,PRODUCT_WID,INVENTORY_PROD_WI
D,SUPPLIER_PROD_WID,COMPANY_LOC_WID,PLANT_LOC_WID,OPERATING_UNIT_ORG_WI
D,PAYABLES_ORG_WID,LEDGER_WID,COMPANY_ORG_WID,BUSN_AREA_ORG_WID,CTRL_AR
EA_ORG_WID,PURCH_ORG_WID,ISSUE_ORG_WID,DOC_TYPE_WID,REF_DOC_TYPE_WID,PO
STING_TYPE_WID,COST_CENTER_WID,PROFIT_CENTER_WID,TAX_WID,PAY_TERMS_WID,
PAYMENT_METHOD_WID,SOURCE_WID,CREATED_BY_WID,CHANGED_BY_WID,MCAL_CAL_WI
D,PROJECT_WID,EXPENDITURE_ORG_WID)
=
(SELECT
W_AP_XACT_F.SUPPLIER_WID,
W_AP_XACT_F.SPLR_ACCT_WID,
W_AP_XACT_F.PURCH_REP_WID,
W_AP_XACT_F.PRODUCT_WID,
W_AP_XACT_F.INVENTORY_PROD_WID,
W_AP_XACT_F.SUPPLIER_PROD_WID,
W_AP_XACT_F.COMPANY_LOC_WID,
W_AP_XACT_F.PLANT_LOC_WID,
W_AP_XACT_F.OPERATING_UNIT_ORG_WID,
W_AP_XACT_F.PAYABLES_ORG_WID,
W_AP_XACT_F.LEDGER_WID,
W_AP_XACT_F.COMPANY_ORG_WID,
W_AP_XACT_F.BUSN_AREA_ORG_WID,
W_AP_XACT_F.CTRL_AREA_ORG_WID,
W_AP_XACT_F.PURCHASE_ORG_WID,
W_AP_XACT_F.ISSUE_ORG_WID,
W_AP_XACT_F.DOC_TYPE_WID,
W_AP_XACT_F.REF_DOC_TYPE_WID,
W_AP_XACT_F.POSTING_TYPE_WID,
W_AP_XACT_F.COST_CENTER_WID,
W_AP_XACT_F.PROFIT_CENTER_WID,
W_AP_XACT_F.TAX_TYPE_WID,
W_AP_XACT_F.PAY_TERMS_WID,
W_AP_XACT_F.PAY_METHOD_WID,
W_AP_XACT_F.SOURCE_WID,
W_AP_XACT_F.CREATED_BY_WID,
W_AP_XACT_F.CHANGED_BY_WID,
W_AP_XACT_F.MCAL_CAL_WID,
W_AP_XACT_F.PROJECT_WID,
W_AP_XACT_F.EXPENDITURE_ORG_WID
FROM
W_AP_XACT_F,
W_XACT_TYPE_D
WHERE
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=
W_AP_XACT_F.DATASOURCE_NUM_ID AND
W_AP_XACT_F.DATASOURCE_NUM_ID=W_XACT_TYPE_D.DATASOURCE_NUM_ID AND
W_AP_AGING_INVOICE_A_BKP.PURCH_INVOICE_NUM =
W_AP_XACT_F.PURCH_INVOICE_NUM AND
W_AP_AGING_INVOICE_A_BKP.REF_DOC_NUM = W_AP_XACT_F.REF_DOC_NUM AND
W_AP_XACT_F.DOC_TYPE_WID=W_XACT_TYPE_D.ROW_WID AND
W_XACT_TYPE_D.W_XACT_TYPE_CODE IN ('ORIGINAL'));

COMMIT;

UPDATE W_AP_AGING_INVOICE_A_BKP SET DOC_STATUS_WID =


(SELECT ROW_WID FROM W_STATUS_D WHERE W_SUBSTATUS_CODE='OPEN~UNPOSTED'
AND W_STATUS_CLASS='ACCT_DOC'
AND
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=W_STATUS_D.DATASOURCE_NUM_ID
);

COMMIT;

UPDATE W_AP_AGING_SUPPLIER_A_BKP SET


(MCAL_CAL_WID,SUPPLIER_WID,SPLR_ACCT_WID,COMPANY_LOC_WID,OPERATING_UNIT
_ORG_WID,PAYABLES_ORG_WID,LEDGER_WID,COMPANY_ORG_WID,BUSN_AREA_ORG_WID,
EXPENDITURE_ORG_WID)
=
(SELECT DISTINCT
MCAL_CAL_WID_NEW,
SUPPLIER_WID_NEW,
SPLR_ACCT_WID_NEW,
COMPANY_LOC_WID_NEW,
OPERATING_UNIT_ORG_WID_NEW,
PAYABLES_ORG_WID_NEW,
LEDGER_WID_NEW,
COMPANY_ORG_WID_NEW,
BUSN_AREA_ORG_WID_NEW,
EXPENDITURE_ORG_WID_NEW

FROM
(SELECT DISTINCT
W_AP_AGING_INVOICE_A_BKP.MCAL_CAL_WID MCAL_CAL_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.MCAL_CAL_WID MCAL_CAL_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.SUPPLIER_WID SUPPLIER_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.SUPPLIER_WID SUPPLIER_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.SPLR_ACCT_WID SPLR_ACCT_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.SPLR_ACCT_WID SPLR_ACCT_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.COMPANY_LOC_WID COMPANY_LOC_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.COMPANY_LOC_WID COMPANY_LOC_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.PAYABLES_ORG_WID PAYABLES_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.PAYABLES_ORG_WID PAYABLES_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.LEDGER_WID LEDGER_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.LEDGER_WID LEDGER_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.COMPANY_ORG_WID COMPANY_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.COMPANY_ORG_WID COMPANY_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.EXPENDITURE_ORG_WID EXPENDITURE_ORG_WID_NEW,
W_AP_AGING_INVOICE_A_OLD.EXPENDITURE_ORG_WID EXPENDITURE_ORG_WID_OLD,
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID DATASOURCE_NUM_ID
FROM
W_AP_AGING_INVOICE_A_BKP,
W_AP_AGING_INVOICE_A_OLD
WHERE
W_AP_AGING_INVOICE_A_BKP.PURCH_INVOICE_NUM=W_AP_AGING_INVOICE_A_OLD.PUR
CH_INVOICE_NUM AND
W_AP_AGING_INVOICE_A_BKP.REF_DOC_NUM=W_AP_AGING_INVOICE_A_OLD.REF_DOC_N
UM AND
W_AP_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=W_AP_AGING_INVOICE_A_OLD.
DATASOURCE_NUM_ID AND
W_AP_AGING_INVOICE_A_BKP.SNAPSHOT_DT_WID=W_AP_AGING_INVOICE_A_OLD.
SNAPSHOT_DT_WID
) TMP_WIDS
WHERE
W_AP_AGING_SUPPLIER_A_BKP.DATASOURCE_NUM_ID=TMP_WIDS.DATASOURCE_N
UM_ID AND
W_AP_AGING_SUPPLIER_A_BKP.SUPPLIER_WID=TMP_WIDS.SUPPLIER_WID_OLD
AND
W_AP_AGING_SUPPLIER_A_BKP.MCAL_CAL_WID=TMP_WIDS.MCAL_CAL_WID_OLD
AND
W_AP_AGING_SUPPLIER_A_BKP.SPLR_ACCT_WID=TMP_WIDS.SPLR_ACCT_WID_OL
D AND
W_AP_AGING_SUPPLIER_A_BKP.COMPANY_LOC_WID=TMP_WIDS.COMPANY_LOC_WI
D_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.OPERATING_UNIT_ORG_WID=TMP_WIDS.OPERATI
NG_UNIT_ORG_WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.PAYABLES_ORG_WID=TMP_WIDS.PAYABLES_ORG_
WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.LEDGER_WID=TMP_WIDS.LEDGER_WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.COMPANY_ORG_WID=TMP_WIDS.COMPANY_ORG_WI
D_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.BUSN_AREA_ORG_WID=TMP_WIDS.BUSN_AREA_OR
G_WID_OLD AND
W_AP_AGING_SUPPLIER_A_BKP.EXPENDITURE_ORG_WID=TMP_WIDS.EXPENDITUR
E_ORG_WID_OLD );

COMMIT;

DROP INDEX "W_AP_XACT_F_UP1";


DROP INDEX "W_AP_AGN_INV_A_BKP";
DROP INDEX "W_AP_AGN_INV_A_OLD";

5. Save and Check in the session.


Similarly

6. Checkout the Informatica session: SIL_APTransactionFact under SILOS folder


from the Informatica workflow manager.
7. Go to the Mappings Tab
8. Select the Targets (W_AP_XACT_F)
9. Go to Properties tab and paste the below sql statements in the Post SQL(in box)

Flow:

• The below sql statements will create empty backup tables from the existing
aging tables.
• This is done to ensure that the Aging PLPs doesn’t fail in subsequent PLP phase
and also doesn’t process any data in the incremental loads.

CREATE TABLE W_AP_AGING_INVOICE_A_BKP AS SELECT * FROM


W_AP_AGING_INVOICE_A WHERE 1=2;

CREATE TABLE W_AP_AGING_INVOICE_A_OLD AS SELECT * FROM


W_AP_AGING_INVOICE_A WHERE 1=2;

CREATE TABLE W_AP_AGING_SUPPLIER_A_BKP AS SELECT * FROM


W_AP_AGING_SUPPLIER_A WHERE 1=2;

10. Save and Checkin the session


Step2:
-----------PLP Phase------------

1. Checkout the Informatica session : PLP_APSnapshotInvoiceAging under PLP


folder from the Informatica workflow manager.
2. Go to the Mappings Tab

3. Select the Targets (W_AP_AGING_INVOICE_A)


4. Go to Properties tab and paste the below sql statements in the Pre SQL (in box)

Flow
• The below sql statements insert back the updated older snapshot data back into
the latest invoice aging from the updated invoice aging backup table updated in
the previous step.
• Finally the previously created backup table is dropped.
• This way the cycle repeats if a full load is done again.

INSERT INTO W_AP_AGING_INVOICE_A (SELECT * FROM


W_AP_AGING_INVOICE_A_BKP);

COMMIT;

DROP TABLE W_AP_AGING_INVOICE_A_BKP;

DROP TABLE W_AP_AGING_INVOICE_A_OLD;

5. Save and Checkin the session.

Step3:
-----------PLP Phase------------

6. Checkout the Informatica session : PLP_APSnapshotSupplierAgingAggregate


under PLP folder from the Informatica workflow manager.
7. Go to the Mappings Tab
8. Select the Targets (W_AP_AGING_SUPPLIER_A1)
9. Go to Properties tab and paste the below sql statements in the Pre SQL (in box)

Flow
• The below sql statements insert back the updated older snapshot data back into
the latest supplier aging from the updated supplier aging backup table updated
in the previous step.
• Finally the previously created backup table is dropped.
• This way the cycle repeats if a full load is done again.

INSERT INTO W_AP_AGING_SUPPLIER_A (SELECT * FROM


W_AP_AGING_SUPPLIER_A_BKP);

COMMIT;

DROP TABLE W_AP_AGING_SUPPLIER_A_BKP;

10. Save and Checkin the session.

AR Fixes

Step1:
-----------SIL Phase------------

1. Checkout the Informatica session : SIL_ARTransactionFact_Full under SILOS


folder from the Informatica workflow manager.
2. Go to the Mappings Tab
3. Select the Targets (W_AR_XACT_F)
4. Go to Properties tab and paste the below SQL statements in the Post SQL (in
box)

Flow:
• The below SQL statements will create the backup tables from the existing
aging tables for further processing as a first step after the SIL runs and
loads the latest data into the base fact table.
• Next they update the backup invoice aging table's dimension WIDs using
latest base fact table's dimension WIDs. Backup aging table rows will be
matched with latest base fact table rows via sales_invoice_num.
• The third update statement updates the backup customer aging table's
dimension WIDs using the updated invoice aging table’s dimension
WID’s(updated in previous step) and the existing invoice aging table
(W_AR_AGING_INVOICE_A which is still available in the warehouse as
PLP phase has not yet started and truncated the invoice aging table).
• Note updated backup invoice aging table‘s rows will be matched with
existing invoice aging table’s rows via sales_invoice_num.
• And the latest dimension WID’s will be updated in the supplier aging
backup by matching the existing dimension WID’s of supplier aging
backup with the older dimension WID’s of existing invoice aging table and
getting the new dimension WID’s from the updated invoice aging backup
table.

CREATE TABLE W_AR_AGING_INVOICE_A_BKP AS SELECT * FROM


W_AR_AGING_INVOICE_A;

CREATE TABLE W_AR_AGING_INVOICE_A_OLD AS SELECT * FROM


W_AR_AGING_INVOICE_A;

CREATE TABLE W_AR_AGING_CUSTOMER_A_BKP AS SELECT * FROM


W_AR_AGING_CUSTOMER_A;

CREATE INDEX "W_AR_XACT_F_UP1" ON "W_AR_XACT_F" ("DATASOURCE_NUM_ID",


"SALES_INVOICE_NUM","REF_DOC_NUM")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OLAP_TS"
PARALLEL ;

CREATE BITMAP INDEX "W_AR_AGN_INV_A_BKP" ON


"W_AR_AGING_INVOICE_A_BKP" ("DATASOURCE_NUM_ID",
"SALES_INVOICE_NUM","REF_DOC_NUM")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OLAP_TS"
PARALLEL ;

CREATE BITMAP INDEX "W_AR_AGN_INV_A_OLD" ON


"W_AR_AGING_INVOICE_A_OLD" ("DATASOURCE_NUM_ID",
"SALES_INVOICE_NUM","REF_DOC_NUM")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "OLAP_TS"
PARALLEL ;

UPDATE W_AR_AGING_INVOICE_A_BKP
SET
(CUSTOMER_WID,CUSTOMER_ACCNT_WID,CUSTOMER_FIN_PROFL_WID,TERRITORY_WID,S
ALES_GROUP_ORG_WID,CUSTOMER_CONTACT_WID,CUSTOMER_SOLD_TO_LOC_WID,CUSTOM
ER_SHIP_TO_LOC_WID,CUSTOMER_BILL_TO_LOC_WID,CUSTOMER_PAYER_LOC_WID,SALE
S_REP_WID,PRODUCT_WID,SALES_PRODUCT_WID,COMPANY_LOC_WID,SALES_OFC_LOC_W
ID,OPERATING_UNIT_ORG_WID,RECEIVABLES_ORG_WID,LEDGER_WID,COMPANY_ORG_WI
D,BUSN_AREA_ORG_WID,CTRL_AREA_ORG_WID,SALES_ORG_WID,COST_CENTER_WID,PRO
FIT_CENTER_WID,PAY_TERMS_WID,PAYMENT_METHOD_WID,CREATED_BY_WID,CHANGED_
BY_WID,MCAL_CAL_WID,PROJECT_WID,AGREEMENT_WID,PROJECT_ORG_WID

)
=
(SELECT
W_AR_XACT_F.CUSTOMER_WID,
W_AR_XACT_F.CUSTOMER_ACCNT_WID,
W_AR_XACT_F.CUSTOMER_FIN_PROFL_WID,
W_AR_XACT_F.TERRITORY_WID,
W_AR_XACT_F.SALES_GROUP_ORG_WID,
W_AR_XACT_F.CUSTOMER_CONTACT_WID,
W_AR_XACT_F.CUSTOMER_SOLD_TO_LOC_WID,
W_AR_XACT_F.CUSTOMER_SHIP_TO_LOC_WID,
W_AR_XACT_F.CUSTOMER_BILL_TO_LOC_WID,
W_AR_XACT_F.CUSTOMER_PAYER_LOC_WID,
W_AR_XACT_F.SALES_REP_WID,
W_AR_XACT_F.PRODUCT_WID,
W_AR_XACT_F.SALES_PRODUCT_WID,
W_AR_XACT_F.COMPANY_LOC_WID,
W_AR_XACT_F.SALES_OFC_LOC_WID,
W_AR_XACT_F.OPERATING_UNIT_ORG_WID,
W_AR_XACT_F.RECEIVABLES_ORG_WID,
W_AR_XACT_F.LEDGER_WID,
W_AR_XACT_F.COMPANY_ORG_WID,
W_AR_XACT_F.BUSN_AREA_ORG_WID,
W_AR_XACT_F.CTRL_AREA_ORG_WID,
W_AR_XACT_F.SALES_ORG_WID,
W_AR_XACT_F.COST_CENTER_WID,
W_AR_XACT_F.PROFIT_CENTER_WID,
W_AR_XACT_F.PAY_TERMS_WID,
W_AR_XACT_F.PAYMENT_METHOD_WID,
W_AR_XACT_F.CREATED_BY_WID,
W_AR_XACT_F.CHANGED_BY_WID,
W_AR_XACT_F.MCAL_CAL_WID,
W_AR_XACT_F.PROJECT_WID,
W_AR_XACT_F.AGREEMENT_WID,
W_AR_XACT_F.PROJECT_ORG_WID
FROM
W_AR_XACT_F,
W_XACT_TYPE_D
WHERE
W_AR_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=
W_AR_XACT_F.DATASOURCE_NUM_ID AND
W_AR_XACT_F.DATASOURCE_NUM_ID=W_XACT_TYPE_D.DATASOURCE_NUM_ID AND
W_AR_AGING_INVOICE_A_BKP.SALES_INVOICE_NUM =
W_AR_XACT_F.SALES_INVOICE_NUM AND
W_AR_AGING_INVOICE_A_BKP.REF_DOC_NUM = W_AR_XACT_F.REF_DOC_NUM AND
W_AR_XACT_F.DOC_TYPE_WID=W_XACT_TYPE_D.ROW_WID AND
W_XACT_TYPE_D.W_XACT_TYPE_CODE = 'ORIGINAL' AND
W_XACT_TYPE_D.W_XACT_SUBTYPE_CODE IN ('INVOICE','CR MEMO','DR
MEMO'));

COMMIT;

UPDATE W_AR_AGING_CUSTOMER_A_BKP
SET
(MCAL_CAL_WID,CUSTOMER_WID,CUSTOMER_ACCNT_WID,TERRITORY_WID,SALES_GROUP
_ORG_WID,COMPANY_LOC_WID,SALES_OFC_LOC_WID,
OPERATING_UNIT_ORG_WID,SALES_ORG_WID,LEDGER_WID,
COMPANY_ORG_WID,BUSN_AREA_ORG_WID,RECEIVABLES_ORG_WID,SALES_REP_WID,PRO
JECT_ORG_WID
)
=
(SELECT DISTINCT
MCAL_CAL_WID_NEW,
CUSTOMER_WID_NEW,
CUSTOMER_ACCNT_WID_NEW,
TERRITORY_WID_NEW,
SALES_GROUP_ORG_WID_NEW,
COMPANY_LOC_WID_NEW,
SALES_OFC_LOC_WID_NEW,
OPERATING_UNIT_ORG_WID_NEW,
SALES_ORG_WID_NEW,
LEDGER_WID_NEW,
COMPANY_ORG_WID_NEW,
BUSN_AREA_ORG_WID_NEW,
RECEIVABLES_ORG_WID_NEW,
SALES_REP_WID_NEW,
PROJECT_ORG_WID_NEW

FROM

(SELECT DISTINCT
W_AR_AGING_INVOICE_A_BKP.MCAL_CAL_WID MCAL_CAL_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.MCAL_CAL_WID MCAL_CAL_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.CUSTOMER_WID CUSTOMER_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.CUSTOMER_WID CUSTOMER_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.CUSTOMER_ACCNT_WID CUSTOMER_ACCNT_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.CUSTOMER_ACCNT_WID CUSTOMER_ACCNT_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.TERRITORY_WID TERRITORY_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.TERRITORY_WID TERRITORY_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_GROUP_ORG_WID SALES_GROUP_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_GROUP_ORG_WID SALES_GROUP_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.COMPANY_LOC_WID COMPANY_LOC_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.COMPANY_LOC_WID COMPANY_LOC_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_OFC_LOC_WID SALES_OFC_LOC_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_OFC_LOC_WID SALES_OFC_LOC_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.OPERATING_UNIT_ORG_WID
OPERATING_UNIT_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_ORG_WID SALES_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_ORG_WID SALES_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.LEDGER_WID LEDGER_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.LEDGER_WID LEDGER_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.COMPANY_ORG_WID COMPANY_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.COMPANY_ORG_WID COMPANY_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.BUSN_AREA_ORG_WID BUSN_AREA_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.RECEIVABLES_ORG_WID RECEIVABLES_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.RECEIVABLES_ORG_WID RECEIVABLES_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.SALES_REP_WID SALES_REP_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.SALES_REP_WID SALES_REP_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.PROJECT_ORG_WID PROJECT_ORG_WID_NEW,
W_AR_AGING_INVOICE_A_OLD.PROJECT_ORG_WID PROJECT_ORG_WID_OLD,
W_AR_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID DATASOURCE_NUM_ID
FROM
W_AR_AGING_INVOICE_A_BKP,
W_AR_AGING_INVOICE_A_OLD
WHERE
W_AR_AGING_INVOICE_A_BKP.SALES_INVOICE_NUM =
W_AR_AGING_INVOICE_A_OLD.SALES_INVOICE_NUM AND
W_AR_AGING_INVOICE_A_BKP.REF_DOC_NUM =
W_AR_AGING_INVOICE_A_OLD.REF_DOC_NUM AND
W_AR_AGING_INVOICE_A_BKP.DATASOURCE_NUM_ID=
W_AR_AGING_INVOICE_A_OLD.DATASOURCE_NUM_ID AND
W_AR_AGING_INVOICE_A_BKP.SNAPSHOT_DT_WID=
W_AR_AGING_INVOICE_A_OLD.SNAPSHOT_DT_WID) TMP_WIDS
WHERE
W_AR_AGING_CUSTOMER_A_BKP.DATASOURCE_NUM_ID =
TMP_WIDS.DATASOURCE_NUM_ID AND
W_AR_AGING_CUSTOMER_A_BKP.CUSTOMER_WID = TMP_WIDS.CUSTOMER_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.MCAL_CAL_WID = TMP_WIDS.MCAL_CAL_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.CUSTOMER_ACCNT_WID =
TMP_WIDS.CUSTOMER_ACCNT_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.TERRITORY_WID = TMP_WIDS.TERRITORY_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_GROUP_ORG_WID =
TMP_WIDS.SALES_GROUP_ORG_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.COMPANY_LOC_WID =
TMP_WIDS.COMPANY_LOC_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_OFC_LOC_WID =
TMP_WIDS.SALES_OFC_LOC_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.OPERATING_UNIT_ORG_WID =
TMP_WIDS.OPERATING_UNIT_ORG_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_ORG_WID = TMP_WIDS.SALES_ORG_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.LEDGER_WID = TMP_WIDS.LEDGER_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.COMPANY_ORG_WID =
TMP_WIDS.COMPANY_ORG_WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.BUSN_AREA_ORG_WID =
TMP_WIDS.BUSN_AREA_ORG_WID_OLD AND

W_AR_AGING_CUSTOMER_A_BKP.RECEIVABLES_ORG_WID=TMP_WIDS.RECEIVABLES_ORG_
WID_OLD AND
W_AR_AGING_CUSTOMER_A_BKP.SALES_REP_WID = TMP_WIDS.SALES_REP_WID_OLD
AND
W_AR_AGING_CUSTOMER_A_BKP.PROJECT_ORG_WID =
TMP_WIDS.PROJECT_ORG_WID_OLD );

COMMIT;
DROP INDEX "W_AR_XACT_F_UP1";
DROP INDEX "W_AR_AGN_INV_A_BKP";
DROP INDEX "W_AR_AGN_INV_A_OLD";

5. Save and Check in the session.

Similarly

6. Checkout the Informatica session: SIL_ARTransactionFact under SILOS folder


from the Informatica workflow manager.
7. Go to the Mappings Tab
8. Select the Targets (W_AR_XACT_F)
9. Go to Properties tab and paste the below SQL statements in the Post SQL(in box)

Flow:

• The below SQL statements will create empty backup tables from the existing
aging tables.
• This is done to ensure that the Aging PLPs doesn’t fail in subsequent PLP phase
and also doesn’t process any data in the incremental loads.

CREATE TABLE W_AR_AGING_INVOICE_A_BKP AS SELECT * FROM


W_AR_AGING_INVOICE_A WHERE 1=2;

CREATE TABLE W_AR_AGING_INVOICE_A_OLD AS SELECT * FROM


W_AR_AGING_INVOICE_A WHERE 1=2;

CREATE TABLE W_AR_AGING_CUSTOMER_A_BKP AS SELECT * FROM


W_AR_AGING_CUSTOMER_A WHERE 1=2;

10. Save and check in the session

Step2:
-----------PLP Phase------------

1. Checkout the Informatica session: PLP_ARSnapshotInvoiceAging under PLP


folder from the Informatica workflow manager.
2. Go to the Mappings Tab
3. Select the Targets (W_AR_AGING_INVOICE_A)
4. Go to Properties tab and paste the below SQL statements in the Pre SQL (in box)

Flow
• The below SQL statements insert back the updated older snapshot data back into
the latest invoice aging table from the updated invoice aging backup table
updated in the previous steps.
• Finally the previously created backup table is dropped.
• This way the cycle repeats if a full load is done again.

INSERT INTO W_AR_AGING_INVOICE_A (SELECT * FROM


W_AR_AGING_INVOICE_A_BKP);

COMMIT;

DROP TABLE W_AR_AGING_INVOICE_A_BKP;

DROP TABLE W_AR_AGING_INVOICE_A_OLD;

5. Save and check in the session.

Step3:
-----------PLP Phase------------

6. Checkout the Informatica session: PLP_ARSnapshotCustomerAgingAggregate


under PLP folder from the Informatica workflow manager.
7. Go to the Mappings Tab
8. Select the Targets (W_AR_AGING_CUSTOMER_A2)
9. Go to Properties tab and paste the below SQL statements in the Pre SQL (in box)

Flow
• The below SQL statements insert back the updated older snapshot data back into
the latest customer aging table from the updated customer aging backup table
updated in the previous steps.
• Finally the previously created backup table is dropped.
• This way the cycle repeats if a full load is done again.

INSERT INTO W_AR_AGING_CUSTOMER_A (SELECT * FROM


W_AR_AGING_CUSTOMER_A_BKP);

COMMIT;

DROP TABLE W_AR_AGING_CUSTOMER_A_BKP;

10. Save and check in the session.

Potrebbero piacerti anche