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

read table

Former Member
0 Likes
791

please explain about read table and sy-tabix clearly

9 REPLIES 9
Read only

Former Member
0 Likes
768

read table you can also use it to avoid looping inside a looop....

use of read table is as..

loop at i_tab.

read table i_tab2 with key xyz =i_tab-xyz.

-


endloop.

what it does it it reads the internal table i_tab2 till the where ocndition is true...

Also more performance tuned than nested loop.

Regards,

Jayant.

Read only

Former Member
0 Likes
768

Hi,

for sy-tabix refer the link

http://help.sap.com/saphelp_47x200/helpdata/en/7b/fb96c8882811d295a90000e8353423/frameset.htm

Read table is used to read the contents of itab inside a loop. the read table is used with binary search option and the itab1 should be sorted befeore using read table

for more info:

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm

Reading records with keys

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm

Reading lines with Index

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3730358411d1829f0000e829fbfe/content.htm

Reward points if useful..

Regards

Nilesh

Read only

Former Member
0 Likes
768

Read table will get the first record that saitisfies the condition specified in the with key statement into the header.

if an itab contains the following data:

field1 field2

1 one

2 two

3 three

4 four

5 five

And if you read the itab like this:

read table itab into WA with key field1 = '3'.

if sy-subrc = 0.

write:/ wa.

endif.

The output will be

3 three.

The sy-tabix will hold the value of index of the current record.

Regards,

Ravi

Read only

Former Member
0 Likes
768

Hi,

Read is used to get the single record into work area from internal table body which matches ur requirement.It is very efficient if we use sy-tabix and binary serach with Read.

read table itab index sy-tabix binary search with key.....

regards,

ram.

Read only

Former Member
0 Likes
768

Hi,

check this link

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm

sy-tabix will gives the number of records in the internal table at that point.

rgds,

bharat.

Read only

Former Member
0 Likes
768

Hi,

READ TABLE is an instruction reurning only one line of internal table.

After READ TABLE, if data is found, sy-tabix contain n° of line in the table.

Reward is helpfull,

Regards,

Stéphane.

Read only

Former Member
0 Likes
768

Read table is used to read one record from internal table at a time

READ TABLE ITAB INDEX 1.

the above READ will read the first record in internal table

SY-TABIX is the counter which will increment by 1 on every loop pass..this is used only when looping at internal tables

LOOP AT ITAB.

WRITE : / SY-TABIX.

ENDLOOP.

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
768

Hi

Read table itab with key

sy-tabix will gives the loop counter. In which loop we are in.

Regards,

Sreeram

Read only

Former Member
0 Likes
768

Hi,

Read table reads the table contents from the specified table with key or index as specified. See Help on read table for details.

If the Read Table succeeds, the sy-tabix returns the index of the record captured.

If you use...

Loop at tab1.

read table tab2.

endloop.

Then, after loop at statement & before read table statement sy-tabix returns the index of tab1. After read table statement, sy-tabix returns the index of tab2.

This is all I guess you are needing.

Reward if it helps.

Regards,

Hemant.