2008 Feb 20 9:54 AM
Dear ,
i written one select single stmt i.e
tables : ser03 .
SELECT SINGLE * FROM ser03
WHERE obknr = objk-obknr
AND bwart = '101'
AND shkzg = 'S'.
based on this select stmt their are 5 records in database table satisfying the select stmt where clause and this select stmt is picking the fourth record . why this record is picking forth record only even this 4th record is not most recently created record and nor old record this record is middle one if any one plz tell me . points must be given . to access most recently recreated record how to write select stmt. plz tell me .
2008 Feb 20 10:01 AM
I donßt know the table SER03, but you are talking ybout "most recent". This indicates the existence of a column containg some sort of time information. So you have to
SELECT ... ORDER BY [time column] DESCENDING
I donßt know the table SER03, but you are talking ybout "most recent". This indicates the existence of a column containg some sort of time information. So you have to
SELECT ... ORDER BY [time column] DESCENDING
2008 Feb 20 10:01 AM
I donßt know the table SER03, but you are talking ybout "most recent". This indicates the existence of a column containg some sort of time information. So you have to
SELECT ... ORDER BY [time column] DESCENDING
2008 Feb 20 10:03 AM
Hi,
OBKNR is the only key field for table SER03, so I can't understand how your where clause can match 5 entries.
Anyway, if you select first into an internal table, then sort this table by your date field you can read the most recent entry.
Regards,
Nick
2008 Feb 20 10:39 AM
Dear ,
sorry this is select stmt
SELECT SINGLE * FROM objk
WHERE sernr = i_zequip-sernr
AND matnr = i_zequip-matnr.
2008 Feb 20 10:43 AM
Hi,
The you need to do as either Mike or I suggested, sort your set of values by the required date field then take the first (or last) record.
Regards,
Nick
2008 Feb 20 10:23 AM
Hi,
hope this code will help you.
just added the mandt in the where condition.
SELECT SINGLE * FROM ser03
WHERE mandt = sy-mandt
AND obknr = objk-obknr
AND bwart = '101'
AND shkzg = 'S'.
reward if helpful,
teja.
2008 Feb 20 11:11 AM
hi,
sort ser03 by obknr.
SELECT SINGLE * FROM ser03
WHERE obknr = objk-obknr
AND bwart = '101'
AND shkzg = 'S'.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |