‎2007 Feb 09 8:46 PM
Hi everyone , I`m trying to compare two dates , one of them is the field planfinish (type: DEC 15 ) of cgpl_task table in CRM , it has the format : 31.10.2006 03:59:00 , the other date is sy-datum. But I don`t know what can I do ? ,
For example the next select bring me all registers , it doesnt care about t1~planfinish > sy-datum condition .
SELECT t2objnr t1guid t1external_id t1planfinish t2~stat INTO TABLE ti_campaut
FROM cgpl_task AS t1
INNER JOIN crm_jest AS t2
ON t1guid = t2objnr
WHERE t1~object_type = 'CPT'
AND t2~inact = ' '
AND t2~stat = 'I1122'
AND t1~planfinish > sy-datum .
any help. ?
‎2007 Feb 09 9:07 PM
if you don't need the time stamp truncate the date with time stamp in the sy-datum format and compare.
Or else try other system fields like sy-uzeit.
concatenate sy-datum and sy-uzeit and use it in ur select
Message was edited by:
Vinni
Message was edited by:
Vinni
‎2007 Feb 09 9:07 PM
if you don't need the time stamp truncate the date with time stamp in the sy-datum format and compare.
Or else try other system fields like sy-uzeit.
concatenate sy-datum and sy-uzeit and use it in ur select
Message was edited by:
Vinni
Message was edited by:
Vinni
‎2007 Feb 09 9:52 PM
hey is ur problem solved ? if yes award points and close the thread.
‎2007 Feb 09 10:06 PM
Hi Ali,
Can you tell in which format the date is coming in field planfinish after writing select query?
e.g. 31102006 (DDMMYYYY) or 10312006 (MMDDYYY) etc.
If the date in palnfinish is coming in DDMMYYYY format the you need to check Date format of sy-datum. Most of the time it is YYYYMMDD. In this case before comparing you need to format the sy-datum field in another variable. e.g. Here sy-datum is in YYYYMMDD format.
DATA: v_date(8) TYPE c,
v_date2(15) TYPE c.
v_date4(4) = sy-datum0(4).
v_date2(2) = sy-datum4(2).
v_date0(2) = sy-datum6(2).
You can make v_date in same sequence as planfinish.
If palnfinish is having TIME also then declare another variable of length 15 & concatenate the v_date & sy-uzeit into that variable & then compare.
Concatenate v_date sy-uzeit into v_date2.
Now compare this v_date2 with palnfinish field.
Ashven