Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9076

Re: We have 100 records in table how to fetch 10 th record?

$
0
0

Hi Reddy,

 

As I can infer, you are talking about reading the 10th record form a database table.

The concept is quite simple , follow the steps :

 

  • Read the data into an internal table, you can either use SELECT UPTO 10 ROWS.


  • Once you get record in you internal table, you can read directly the tenth record using

       read table statement, note that read table statement has a performance benifit than Select-endselect statement.

 

Try Out this :

 

Data : w_demo type zdemotable.

 

select  *   from zdemotable

                  up to 10 rows

                 into w_demo.

endselect.

 

Now you have 10th record in your workarea.

 

OR

Altenatively you can try out this for better performance :

 

Data : t_demo type table of zdemotable,

          w_demo type zdemotable.

 

select * from zdemotable

            into table t_demo.

if sy-subrc EQ 0.

             read table t_demo into w_demo index 10.

********You will have the tenth record form the internal table into you work area******

endif.



Please reward point if helpful.


Viewing all articles
Browse latest Browse all 9076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>