Hi, All.
I have 2 ODS:
ZODS_PAY
Doc_Num Date TCode Amt Doc_1 01.11.2008 001 100$ Doc_1 04.11.2008 001 200$ Doc_2 07.11.2008 002 300$
ZODS_ACCRUALS
Doc_Num Date TCode Accrued_Amt_Per_Day Doc_1 01.11.2008 002 10$ Doc_1 02.11.2008 002 10$ Doc_1 03.11.2008 002 10$ Doc_1 04.11.2008 002 20$ Doc_1 05.11.2008 002 20$ Doc_1 06.11.2008 002 20$ Doc_2 07.11.2008 002 30$
I should get the following report:
Doc_Num Data Amt Total_Accrued_Per_Period Doc_1 01.11.2008 100$ 30$ Doc_1 04.11.2008 200$ 60$ Doc_2 07.11.2008 300$ 30$
My decision is:
1. Create ZODS_PAY2 with following structure:
Doc_Num Date TCode Amt ValidFrom ValidTo Doc_1 01.11.2008 001 100$ 01.01.2008 03.11.2008 Doc_1 04.11.2008 001 200$ 04.11.2008 31.12.9999 Doc_2 07.11.2008 002 300$ 07.11.2008 31.12.9999
So I understand that I should realize the following algorithm for filling ValidFrom and ValidTo fields:
1. ValidFrom = Date.
2. ValidTo = (Date - 1) if this is a New Record.
After this I should fill a ValidDate to accruals table:
Doc_Num Date TCode ValidDate Accrued_Amt_Per_Day Doc_1 01.11.2008 002 01.01.2008 10$ Doc_1 02.11.2008 002 01.01.2008 10$ Doc_1 03.11.2008 002 01.01.2008 10$ Doc_1 04.11.2008 002 04.11.2008 20$ Doc_1 05.11.2008 002 04.11.2008 20$ Doc_1 06.11.2008 002 04.11.2008 20$ Doc_2 07.11.2008 002 07.11.2008 30$
Any ideas? May be my decision is not good. Plz, help me to realize filling time-dependent fields for ODS.