on 12-30-2005 4:43 PM
Hellow Gurus,
1. I need to pull 24 months of forecast data from Infocube1 to InfoCube2. InfoCube1 contains 60 months of forecast data and the fields calmonth,key figures.InFoCube2 contains forecastmnth, calmonth and key figures. Forecastmnth is populated from a table based on current date.We load data every month.
2. When we will load in next month we need to keep previous load forecastmnth and calmonth as history if forecast is equal to calmonth and remaining 23 months of data we need to delete and current 24 months of data we need to load.
I a ABAP routine to add in my Infopackage to fullfill my above requirements(1 & 2). I don't know how to write this code. This is Urgent. I would appreciate your quick reply.
Example:
Example - Data in Infocube1(60 months of data)
calmonth kf1 kf2 ........
12/2005
01/2006
-
-
01/2010
I need to load 24 months of data out of 60 months from Infocube1 to Infocube2. After loading data should be like this in InfoCube2.
OUTPUT:
INFOCUBE2 -
First month time load(I need data like this)
Forecastmnth
12/2005
calmonth kf1 kf2
12/2005
01/2006
02/2006
03/2006
04/2006
-
-
01/2008
Second month load(I need data like this)
Forecastmnth
12/2005
01/2006
calmonth kf1 kf2
12/2005
01/2006
02/2006
03/2006
04/2006
-
-
01/2008
Third month load(I need data like this)
Forecastmnth
12/2005
01/2006
02/2006
calmonth kf1 kf2
12/2005
01/2006
02/2006
03/2006
04/2006
-
-
02/2008
I think this format is OK.I appreciate your quick reply.
Thanks
Pramod
Hi Pramod,
I have two suggestions for you.
Option 1. delete the entire contents of data from the cube and reload your data (Select in infockage > Data targets Tab > Check delete entire content of data)
First month load 24 months of data. (Current month +23 months of forecast)
second month load 25 months of data(Last month, Current month and 23 months of forecast?
You can write a a Abap routine in infopackage for loading data from fixed month to Current month +23 months)
Option 2. 1. Schedule two info packages. First info package has only selection for current months data. Second infopackage has selection for 23 months of data .
Next month you can delete 23 months data and load next 24 months.
Let me know whcih option you would like to choose.
Sample abap code ( Month low and year low will vary based on the option you select above)
data: l_idx like sy-tabix,
month_low(3) type n ,
month_high(3) type n ,
year_low(4) type n,
year_high(4) type n,
date like sy-datum,
clear: month_low, month_high, year_low, year_high.
read table l_t_range with key fieldname = 'CALMONTH'.
l_idx = sy-tabix.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
set low range to current month and year
year_low= sy-datum+0(4).
month_low = sy-datum+4(2).
date = sy-datum.
first day of the current month
date+6(2) = '01'.
last day of the previous month
date = date - 1.
month_high = date+4(2)
year_high = date(4) + 2.
concatenate year_low month_low into l_t_range-low.
concatenate year_low month_high into l_t_range-high.
modify l_t_range index l_idx.
p_subrc = 0.
Vijay.
Message was edited by: Vijay Ganga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijay,
Happy new year.I appreciate your help. It worked fine for me. I rewarded you all the points.
God bless you.
Thanks
Pramod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pramod,
Happy New Year. The code for the info packages for Option 2
1. For the first infopackage for selecting current month you Can choose olap varaiable "Current Calender month " on 0calmonth
2. For second info pack use following code
data: l_idx like sy-tabix,
month_low(3) type n ,
month_high(3) type n ,
year_low(4) type n,
year_high(4) type n,
date like sy-datum,
clear: month_low, month_high, year_low, year_high.
read table l_t_range with key fieldname = 'CALMONTH'.
l_idx = sy-tabix.
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
set low range to current month and year
*year_low= sy-datum+0(4).
*month_low = sy-datum+4(2).
date = sy-datum.
first day of the current month
date+6(2) = '01'.
last day of the previous month
date = date - 1.
month_high = date+4(2)
year_high = date(4) + 2.
Next month
date = date + 32 .
year_low= date+0(4).
*month_low = date+4(2).
concatenate year_low month_low into l_t_range-low.
concatenate year_low month_high into l_t_range-high.
modify l_t_range index l_idx.
p_subrc = 0.
Also Check this
http://help.sap.com/saphelp_bw33/helpdata/en/80/1a659be07211d2acb80000e829fbfe/content.htm
For automatic deletion of requests check this
http://help.sap.com/saphelp_bw33/helpdata/en/f8/e5603801be792de10000009b38f842/content.htm
Schedule both your info pckages to run once a month and this will work for your future loads too.
Even from performance point of view the option 2 is better than option 1.
Vijay.
Message was edited by: Vijay Ganga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijaya,
Note - I need to load 24 months of forecast data.
I appreciate your quick reply. I think option-2 make sense to me. You could send me ABAP code for option-2.
I have one more question.What abaout 3rd month load,4th monthload ......so on. The same way it will work or not.
Please let me know for performance point of view which option is better.
Thanks
Pramod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.