This blog describes about the I_T_VAR_RANGE table.
All about I_T_VAR_RANGE tables:
This table is used to fetch the data given by the end user in the variable whenever we execute the report.
Let’s say we have MTD report, in this report we will pass the date as the input.
Whenever we pass the date in the variable screen , the date value is stored in the I_T_VAR_RANGE table.
The various fields present in this table are
LOW, HIGH, OPT, SIGN
Low: Whenever we pass the single value in the variable screen , by default that value is stored in the LOW field .
High : Whenever we pass the range values , the first value is stored in the low field and last value is stored in the high field of I_T_VAR_RANGE internal table.
OPT: The various option for the OPT are EQ,BT,NE etc..
SIGN : The various option for the SIGN is I,E.
Now our requirement is to create the MTD report.
MTD report will displays the output starting of the month till the user input date. Let say the user has given the input date as 20130328, Then MTD report should display the data starting from the first date of that month ( 20130301) till the user input date.
So in this scenario it has to display the output starting from the range 20130301 to 20130328.
Here the user will give the date as 20130328 in the variable screen, now this value is stored in the I_T_VAR_RANGE internal table. If we want to fetch the data from the table , then we have to create work area, as shown below.
data wa like line of i_t_var_range.
Now we can able to retrieve the data from the internal table as shown. Since the user has given one value , by default the value is stored in the LOW field of I_T_VAR_RANGE internal table.so now the data from that table will be retrieved as shown below
data : ref_date type d,
first_date type d,
last_date type d.
ref_date = wa-low. ” wa-low will fetch the data from the low field of the I_T_VAR_RANGE table.
“now ref_date will hold the data 20130328.
first_date = ref_date.
first_date+6(2) = ’01’. ” In the first date we should get the first date of that month.
last_date = ref_date. ” In the last date we should get the user input date.
wa-low = first_date.
wa-high = last_date.
wa-sign = ‘I’.
wa-opt = ‘BT’.
append wa to e_t_range.
Now whenever you execute the report, it will display the MTD report.
Hope you got it,