Hello,
I created a customer exit variable which has to show the range between the first and last day of the previous month. The query will be executed every first of the month.
Variable is declared as: Customer exit, based on 0CALDAY, Interval, Mandatory and NOT input.
When i debug the query, it is making the calculation but its not populating my variable; when I execute the query from RSRT, the output test shows a message:
ENo value could be determined for variable ZRANGE_PREVMONTH. BRAIN 632ZRANGE_PREVMONTH
Below the code i'm using (SAP 7.4)
***Customer Exit to calculate previous month.
IF i_step = 2.
CASE i_vnam.
WHEN 'ZRANGE_PREVMONTH'.
DATA: LS_RA_SID TYPE RSR_S_RANGESID.
DATA: yyyy(4) TYPE n.
DATA: mm(2) TYPE n.
DATA: dd(2) TYPE n.
DATA: fst_date LIKE sy-datum.
DATA: fst_date2 LIKE sy-datum.
LOOP AT i_t_var_range_c INTO loc_var_range
WHERE vnam = '0DAT'.
dd = sy-datum+6(2).
mm = sy-datum+4(2).
yyyy = sy-datum+0(4).
fst_date2 = sy-datum.
IF dd = '01' AND mm = '01'.
mm = '12'.
yyyy = yyyy - 1.
ELSEIF dd = '01' AND mm <> '01'.
mm = mm - 1.
ELSEIF dd <> '01'.
mm = mm - 1.
ENDIF.
CLEAR: fst_date.
CONCATENATE yyyy mm '01' INTO fst_date.
fst_date2 = fst_date2 - 1.
CLEAR: ls_ra_sid.
ls_ra_sid-sign = 'I'.
ls_ra_sid-opt = 'BT'.
ls_ra_sid-high = fst_date2.
ls_ra_sid-low = fst_date.
APPEND ls_ra_sid TO e_t_range.
ENDLOOP.
ENDCASE.
ENDIF.