‎2009 Dec 27 8:17 AM
i have a selection screen where year is only input field, and in my table there is a date field, so i have to retrieve the data only of the given year only, so how do i substring the date field of that table and compare with my input in select statement
‎2009 Dec 27 11:30 AM
Hi
Try sth like this:
PARAMETERS p_year(4) TYPE n.
DATA: it_flight TYPE TABLE OF sflight,
year_start TYPE d,
year_end TYPE d.
START-OF-SELECTION.
CONCATENATE p_year '0101' INTO year_start.
CONCATENATE p_year '1231' INTO year_end.
SELECT * FROM sflight INTO TABLE it_flight WHERE fldate BETWEEN year_start AND year_end.
Best regards,
Katarzyna Rafalska
‎2009 Dec 27 11:30 AM
Hi
Try sth like this:
PARAMETERS p_year(4) TYPE n.
DATA: it_flight TYPE TABLE OF sflight,
year_start TYPE d,
year_end TYPE d.
START-OF-SELECTION.
CONCATENATE p_year '0101' INTO year_start.
CONCATENATE p_year '1231' INTO year_end.
SELECT * FROM sflight INTO TABLE it_flight WHERE fldate BETWEEN year_start AND year_end.
Best regards,
Katarzyna Rafalska
‎2009 Dec 27 8:21 PM
If your corresponding database table has the year field and you want to get the data according to the fiscal year
then try the following ways : .
.
parameters : p_date type datum. " Ur date field.
data : g _year type i.
at selection-screen:.
move p_date+0(4) to g_year.
Then pass g_year in your where clause.
or you can use the FM.
CALL FUNCTION 'GET_CURRENT_YEAR'
EXPORTING
bukrs = u2018ur company code'u2019
date = ur date field.
IMPORTING
* currm = fiscalmonth
curry = g_year.
here also pass g_year in your where clause.
Regards
Abhinab.
‎2009 Dec 28 2:54 AM
Please Press F1 on CS.
Using Contain string you can check the current year in date.
Hope this helps you.
‎2011 Sep 27 10:04 AM
After a long time i saw my question and acknowledge that i know the answer...:)
TABLES: FAGLFLEXA.
SELECT * INTO FAGLFLEXA
FROM FAGLFLEXA
WHERE BUDAT LIKE '2011%'.
ENDSELECT.
WRITE: SY-DBCNT.