Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass given week range condition to select query which is function module

Former Member
0 Kudos

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 .

5 REPLIES 5

Venkat_Sesha
Advisor
Advisor
0 Kudos

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.

0 Kudos

Hi Venkat,

Thanks for your reply.

But SUB_QUAN_TIMEST field is timestamp field.

0 Kudos

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.

0 Kudos

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

former_member193464
Contributor
0 Kudos

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.