Hi All,
I have written 2 queries in Bex 7.x which have similar requirement. One uses 0CALMONTH and other 0FISCPER. I will describe scenario with Calendar Year month query.
- Query to have user entry screen for 0CALMONTH. Added 0CALMONTH in Filters section and restricted on mandatory user entry variable.
- Key figures restricted in four ways by creating a row structure with four selections
- Current Month User entered value on selection screen (Restricted on User entry variable)
- Previous Month / Period (Above value offset -1)
- YTD value Range from Previous July / 07.YYYY to current user entered month value (Custom exit)
- LYTD value - Above value for previous year (Above value offset -12)
For YTD value wrote a custom exit code which uses the user entry variable on 0CALMONTH to retrieve the current month value and then give output range value for YTD.
The custom exit code when debugged seems to calculate the correct range. However the query output is not working and gives out the same data for Current month and YTD range. Also LYTD value and Previous month value don't show up with any data at all.
Any tips on where we are going wrong would be helpful.
Thanks!
Custom Exit code:
WHEN 'ZGB_FP_AYTD_PTNR'.
IF i_step EQ '2'.
READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZFP_AYTD_PRTNR'
iobjnm = '0CALMONTH'.
IF sy-subrc EQ 0.
CLEAR: l_month_curr, l_month_low, l_year_curr, l_year_low,
l_calmonth_low, l_calmonth_high.
l_month_curr = loc_var_range-low+4(3).
l_year_curr = loc_var_range-low+0(4).
l_month_low = 001.
l_year_low = l_year_curr.
CONCATENATE l_year_low l_month_low INTO l_calmonth_low.
CONCATENATE l_year_curr l_month_curr INTO l_calmonth_high.
l_s_range-low = l_calmonth_low.
l_s_range-high = l_calmonth_high.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDIF.