08-05-2008 10:16 AM
Hi all,
In one of my report i need to fetch records from a table where the enddate (RVEND) is of current year
so what i was doing is taking a variable v_year = sy-datum+0(4). so now v_year will have current year
and i am taking a char(10) variable v_enddate and concatinating '%' and v_year to it.
now when i am trying to fetch values using this in the select query with where-like condition i am not getting any records for the table.
Can any one of you please help me regarding this issue. how can i retreive records for a table where enddate is of current year.
08-05-2008 11:16 AM
Hi Tulasi,
select <fields>
from <db table>
into table <itab>
where <your conditions>
and rvend eq sy-datum+0(4).
Regards
Indu
08-05-2008 11:16 AM
Hi Tulasi,
select <fields>
from <db table>
into table <itab>
where <your conditions>
and rvend eq sy-datum+0(4).
Regards
Indu
08-05-2008 11:16 AM
Hi Tulasi Deepthi,
Do not conatenate %.
Use Less than symbol for year comparision.
Example:
data:
v_year(4) type c.
v_year = sy-datum+0(4).
select f1 f2...fn
from database table
into table t_itab
where RVEND LE v_year.
Regards,
Rama.
08-05-2008 11:19 AM
instead of that you can try this approach.
data: r_date type range of sy-datum,
w_date like line of r_date.
data: it_flight type sflight_tab1.
concatenate sy-datum+0(4) '01' '01' into w_date-low.
concatenate sy-datum+0(4) '12' '31' into w_date-high.
w_date-sign = 'I'.
w_date-option = 'BT'.
append w_date to r_date.
select * from sflight
into table it_flight
where fldate in r_date.
08-05-2008 11:25 AM
Hi Tulasi,
select <fields>
from <db table>
into table <itab>
where <your conditions>
and rvend eq sy-datum+0(4).
Regards
Indu
08-05-2008 11:27 AM
hi,
check the code-proto
let itab be your target internal table.
DATA: DATE TYPE SY-DATUM,
DATE_TEMP(2) TYPE C,
DATE_CHECK(8) type c.
DATE = SY-DATUM.
DATE_TEMP = DATE+0(4).
concatenate DATE_TEMP '____' INTO DATE_CHECK.
" the 2nd component string consist of 4 underscore
" as '_' is the wild card char for single char
SELECT *
FROM ( table_name)
INTO TABLE itab
WHERE endda like DATE_CHECK.
Regards,
Anirban
08-05-2008 11:33 AM
Hi
Try this...
DATA: STR1(30) TYPE C.
CONCATENATE '%' v_year '%' INTO STR1.
SELECT ...... WHERE <FIELD> LIKE <STR1>.
Hope it helps.
Murthy
08-05-2008 11:40 AM
Hi,
Data:w_date type sy-datum.
Concatenate sy-datum+0(4) '%' into w_date.
Select * from Ztable
into table itab
where RVEND like w_date.
Regards,
Sujit