Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Re:regarding date function:urgent

Former Member
0 Kudos

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.

1 REPLY 1

former_member194669
Active Contributor
0 Kudos

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