Skip to Content
0
Former Member
Jun 12, 2007 at 02:32 AM

Re:regarding date function:urgent

8 Views

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.