on 2016 Jun 14 9:30 AM
Hi All,
I have a requirement where based on user input data on calendar date ( IDATE) 01.01.2013 - 01.03.2013 , we need to take the high value of date from that we need to display two columns , one column should show the last 3 months period data and second coulmn should display data for last 6 months.
Problem is when query is showing data only for first two months of period i.e. 001.2013 and 002.2013.
We created two variable as reference characteristics as fiscper and processing by customer exit.
please find the below code and out put , but when i make a check in RSRT with key figure definition is coming correctly where it is calculating properly for 3 month and 6 months data.
IF i_step EQ 2.
CASE i_vnam.
WHEN 'NXXV6MON'.
CLEAR: ls_var_range, lv_date,lv_pre_period, lv_res_date.
* Read input variable Reporting Fiscal Year/Period
READ TABLE i_t_var_range_c WITH KEY vnam = 'IDATE'
INTO ls_var_range.
IF sy-subrc EQ 0.
lv_date = ls_var_range-high.
lv_curr_year = lv_date+0(4).
lv_curr_period = lv_date+4(2).
CALL FUNCTION 'DATE_CREATE'
EXPORTING
ANZAHL_JAHRE = 0
ANZAHL_KALTAGE = 0
ANZAHL_MONATE = -5
ANZAHL_TAGE = 0
DATUM_EIN = lv_date
* DATUM_EIN_ULT = ' '
* ULTIMO_SETZEN = ' '
IMPORTING
DATUM_AUS = lv_res_date.
* E_TT =
* E_ULTKZ
lv_pre_period = lv_res_date+4(2).
lv_pre_year = lv_res_date+0(4).
CONCATENATE lv_pre_year lv_pre_period into lv_result_pre.
CONCATENATE lv_curr_year lv_curr_period into lv_result_pre1.
ls_range-sign = 'I'.
ls_range-opt = 'BT'.
ls_range-low = lv_result_pre.
ls_range-high = lv_result_pre1.
* ls_range-low = '2016001'.
* ls_range-high = '2016002'.
APPEND ls_range TO e_t_range_c.
ENDIF.
WHEN 'NXX3MON'.
CLEAR: ls_var_range, lv_date,lv_pre_period, lv_res_date.
* Read input variable Reporting Fiscal Year/Period
READ TABLE i_t_var_range_c WITH KEY vnam = 'IDATE'
INTO ls_var_range.
IF sy-subrc EQ 0.
lv_date = ls_var_range-high.
lv_curr_year = lv_date+0(4).
lv_curr_period = lv_date+4(2).
CALL FUNCTION 'DATE_CREATE'
EXPORTING
ANZAHL_JAHRE = 0
ANZAHL_KALTAGE = 0
ANZAHL_MONATE = -2
ANZAHL_TAGE = 0
DATUM_EIN = lv_date
* DATUM_EIN_ULT = ' '
* ULTIMO_SETZEN = ' '
IMPORTING
DATUM_AUS = lv_res_date.
* E_TT =
* E_ULTKZ
lv_pre_period = lv_res_date+4(2).
lv_pre_year = lv_res_date+0(4).
CONCATENATE lv_pre_year lv_pre_period into lv_result_pre.
CONCATENATE lv_curr_year lv_curr_period into lv_result_pre1.
ls_range-sign = 'I'.
ls_range-opt = 'BT'.
* ls_range-low = '2016001'.
** ls_range-high = ''.
ls_range-low = lv_result_pre.
ls_range-high = lv_result_pre1.
APPEND ls_range TO e_t_range_c.
ENDIF.
Out put
out is showing only two fiscal year period data 001.2013 and 002.2013, but our requirement should display last 6 months 010.2012 to 003.2013
and last three months 001.2013 to 003.2013
Request clarification before answering.
Hi,
I don't find any issue with the code. Even if you put IDATE in the filter to accept the user input, at least 3 months data should be displayed for both the keyfigures i.e 01.2013 to 03.2013.
On what basis you have arrived for the conclusion that the data is displayed for only 2 months?
Have you checked the targets of the query whether data presents or not?
Also on what kind of infoprovider the query has been built so that you may get some clue.
Regards,
Satya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Former Member If you put filter on CALDAY at query level it will fetch data only for given period.
Filter is to be used inside selection on KF.
Query should fetch all the records which are to be used in KF selections.
There are 3 selections in this case
1. Given period
2. Last 3 Months based on last day of given period
3. Last 6 Months based on last day of given period
So query should fetch data for last 6 months.
Regards,
Sucheta
User | Count |
---|---|
88 | |
10 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.