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 statement for today's date

Former Member
0 Likes
5,797

Hi,

I need to write a select query which fetches all the entries of a table for today's date , how do i do it pls..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,556

Hi,

Write

Select * from <table> into table itab where <date_field> eq SY-DATUM.

Sy-datum is current system date.

Regards,

Sujit

Hi,

I need to write a select query which fetches all the entries of a table for today's date , how do i do it pls..

10 REPLIES 10
Read only

former_member190578
Participant
0 Likes
3,556
Select * from DDIC-Table into...... "whatever" (field, internal table, structur)

where FIELD = sy-datum.....


.... endselect. (if necessary and/or it makes sense)

I prefer "into internal table.... " for more than one record.

regards Jurgen

Edited by: Jürgen Hartwig on Jul 19, 2008 2:53 AM

Read only

Former Member
0 Likes
3,556

example..

you can use in where condition...

select * vbak
 into table it_vbak
 where audat = sy-datum

Read only

former_member125931
Active Participant
0 Likes
3,556

HI,

Take any date field from your TABLE,then in where condition DATE(fieldname) = SY-DATUM.

example :

select MANR WERKS MMSTD from MARC

where MMSTD = sy-datum.

Read only

Former Member
0 Likes
3,556

Hi,

Plz find the Date field of your particular table and in the select query check it with sy-datum.

select * from <table>

into <i_tab>

where <date-field> EQ sy-datum.

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
3,557

Hi,

Write

Select * from <table> into table itab where <date_field> eq SY-DATUM.

Sy-datum is current system date.

Regards,

Sujit

Read only

Former Member
0 Likes
3,556

hi sandeep,

In your select query in the WHERE CLAUSE use sy-datum

Eg,

select * 
   from <table name>
   into <work area>
where < date field > = sy-datum.

Best of luck,

Bhumika

Read only

Former Member
0 Likes
3,556

Hi

Types : Begin of ty_mara ,

matnr type mara-matnr,

mbrsh type mara-matnr,

Meins type mara-meins,

End of ty_mara.

Data : It_mara type standard table of ty_mara ,

wa_mara type ty_mara.

Select matnr

mbrsh

meins

from mara

into table it_mara

where ersda eq sy-datum.

It will give the output what u expected.

Read only

Former Member
0 Likes
3,556

Hi Sandeep,

Try this code :

SELECT <field-names to retrieve>
   FROM <database table name>
    INTO  TABLE <internal table name>
WHERE <date field name> eq sy-datum.

This will fetch all the records with today's date.

Regards,

Swapna.

Read only

Former Member
0 Likes
3,556

hi check this..

tables:pa0002 .

data: begin of itab occurs 0,

pernr like pa0002-pernr,

begda like pa0002-begda,

endda like pa0002-endda.

end of itab .

select pernr

begda

endda

from pa0002

into table itab

where begda = sy-datum.

loop at itab.

write:/ itab-pernr,itab-begda,itab-endda.

endloop.

Read only

Former Member
0 Likes
3,556

Hi,

SELECT <field-names to retrieve>

FROM <database table name>

INTO TABLE <internal table name>

WHERE <date field name> eq sy-datum.

or

SELECT * FROM <database table name>

INTO TABLE <internal table name>

WHERE <date field name> eq sy-datum.

this statement will fetch all the data's from your database table with respect to your date field. use parameter or select option to get the field value...then finally use

loop at <itab>

write: / <itab-field>.

endloop.