‎2008 Oct 21 2:44 PM
Hi All,
I have a date field in UTC date formate in the data base table.
For Ex: 20.080.804.121.334,0000000
YY YY MM DD
I want to compare this date with current system date (Ex 20080804)in the report and want to pull the data from table.
Could you please help me out on this??
Thanks in advance.
Sekhar
‎2008 Oct 21 3:00 PM
Instead of converting the stored UTC timestamp to normal date before selecting the data, you can fill the range for the required UTC timestamp and select the data based on that range.
DATA: r_utc type range of timestampl,
l_r_utc like line of r_utc.
DATA: time_stamp TYPE timestampl,
dat TYPE d,
tim TYPE t,
tz TYPE ttzz-tzone,
dst(1) TYPE c.
tz = 'CST'.
dat = sy-datum.
tim = '000000'.
CONVERT DATE dat TIME tim
INTO TIME STAMP l_r_utc-low TIME ZONE tz.
tim = '235959'.
CONVERT DATE dat TIME tim
INTO TIME STAMP l_r_utc-high TIME ZONE tz.
l_r_utc-sign = 'I'.
l_r_utc-option = 'BT'.
append l_r_utc to r_utc.
SELECT * FROM DBTAB
INTO TABLE ITAB
WHERE UTC_TIME IN R_UTC.
Once you get your data into table, you can use the CONVERT TIME STAMP to get the date and time.
CONVERT TIME STAMP time_stamp TIME ZONE tz
INTO DATE dat TIME tim DAYLIGHT SAVING TIME dst.
WRITE: /(10) dat, (8) tim, dst.
Regards,
Naimesh Patel
‎2008 Oct 21 2:48 PM
move the field to a character field and tehn take the first 8 bytes for date
‎2008 Oct 21 2:58 PM
Hi,
move first 10 characters into one variable.
we can replace '.' with space using Replace all occurence of statement.
we can use condense statement to condense the variable.
Now we can compare two dates.
Regards,
Suresh
‎2008 Oct 21 3:00 PM
Instead of converting the stored UTC timestamp to normal date before selecting the data, you can fill the range for the required UTC timestamp and select the data based on that range.
DATA: r_utc type range of timestampl,
l_r_utc like line of r_utc.
DATA: time_stamp TYPE timestampl,
dat TYPE d,
tim TYPE t,
tz TYPE ttzz-tzone,
dst(1) TYPE c.
tz = 'CST'.
dat = sy-datum.
tim = '000000'.
CONVERT DATE dat TIME tim
INTO TIME STAMP l_r_utc-low TIME ZONE tz.
tim = '235959'.
CONVERT DATE dat TIME tim
INTO TIME STAMP l_r_utc-high TIME ZONE tz.
l_r_utc-sign = 'I'.
l_r_utc-option = 'BT'.
append l_r_utc to r_utc.
SELECT * FROM DBTAB
INTO TABLE ITAB
WHERE UTC_TIME IN R_UTC.
Once you get your data into table, you can use the CONVERT TIME STAMP to get the date and time.
CONVERT TIME STAMP time_stamp TIME ZONE tz
INTO DATE dat TIME tim DAYLIGHT SAVING TIME dst.
WRITE: /(10) dat, (8) tim, dst.
Regards,
Naimesh Patel