2007 Jun 12 3:32 AM
Hi,
below is my code, i need to run monthly report, s_wadat is select-option variable, if i give 06/26/2003 i should get from month 05/01/2003 to 05/31/2003 data, my below code is working for current year only(2007 only), how to modify
data: last_month_last_day like S_WADAT.
last_month_last_day = S_WADAT .
last_month_last_day+6(2) = '01'.
last_month_last_day = last_month_last_day - 1.
*write:/ last_month_last_day.
data : date1 like S_WADAT.
date1 = last_month_last_day .
date1+6(2) = 01. "set the date to first of month
*write:/ date1.
SELECT LIKP~VBELN
LIKP~WADAT_IST
KNA1~NAME1
LIPS~MATNR
LIPS~CHARG
LIPS~LFIMG
LIPS~WERKS
VBKD~BSTKD
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM LIKP
JOIN LIPS ON LIKPVBELN = LIPSVBELN
JOIN VBKD ON LIPSVGBEL = VBKDVBELN
JOIN KNA1 ON KNA1KUNNR = LIKPKUNNR
WHERE LIPS~LFIMG GT 0 AND
LIKP~KUNAG IN S_KUNAG AND
LIKP~WADAT_IST between date1 and last_month_last_day
AND "S_WADAT-low and S_WADAT-high AND
LIKP~VBELN IN S_VBELN
ORDER BY LIKP~WADAT_IST
LIKP~VBELN.
2007 Jun 12 4:16 AM
Hi,
The following code i used find last day of last month from sy-datum.
May this one help you
data: date1 like sy-datum.
parameters: p_date like sy-datum default sy-datum.
p_date+6(2) = 01.
date1 = p_date - 1.
aRs