10-10-2007 11:26 AM
Can someone assist with how to select dates for a table based on the criteria that the offset is 5 and if at that offset the number is less than 2 e.g. 20.07.1998 would be selected and 20.07.2007 will not.
thanx in advance
10-10-2007 11:31 AM
Hi,
Do you mean to check whether the date is before 01.01.2000? Or am I thinking wrong?
Regards, Joerg
10-10-2007 11:34 AM
variable = date - 2. "2 is your offset
use the variable in your select condition.
10-10-2007 11:39 AM
Hi,
I hope you want to Retrieve the date from year 1998 only.
Then use this select command with appropriate changes.
SELECT * FROM Table_Name INTO TABLE it
WHERE spras = sy-langu
AnD date LIKE '%1998%'.
Thanks,
Reward If Helpful.
10-10-2007 12:10 PM
Hi,
If it is an ABAP DATE field (in SAP-supplied tables it should be), then
SELECT * FROM table WHERE date lt '20000101' ...
should suffice.
Regards, Joerg
10-10-2007 12:34 PM
Hi Darlington,
First you select all the dates into your internal table.
What i mean to say is, use selection criteria to pick data from your data base table.
after fetching all the records check whether the date field's first character
if it is '2' then delete that record from the internal table.
<b>Example1:</b>
tables: pa0000.
data: begin of itab occurs 0,
begda like pa0000-begda,
end of itab.
select begda from pa0000 into table itab.
if sy-subrc = 0.
sort itab by begda.
<b>delete itab where begda+0(1) eq '2'.</b>
endif.
<b>Also check another example:</b>
System stores data as 'YYYYMMDD' format.
data: v_date1 type sy-datum value '19980720'.
data: v_date2 type sy-datum value '20070720'.
if v_date1+0(1) ge '2'.
write:/ 'Not a valid date'.
else.
write:/ 'Valid date'.
endif.
if v_date2+0(1) ge '2'.
write:/ 'Not a valid date'.
else.
write:/ 'Valid date'.
endif.
10-10-2007 1:47 PM
Let me put it straight. The problem is, some dates in the DKKKOP table for fields FAEDN and FAEDS are appearing reversed. e.g. 01.08.2007 is appearing as 20.07.0801. So I would like to search using the fifth offset to search for char less than 2.
10-10-2007 1:50 PM
If you say for some records the date is 20.07.0801, then I would be asking who in your company has done a direct update to the table and got it wrong.
10-12-2007 12:49 PM