InfoPackage ABAP Routine - compute_time_dependent_dates
I would like to populate start and end date for time dependent master data using ABAP. BI help / documentation says that it can be done with ABAP as mentioned below:
InfoPackage
Selection routines for selecting the from and to date for time-dependent data on tab page 'Update Parameters'.
form compute_time_dependent_dates
changing p_datefrom type d
p_dateto type d
p_subrc like sy-subrc.
$$ begin of routine - insert your code only below this line-
p_datefrom =
p_dateto =
p_subrc = 0.
$$ end of routine - insert your code only before this line-
ENDFORM.
I am unable to find the ABAP routine section or window on the update tab in the InfoPackage. Can someone let me know if i am looking at the right tab in the InfoPackage?
Note: I can see ABAP routine section or window on the extraction tab, where we can write code for form compute_flat_file_filename.......
Thanks in advance.
RK.
Dennis,
Thanks for your feedback.
The option you mentioned in the Data Selection tab will help me to filter the start and end dates - as long as i have start and end date as selection fields in the data source. But i was actually looking for the ABAP routine / window where i can populate the start and end dates in the form compute_time_dependent_dates....
BI help / documentation says that it can be done with ABAP as mentioned below:
InfoPackage
Selection routines for selecting the from and to date for time-dependent data on tab page 'Update Parameters'.
form compute_time_dependent_dates
changing p_datefrom type d
p_dateto type d
p_subrc like sy-subrc.
$$ begin of routine - insert your code only below this line-
p_datefrom =
p_dateto =
p_subrc = 0.
$$ end of routine - insert your code only before this line-
ENDFORM.
I am looking for ABAP window where i can see form compute_time_dependent_dates...
Let me know if you have any questions.
Thanks,
RK.
Similar Messages
-
Infopackage Abap Routine (Selection based on other fields?)
Dear Friends,
I know that Abap routine is used in infopackage to select or restrict using complex data selection.
My requirement is to restrict Material no field based on 4 other fields. Is that possible?
Actual condition is to load Material no only if other 4 fields combination is new.
Pls help.
GuruHi,
Yes you can do this at infoPackage level using the ABAP routine.
First read the Active Table of the DSO into internal table and do a lookup for the required four fields combination.
If these four field are new allow the material number.
Refer the below link for more help.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a05ac9fa-f44c-2c10-dbb8-ef54c102707c
Regards
Manjula.B -
Hi,
I have two text tables T1 and T2. The key in T1 and T2 are the same. Only point is T2 has very few records compared to T1.
T1 has key and Medium Texts. T2 has the same.
I am loading the data from T1 to T2. I need to write ABAP routine in InfoPackage to load the text data to T2 where the keys match in T1 and T2.
Appreciate your help.
Thanks,
PradeepHello Kumar,
You can do this using the following algorithm:
1) Read the text table for T2. The text table is named /BIC/T<name of T1 infoobject). For example, if my infoobject is ZSAMPLE, then my text table for that is /BIC/TZSAMPLE.
2) For each row in T2, check if the key can be found in T1.
3) If yes,then place the key for that current row in a selection.
4) if not, ignore the key
Here's a sample code:
data: l_sel type rssdlrange.
data: t_t2 type table of /BIC/TT2,
e_t2 type /BIC/TT2,
e_t1 type /bic/tt1.
select * from /BIC/TT2 into table t_t2.
loop at t_t2 into e_t2.
select single * from /bic/tt1 into e_t1 where
/bic/t1 = e_t2-/bic/t2.
if sy-subrc eq 0.
l_sel-fieldname = '/BIC/T1'.
l_sel-SIGN = 'I'.
l_sel-OPTION = 'EQ'.
l_sel-LOW = e_t2-/bic/t2.
append l_sel to l_t_range.
endif.
endloop.
Hope this helps. -
InfoPackage ABAP Routine for Date Range - Only Start Date Extracted
I am using an ABAP Routine in an InfoPackage to select data for a 2 year period. The routine converts SY-DATUM into the Current Fiscal Year and Period, and then calculates the Starting and Ending Fiscal Year / Period of a 24 month period. The Start and End values are passed to the InfoPackage as l_t_range-low and l_t_range-high.
The Source and Target are both Basic Infocubes.
The InfoPackage executes successfully, and the Selection values on the Header tab of the monitor reflect a 24 month period. Unfortunately, on closer review of the data in the cube, only data for the first month appears to have been loaded. Im guessing that the extract was only performed with the From value, even though a To value was also provided.
I created a simple Infopackage and manually input the selection parameter values just to be sure I wasnt overlooking something. The InfoPackage performed as expected, loading more data which spanned the selection time period.
I can provide the code if it helps, but the fact that the monitor reflects a Start and End value suggests that the problem is with the InfoPackage, not the ABAP routine.
Has anybody ever experienced this before ? Any ideas would be greatly appreciated ?
Thanks,
LyleWe can write ABAP routine in Infopackage with a range of values (From & To). Make sure you fill all the following information while building the final range information as below,
l_s_range-sign = 'I'.
l_s_range-option = 'BT'.
l_s_range-low = lowvalue.
l_s_range-high = highvalue.
MODIFY l_t_range FROM l_s_range INDEX l_idx.
As you can see the key is passing the "BT" information for capturing range.
Hope it helps..
thanks
Kumar -
ABAP Routine for 0FISCPER slect options in InfoPackage
Hi,
I am trying to write an ABAP Routine for 0FISCPER as select options (range) dynamically.
Ex:
0FISCPER selection for this year as 001.2008 to 012.2008
0FISCPER selection for next year as 001.2009 to 012.2009.
Now we are changing InfoPackage every year manually, so I need to write a routine for 0FISCPER in InfoPackage to handle dynamically every year
Thanks,
SK.Hi
write an ABAP routine to get that value..But are you getting any planned data(why you want till end of the year...till infopackage runs is o.k i think, if you don't have planned data)...Any way you can check the below code, which can be useful...
You can see the below code at->your infopackage selections>Ty-->choose variable type as 6 and enter any ABAP routine name( to create) and then there is a button on the application tool bar called 'routine info'..this give you the following information...
Definition
You can define complex selections for InfoPackages and control the automatic deletion of requests from InfoCubes in the scheduler, by using routines.
Routines are processing blocks in ABAP programs that consist of a pre-defined data declaration section and an ABAP subroutine (form routine). In the subroutine you can use all of the ABAP programming functions.
You can use the following routines for making selections in InfoPackages:
1. Selection routines for fields, on the Data Selection tab page
2. Selection routines for file names, on the External Data tab page
3. Selection Routines for selecting the from and to dates for time-dependent data, on tab page Update
4. Selection routines for determining old requests to be deleted after successfully loading a new request, on the Data Target tab page
Program frame:
After you have called up the Editor for routine maintenance, you get the following program frame:
1. Selection routines for fields, on tab page Data Selection:
program conversion_routine.
'$*$ begin of global - insert your declaration only below this line -
TABLES: ...
DATA: ...
$$ end of global - insert your declaration only before this line -
FORM COMPUTE_<Fieldname>
tables l_t_range structure rssdlrange
changing p_subrc like sy-subrc.
$$ begin of routine - insert your code only below this line -
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = <Fieldname>.
l_idx = sy-tabix.
modify l_t_range index l_idx.
p_subrc = 0.
$$ end of routine - insert your code only before this line -
ENDFORM.
2. Selection routines for file names, on tabstrip External Data:
FORM compute_flat_file_filename
changing p_filename like rsldpsel-filename
p_subrc like sy-subrc.
$$ begin of routine - insert your code only below this line-
p_filename =
p_subrc = 0.
$$ end of routine - insert your code only before this line-
ENDFORM.
3. Selection routines for selecting the from and to date for time-dependent data, on tabstrip Update:
form compute_time_dependent_dates
changing p_datefrom type d
p_dateto type d
p_subrc like sy-subrc.
$$ begin of routine - insert your code only below this line-
p_datefrom =
p_dateto =
p_subrc = 0.
$$ end of routine - insert your code only before this line-
ENDFORM.
4. Routines for determining the old requests to be deleted after successfully loading a new request, on tab page Data Targets:
form compute_<InfoCube-Name>
tables l_t_request_to_delete structure rsreqdelstruc
using l_request like rsreqdone-rnr
changing p_subrc like sy-subrc.
*Insert Source Code to decide if requests should be deleted.
*All Requests in table l_t_request_to_delete will be deleted
*from Infocube <InfoCube-Name>.
*Add new requests if you want to delete more (from this cube).
*Remove requests you did not want to be deleted.
$$ begin of routine - insert your code only below this line-
loop at l_t_request_to_delete.
endloop.
clear p_subrc.
$$ end of routine - insert your code only before this line-
ENDFORM.
Note:
Those fields flagged with <...> are dependent on the selection fields and are filled automatically by the system when you call up the Editor.
Procedure
Make the following entries:
1. Between $$ begin of global ... and $$ end of global ... you can define data declarations. These are the declaration sections for the local data in the routine. This data is only visible in the routines.
2. The subroutines begin with FORM and end with ENDFORM.
The subroutines for the particular routines are:
Selection routines for fields on tab page Data Selection: FORM COMPUTE_<Field name>
Selection routines for file names on tab page External Data : FORM compute_flat_file_filename
Selection routines for selecting the from and to dates for time-dependent data on tab page Update: FORM compute_time_dependent_dates
Routines for determining old requests to be deleted after successfully loading a new request on tab page Data Target: FORM COMPUTE_<InfoCube-Name>
The subprograms have the following parameters:
Subprogram FORM COMPUTE_<Field name>:
l_t_range
In the table l_t_range the routines for all selection fields that are filled, or have a routine, are made available.
The routines are executed in the scheduler last of all and therefore, you can change all the selections that you have carried out previously.
p_subrc
Using the variable p_subrc you can report errors to the scheduler. p_subrc <> 0 signals an error and means the data request is terminated.
Subprogram FORM compute_flat_file_filename:
p_filename:
You give the name of the file that is to be loaded in parameter p_filename.
This is useful if your file name contains date dependencies that should be determined by sy-datum and calculated during runtime.
p_subrc
You can inform the scheduler of an error with variable p_subrc. p_subrc <> 0 signals an error and means that the data request is terminated.
Subprogram FORM compute_time_dependent_dates:
p_datefrom and p_dateto
Fill these parameters with the from and to dates for time-dependent master data and texts.
p_subrc
You can inform the scheduler about an error using variable >LS>p_subrc. p_subrc <> 0 signals an error and means the data request is terminated.
Subprogram FORM COMPUTE_<InfoCube-Name>:
l_t_request_to_delete
You give the request number of the request that is to be deleted in parameter l_t_request_to_delete. You can also delete requests from the table. These are then not deleted.
p_subrc
You can inform the scheduler about an error with the variable p_subrc. p_subrc signals an error and means the data request is terminated.
3. Insert your program code for the routines between $$ begin of routine ... and $$ end of routine ... so that the respective subprogram variables are supplied with the corresponding values.
4. Check the syntax of your routine with the Check function.
5. You can then transfer the routine with the Save function.
You end routine maintenance when you exit the Editor.
Hope it helps
Thanks,
Teja -
Call function in abap routine of infopackage
Experts,
Good day. I have a problem concerning the data to be imported in my ods.I can't find a similar thread corcerning my problem. My File date field should contain only 2 years and 3months data of recent data. I'm using a call function fima_date_create to filter values of zfile_date.
CALL FUNCTION 'FIMA_DATE_CREATE'
EXPORTING
I_DATE = sy-datum
I_FLG_END_OF_MONTH = ' '
I_YEARS = 2-
I_MONTHS = 3-
I_DAYS = 0
I_CALENDAR_DAYS = 0
I_SET_LAST_DAY_OF_MONTH = ' '
IMPORTING
E_DATE =
E_FLG_END_OF_MONTH =
E_DAYS_OF_I_DATE =
The sy-datum becomes the High value and the date generated by this FM will be the low value. I already tested this function module and it is what i want. How Should I write the ABAP code for this in the abap routine for my infopackage? Or what steps do I need to take.Hi,
When you choose the option to write a routine for one of the characteristics in the infopackage selections, you get a window to write your code with some prewritten code as below. Modify it as shown below, for your requirement.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = 'CALDAY'.
l_idx = sy-tabix.
START of YOUR CODE
<----
Required logic -
>
L_T_RANGE-LOW = <lower limit of range>.
L_T_RANGE-HIGH = <upper limit of range>.
L_T_RANGE-SIGN = 'I'.
L_T_RANGE-OPTION = 'BT'.
END of YOUR CODE
modify l_t_range index l_idx.
p_subrc = 0.
Hope this helps. -
ABAP routine in infopackage that runs function in ECC
Hi All
I need to have dynamic filter in the info package
I have program in ECC that brings me the value that I need to filter in my info packege
I want to use ABAP routine in infopackage that runs function in ECC and brings the value that was received from the ECC function
Is that possible?
ThanksHi All
my CTO found the following option
function module that is "remote-enabled module "
then you call CALL FUNCTION 'Y_FM_IDOC_CATSDB' DESTINATION 'SAP4.7E'
you need to define it in SM59
code example
data: BEGIN OF IT_SOBSL OCCURS 0,
SOBSL(2),
END OF IT_SOBSL.
DATA: ls_range type STANDARD TABLE OF rssdlrange WITH HEADER LINE.
SELECT /BIC/ZSPEPROCI FROM /BIC/SZSPEPROCI INTO TABLE IT_SOBSL
WHERE /BIC/ZSPEPROCI NOT BETWEEN 'AA' AND 'ZZ'
AND /bic/zspeproci ne '' .
BREAK-POINT.
LOOP AT IT_SOBSL.
ls_range-IOBJNM = 'SOBSL'.
ls_range-LOW = IT_SOBSL-SOBSL.
ls_range-SIGN = 'I'.
ls_range-OPTION = 'EQ'.
APPEND ls_range .
ENDLOOP.
loop at ls_range.
append ls_range to l_t_range.
endloop. -
I am in the process of creating an ABAP routine in the Infopackage to load current month based on system data from one cube in BW to another Cube in BW. I am getting the following error in the load. I am not an ABAPer and would appreciate if you can help or guide me with a sample code.
Here is the error.
For sel. field '/BIC/Z_APOSNAP', no selection with SIGN = ''; OPTION '' allowed.
Thank you
NeeluHi Neelu,
U can create a ABAP Routine of the type 6 (ABAP Routine),The field you are trying to populate is a select-option so you have to define both Sign and Option along with Low and High values.
As u want to load current month, from a system values , u can do it from sy-datum.
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = ''/BIC/Z_APOSNAP'.
l_idx = sy-tabix.
l_t_range-low =
l_t_range-high =
l_t_range-sign =
l_t_range-option =
modify l_t_range index l_idx.
p_subrc = 0.
Just u can fill Sign as 'I' and Option 'EQ'.
Fill Low and High with values u get from System Data.
Hope this Helps,
Thanks,
Krish
**awarding points is way of saying thanks in SDN. -
ABAP routine in the infopackage for Multiple Selection
Hi experts,
I want to include a abap routine in the infopackage for Multiple Selection so that I can fetch only the required Material Numbers when the InfoPackage is schedule. As I have the constraints that I have to select certain Material Numbers only, that are not in series - so I cannot select"BT' fuction. Tell me what ABAP Code will work in this scenario.
Kind regards,
Rajesh GiribuwaHi,
The Routine will have to use 'EQ' operator and Append each selections to the Structure.
ABAP Routine
InfoPackage definition for Bespoke SIS Structure
Infopackage routine !
Regards
Happy Tony -
ABAP Routine in the InfoPackage
Hello,
I need to write an ABAP Routine in the infopackage to populate the selection conditions automatically. Coding is for Fiscal year/Period and it should be populated as LOW - Pervious period and HIGH - Current period.
I tried to do the coding myself but couldn't able to fetch the current and previous periods. I would be grateful if some one can share the code with me.
Best Regards,
Nene.Hello,
Try this.
1) Identify the current period by inputting sy-datum to function module 'DATE_TO_PERIOD_CONVERT'.
2) Find the first day of current period using function module
'FIRST_DAY_IN_PERIOD_GET'
3) Minus one day from the first day of current period to get previous period last date.
4) Call the same function module 'DATE_TO_PERIOD_CONVERT' by inputting the previous period last date (derived in step 3).
5) Pass the values to the infopackage code.
$$ begin of routine - insert your code only below this line -
data: l_idx like sy-tabix.
read table l_t_range with key
fieldname = '<field name>.
l_idx = sy-tabix.
l_t_range-SIGN = 'I'.
l_t_range-OPTION = 'BT'.
l_t_range-LOW = <previous period> (refer step 4)
l_t_range-HIGH = <current period> (refer step 1)
modify l_t_range index l_idx.
Thanks
Viswa
(Assign points if helpful). -
Need to write ABAP Routine at infopackage Selection Options
Hi All,
I need to write ABAP Routine at Info Package Selection Options.
Requiremnet i need to bring some Sales Document Types (Sales Orders Types) only from R/3.
Ex I need OrderTypes ZQT,ZSIV etc
Can any body help to resolve this.
Regards,
P.C.V.Hi P.C.V,
If the order type field is already available in the Data Selection Tab of the InfoPackage, then you just need to place your selections there (e.g. order type = ZQT, ZSIV) without the need to use ABAP routines.
If ever you really need an ABAP routine, here is an example ABAP routine. The most important concept is to modify the range table l_t_range so that the selection reflect what you need.
data: l_idx like sy-tabix.
data: w_startdate like sy-datum,
w_startweek like scal-week,
w_maxdate like sy-datum,
w_maxweek like scal-week.
w_startdate = sy-datum.
w_maxdate = w_startdate + 104 * 7.
* Calculate horizon for extraction
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = w_startdate
IMPORTING
WEEK = w_startweek
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = w_maxdate
IMPORTING
WEEK = w_maxweek
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2.
read table l_t_range with key
fieldname = 'CALWEEK'.
l_idx = sy-tabix.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
l_t_range-low = w_startweek.
l_t_range-high = w_maxweek.
modify l_t_range index l_idx. -
Use ABAP Routine in Selection Tab of Infopackage
I am trying to use the ABAP routine in the InfoPackage SELECTION Tab to "EXCLUDE" a value. For example, I want to load all the Material types, except ZUN1. But, when I write in the ABAP, l_t_range-sign = 'E' instead of 'I' or l_t_range-option = 'NE' instead of 'E', I get an error saying these values are not permitted.
Is there any way to exclude any value from Selection in the InfoPackage?
Regards,
Milind VadHi dear and welcome on board!
You have two options:
include everything you want in your IP
load everything and exclude what you don't want in the start routine in transfer rules
No other ways...
Hope it helps!
Bye,
Roberto
...and please don't forget to reward the answers...it's THE way to say thanks here ! -
ABAP ROUTINE AT INFOPACKAGE FOR DATE RANGE
hi all,
I want to Schedule my infopackge with selection options
0DATE infoobject with First date of current month( 01.02.2008) to last date of current month ( 29.02.2008).
this i have to get automatically bcoz i have to use this in process chain.
so I want to write a routine for this at the infopackage level with ABAP Routine -6 option.
So please suggest me how to write the code for this case.
thanks,
kiran manyam.Hi Kiran,
Please paste the following code there and also check for syntax error.
data first_date type d.
data last_date type d.
first_date = sy_datum.
first_dat+6(2) = '01'.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
Exporting
DAY_IN = first_date
Importing
LAST_DAY_OF_MONTH = last_date.
read table l_t_range with key
fieldname = 'DATE'.
if sy-subrc = 0.
l_idx = sy-tabix.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
l_t_range-low = first_date.
l_t_range-high = last_date.
modify l_t_range index l_idx.
else.
move 'DATE' to l_t_range-fieldname.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
l_t_range-low = first_date.
l_t_range-high = last_date.
append l_t_range.
endloop.
endif.
p_subrc = 0. -
Sample ABAP routine code to load only previous month data in INFOPACKAGE
Hi all,
I want to create one ABAP routine in InfoPackage (Variables change to selection values with background processing) for 0CALMONTH ( Calender year month) so that whenever this infopackage is executed it should fetch only previous month data.
Can anyone please provide any sample code for that.
Thanks in advance.
Uday shankar.Hi
Please check with below code, hope this will resolve your issue
WHEN: 'ZLASTP'.
CLEAR: h_period, h_gjahr.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = sy-datum
I_MONMIT = 00
i_periv = 'AF'
IMPORTING
e_buper = h_period
e_gjahr = h_gjahr
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF h_period = '001'.
h_gjahr = h_gjahr - 1.
h_period = '012'.
ELSE.
h_period = h_period - 1.
ENDIF.
CLEAR l_s_range.
CONCATENATE h_gjahr h_period INTO l_s_range-low.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range. -
ABAP Routine using Table: TVARVC in InfoPackage
hello...i wanted to create an ABAP Routine in the InfoPackage and I am not good in ABAP Routine. I wanted to pull the data of the "selection value" from the TVARVC table to fill in the "Calendar Day" selection option in the InfoPackage. The selection option for the calendar day should be able to pull out the data from the TVARVC table and save the InfoPackage to load the data based on the selection value. Actually what can I do to archieve this???
Hello
You ABAP code is quite right, but there is only one little thing wrong :
Define i_keyfind LIKE TVARVC (as a structure)
Don't DELETE l_t_range, you just have to modify the line.
SELECT LOW FROM TVARVC into i_keyfind-low WHERE NAME = 'ZTEST'.
IF sy-subrc eq 0.
l_t_range-low = i_keyfind-low.
ENDIF.
IF l_idx <> 0.
MODIFY l_t_range INDEX l_idx.
ELSE.
APPEND l_t_range.
ENDIF.
It should work with this.
Kind Regards
Mickael
Maybe you are looking for
-
How to restore MBP with dual drives from time machine
Hi one and all. Hoping I can get some help here. My trusty mid 2010 i5 MBP's hdd died on me the other day, which isn't really the problem, as I've got two time machine back-ups. The issue is that in my wisdom I decided to swap out my old (and nearly
-
I need help in syncing my itunes from my old PC to my new laptop. Also, I want to sync my itunes list to my new iphone. i have tried it but I seem to be missing a step. need help!!!
-
Lost my Mac book Pro and I want to protect all my data in it. I have installed Mac keeper in my MacBook Pro and have activated theft lock. Now who and where should I report the loss of my MacBook Pro?.
-
Export from Captivate to MS Office (PowerPoint, Word)
Good day! I have a question. I Have a Captivate project (slides). This slides are made in Captivate, but I want to export it in MS Office (PowerPoint or Word) and then change this slides in MS Office programs. How can I do this?
-
import java.lang.String; import java.lang.Integer; import java.lang.Float; import java.util.Hashtable; import java.util.Enumeration; public class VenkatCart { protected Hashtable items = new Hashtable(); public VenkatCart() { public void addItem(Stri