Skip to Content
0
Former Member
Jan 05, 2008 at 10:35 AM

Read Year from System Date & Compare - Assistance required

24 Views

Hi All,

I am trying to read only the year part from the system date & then checking if any entry exists in EKKO table (EKKO-BEDAT) for the year. I think i am making an error in my data declaration for V_YEAR & in my select statement (EKKO~BEDAT LIKE V_YEAR), not sure how to compare only the year part, can someone help.

DATA:

V_EBELN TYPE EKPO-EBELN,

V_YEAR TYPE SY-DATUM.

CLEAR: V_EBELN, V_YEAR.

*Read year from system date

V_YEAR = SY-DATUM+0(4).

CONCATENATE '%' '%' '%' '%' V_YEAR INTO V_YEAR.

*Select section

SELECT SINGLE EKPO~EBELN INTO V_EBELN

FROM EKPO

INNER JOIN EKKO

ON EKPOEBELN = EKKOEBELN

INNER JOIN LFM1

ON EKKOLIFNR = LFM1LIFNR

WHERE EKKO~LIFNR = LFM1-LIFNR

AND EKKO~BEDAT LIKE V_YEAR

AND EKPO~LOEKZ = SPACE.