Dear all,
I have a text variable to display the last date of a month, named ZT_LASTDATE.
Subsequently, I write an ABAP code in CMOD as follows:
CASE I_VNAM. WHEN 'ZT_LASTDATE'. * IF I_STEP = 2. * Assign 0P_PER3 (Posting Period) value to v_month. CLEAR loc_var_range. READ TABLE i_t_var_range INTO loc_var_range WITH KEY VNAM = '0P_PER3'. * Logic to convert Period 13, 14, 15 & 16 to Period 12. IF loc_var_range-low GT '012'. v_month ='12'. * For normal periods (Period 01 - Period 12). ELSE. v_month = loc_var_range-low+1(2). ENDIF. * Assign 0P_FYEAR (Fiscal Year) value to v_year. CLEAR loc_var_range. READ TABLE i_t_var_range INTO loc_var_range WITH KEY VNAM = '0P_FYEAR'. v_year = loc_var_range-low. * Assign first date of the month i.e. 01 to v_date. v_date = '01'. * Concatenate Year, Month & Date into ZW_DT1 as input * for SLS_MISC_GET_LAST_DAY_OF_MONTH function module. CONCATENATE v_year v_month v_date INTO ZW_DT1. * Call function module to get last date of the month. * Input : ZW_DT1 e.g. 20111201 * Output : ZW_DT2 e.g. 20111231 CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH' EXPORTING day_in = ZW_DT1 IMPORTING last_day_of_month = ZW_DT2. * Prepare last date of the month in DD.MM.YYYY format. * ZW_DT2 date format = 20111231 * l_s_range-low date format = 31.12.2011 CLEAR l_s_range. l_s_range-low+0(2) = ZW_DT2+6(2). l_s_range-low+2(1) = '.'. l_s_range-low+3(2) = ZW_DT2+4(2). l_s_range-low+5(1) ='.'. l_s_range-low+6(4) = ZW_DT2+0(4). l_s_range-sign = 'I'. l_s_range-opt = 'EQ'. * Send last date of the month output to ZT_LASTDATE variable. APPEND l_s_range TO e_t_range. * ENDIF. ENDCASE.
However, when I execute my query, the variable text is displayed as &ZT_LASTDATE& and not as expected e.g. 31.12.2010.
I tried to debug it and found out that after the program stop at
WHEN 'ZT_LASTDATE'.
it went straight to ENDFUNCTION of INCLUDE ZXRSRU01.
May I know what went wrong here?
Thanks!