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

Former Member
0 Likes
984

Hi ,

i need to select only one row from table eipa where the date(bedat) is the latest.

is anyone know how can i do this?

thanks,

dana.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
943
SELECT SINGLE * FROM eipa 
              INTO TABLE i_eipa.
if sy-subrc = 0.
 SORT i_eipa descending by bedat.
 READ i_eipa INTO wa_eipa INDEX 1.
ENDIF.

Hope this solves ur query.

SELECT SINGLE * FROM eipa 
              INTO wa_eipa 
              ORDER BY bedat.

Reward if this helsp.

10 REPLIES 10
Read only

Former Member
0 Likes
943

In the select query add the addition BYPASSING BUFFER which guarantees that the data you read is the most up to date

Read only

Former Member
0 Likes
944
SELECT SINGLE * FROM eipa 
              INTO TABLE i_eipa.
if sy-subrc = 0.
 SORT i_eipa descending by bedat.
 READ i_eipa INTO wa_eipa INDEX 1.
ENDIF.

Hope this solves ur query.

SELECT SINGLE * FROM eipa 
              INTO wa_eipa 
              ORDER BY bedat.

Reward if this helsp.

Read only

Former Member
0 Likes
943

Hi ,

u can try as follows.

select max( bedat ) from eipa into v_bedat where (your condtions).

select * from eipa where bedat = v_bedat.

Regards,

Sumit

Read only

Former Member
0 Likes
943

Hello,

Check this:

Try using the below

Select * from eipa 
up to 1 rows
where ....
order by object bedat descending.

Vasanth

Read only

Former Member
0 Likes
943

Hi,

You can sort the internal table and then read the first row.

select * from eipa into table itab.

sort itab descending by bedat.

read table itab into wa_itab index 1.

regards,

Beejal

**reward if this helps

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
943

Hi

You can use select single or select upto 1 rows for your requirement.

Regards,

kumar

Read only

anversha_s
Active Contributor
0 Likes
943

hi,

chk this.

1. select all the records to an internal table.

2. sort by date.

3. read the internal table, the latest bedat will be in top.

Regards

Anver

Read only

Former Member
0 Likes
943

Dana,

CLEAR EIPA.

SELECT MAX( bedat ) FROM EIPA INTO eipa-bedat

WHERE ........your conditions.

if not eipa-bedat is initial.

select * from eipa where bedat = eipa-bedat.

endif.

pls. reward if useful

Read only

Former Member
0 Likes
943

hi dana,

try this:

TABLES: EIPA.

*

SELECT * FROM EIPA order by bedat descending.

write: eipa-infnr.

exit.

ENDSELECT.

regards, dieter

Read only

Former Member
0 Likes
943

thank you very much,for all your replies.

you helped me solve the problem,

thank you very much.