10-30-2007 7:53 AM
hi
in cdhdr table udate field is there. i want to retrieve the records belong to 2007
only. when i am using offset on udate field as udate+0(4) in the select statement it is showing error. plz tell me how to retrieve only year form udate field in select stament.
regards
sami
10-30-2007 7:55 AM
select * from cdhdr into table itab where udate like '2007%'.
regards
shiba dutta
10-30-2007 7:55 AM
select * from cdhdr into table itab where udate like '2007%'.
regards
shiba dutta
10-30-2007 8:48 AM
i don't want to hard code 2007. the select statment is
select * from cdhdr
where udate = sy-datum+0(4).
so know how to write the statment to compare the year.
10-30-2007 8:57 AM
ok then take a char field
data : yr(5).
concatenate sy-datum+0(4) '%' into yr.
now use
select * from cdhdr into table itab where udate like yr.
regards
shiba dutta
10-30-2007 7:55 AM
you can not fetch like that you need to fech total date then conver it to only year
select udate
from cdhdr
into gt_cdhdr.
loop at gt_cdhr.
gt_cdhr-udate = gt_cdhr-udate+0(4)
modify gt_cdhr transporting udate.
endloop.
Rewards if useful.........
Minal Nampalliwar
10-30-2007 8:00 AM
Hi...
You can use the LIKE Operator in this Case for checking the conditions.
Eg
Select * from CDHDR into table itab where Udate LIKE '2007%'.
To access the Year field only use...
SELECT udate(4) FROM cdhdr.....
<b>reward if Helpful.</b>
10-30-2007 8:02 AM
You can use 'Select * from CDHDR where udate like '2007%'.
Reward the points if it is useful.