11-21-2012 7:55 AM
Hi Experts,
I am Creating function Module in that i have to write a select query that query needs to retrieve fields from Custom table and the condition is based on date, between that dates i need to fetch. I have field as SUB_QUAN_TIMEST(char 14) and there is no start date and end date fields.
ie. i have to write like this where SUB_QUAN_TIMEST between given week range .
Can any one tell me how to write this .
11-21-2012 8:04 AM
Loop this SUB_QUAN_TIMEST If this is a Table.
Split the SUB_QUAN_TIMEST Into table ITAB with ofset (as it is a 14 character. you will have date in two 7 char formats).
Then check the useful FM from the below link.
http://scn.sap.com/thread/3269347
build your logic.
endloop.
hope this helps.
11-21-2012 8:42 AM
Hi Venkat,
Thanks for your reply.
But SUB_QUAN_TIMEST field is timestamp field.
11-21-2012 8:48 AM
ok then as mentioned by you. If it is a Timestamp field.
Then you will only get one date.. If there are two timestamps then you will get two dates.
but anyhow check the below mentioned FM to converting timestamp to a date and time.
CACS_TIMESTAMP_GET_DATE
hope this helps.
11-21-2012 8:54 AM
just check how the value is stored if it is YYYYMMDDhhmmss, just take the first 8 characters from date put hhmmss as 000000 and for to date parameter put hhmmss as 235959 . then i think you can write your where clause with between operator. Hope it helps
11-21-2012 8:44 AM
how this date range is stored in sub_quan_timest ..? you can check a record in the table.
if you know that then you can use it to create the same through your from and to date parameters and pass it to your where clause.