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

query for recent date

Former Member
0 Likes
894

hi

i want to know how to write a select stament to pick only those records which belongs to recent date.

in mara one guy has inserted records wrongly i have to list all those recods which

belongs to recent date from the date field of the table mara.

regards

sami

6 REPLIES 6
Read only

Former Member
0 Likes
773

hi,

without using any date, u cant take any record, u have to ask ur functional consultant, wat is the recent date?

regards

karthik

Read only

Former Member
0 Likes
773

Hi sami,

Good!

If you know the date from which you want to retrieve then

SELECT * FROM MARA

INTO TABLE itab

Where ERSDA >= g_date ( from which date u want to filter)

Regards,

Sunil

Read only

0 Likes
773

i have to list the recent date records.

in the date fields so many dates will be there but i have to retrieve

only those freshly or recently entered recods in compare to todays date

Read only

Former Member
0 Likes
773

Hi,

try this.

data: l_date type sy-datum.

l_date = sy-datum.

select * from vbak into lt_vbak where erdat LE sy-datum.

sort lt_vbak by erdat descending.

reward point if useful

Regards,

Niyaz

Read only

Former Member
0 Likes
773

Hi Sami,

You can get the records corresponding to the particular date by using the Query:-

select * from Mara into table itab

where ERSDA like <particular date>

Reward if useful.

Regards,

Shilpi

Read only

Former Member
0 Likes
773

hi,

use code for

Select * from Mara into it_mara.

endselect.

sort it_mara by ersda descending.

The very first record after sorting is your recent date.

take help from this code :

data : it_mara type STANDARD TABLE OF mara.

data : wa_mara type mara.

select * from mara into CORRESPONDING FIELDS OF TABLE it_mara.

sort it_mara by ersda DESCENDING.

loop at it_mara into wa_mara.

WRITE wa_mara-ersda.

WRITE wa_mara-matnr.

WRITE wa_mara-ernam.

WRITE / .

endloop.

Reward points, if helpful,

Sandeep Kaushik