Application Development and Automation 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: 
Read only

Select Query on time stamp.

Former Member
5,503

Hello Gurus,

Please help me in writing a select query with the where condition on time stamp for the field IBSP-VALFR and IBSP-VALTO, with the current system time stamp. I need pick all the values which falls in these two fields with the current time stamp.

Thanks & Regards,

Naresh.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,010

Have your user input a date field for date from and a date field for date to....

declare local variable of type syuzeit for start-clock (000000) and end-clock (235959), and two variables: low_timestamp and high_timestamp of a timestamp type...you can use IB_VALFR.

convert date <parameter date from> 
             time <start_clock>
   into time stamp <low_timestamp>
  time zone sy-zonlo.

convert date <parameter date to> 
             time <end_clock>
   into time stamp <high_timestamp>
  time zone sy-zonlo.
. . .

select....
where valfrom ge low_timestamp
     and valto     le high_timestamp....

3 REPLIES 3
Read only

Former Member
0 Likes
3,011

Have your user input a date field for date from and a date field for date to....

declare local variable of type syuzeit for start-clock (000000) and end-clock (235959), and two variables: low_timestamp and high_timestamp of a timestamp type...you can use IB_VALFR.

convert date <parameter date from> 
             time <start_clock>
   into time stamp <low_timestamp>
  time zone sy-zonlo.

convert date <parameter date to> 
             time <end_clock>
   into time stamp <high_timestamp>
  time zone sy-zonlo.
. . .

select....
where valfrom ge low_timestamp
     and valto     le high_timestamp....

Read only

0 Likes
3,010

Thank..you.

You solved my problem.

Regards,

Naresh.

Read only

0 Likes
3,010

Hi,

some how my code is not working...Please look at my code.

convert date sy-datum

time sy-uzeit

into time stamp low_validity

time zone sy-zonlo.

SELECT SP_INSTANCE INSTANCE EQUNO MATNO SERNO

FROM IBSP INTO TABLE IT_IBSP

for all entries in it_IBIN

where ( SP_INSTANCE = IT_IBIN-INSTANCE OR

INSTANCE = IT_IBIN-INSTANCE ) and

VALFR Le low_validity and

VALTO ge low_validity.

Its getting the values for which VALTO is less than current date.

Thanks & Regards,

Naresh.