2008 Jul 16 12:40 PM
Hi,
How to select a particular record, say record number 45 from a database table?
Thanks,
Sachin.
2008 Jul 16 1:12 PM
Hi Sachin Bhatnagar ,
Try this logic, it will work,,,
select * from dbtable into itab ,,,
Loop at itab.
AT ENDOF Storage Bin.
Storage Bin. = Storage Bin + 1.
Endat.
End loop.
Hope it is helps.
Regards,
T.Durai murugan.
hi,
Did you mean fetching a record on the particular line in the table.
try this
w_index = sy-tabix.
select * from <table> into <structure>
where index EQ w_index.
Hope this will Help.
Regards
Sumit Agarwal
2008 Jul 16 12:47 PM
2008 Jul 16 12:47 PM
Suppose you r selecting a particular record like material no : 100 from MARA table
write query like below
select matnr from mara into tablr itab
where matnr = '100'.
if you want total record of this materia no then write like below
select * from mara into table itab
where matnr = '100'.
Hope it will helpful.
2008 Jul 16 12:47 PM
If you know the index, then it's easy...
If not, I would like to ask why you want to retrieve a specific record number. If this is a recurring need, you should consider defining such a field (counter, record number) as part of the key, or as a secondary index.
If not, I can only say I don't really see the need...
2008 Jul 16 12:55 PM
Hi Trond,
I actually want to insert some records after the last record in the table, and for the reocrds to be inserted, I need a value from the last record.
All the records have a field Storage Bin. Now, suppose its value is 125.
I have to insert the reocrds in increasing order, like next bin should be 126, then 127 and so on. All these values are not provided in any file, rather than the program is generating them depending on whatever the number of last bin in database was.
Thanks,
Sachin.
2008 Jul 16 12:49 PM
Hi Sachin,
Try the following:
Select *
from <dbtable>
into <itab>
where rec_no = 45.
dbtable = database table
itab = internal table
Hope this helps you.
Regards,
Chandra Sekhar
2008 Jul 16 12:54 PM
hi,
Did you mean fetching a record on the particular line in the table.
try this
w_index = sy-tabix.
select * from <table> into <structure>
where index EQ w_index.
Hope this will Help.
Regards
Sumit Agarwal
2008 Jul 16 1:12 PM
Hi Sachin Bhatnagar ,
Try this logic, it will work,,,
select * from dbtable into itab ,,,
Loop at itab.
AT ENDOF Storage Bin.
Storage Bin. = Storage Bin + 1.
Endat.
End loop.
Hope it is helps.
Regards,
T.Durai murugan.
2008 Jul 18 5:05 AM
2008 Jul 16 1:14 PM
Have u checked my logic,give me ur requirement i will provide you the suitable code or logic
but I given you the answer is appropriated try it once.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |