Application Development 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: 

system variales

Former Member
0 Kudos

Hi ,

what is system variable to find the number of records in an internal table and what is the diff between sy-tabix and sy-index .

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi..,

Sy-tabix works only with in a LOOP statement.

Sy-tabix gives the currently processing record number of the internal table inside the loop. sy-index doesnot work inside the loop .. endloop.

Sy-tabix works only with the Internal table operations..

sy-tabix always give the current processing record number in a particular internal table.

Sy-index works in processing loops.

sy-index gives the current loop pass number of the corresponding loop.

regards,

sai ramesh

5 REPLIES 5

Former Member
0 Kudos

Hi..,

Sy-tabix works only with in a LOOP statement.

Sy-tabix gives the currently processing record number of the internal table inside the loop. sy-index doesnot work inside the loop .. endloop.

Sy-tabix works only with the Internal table operations..

sy-tabix always give the current processing record number in a particular internal table.

Sy-index works in processing loops.

sy-index gives the current loop pass number of the corresponding loop.

regards,

sai ramesh

Former Member
0 Kudos

Hi,

system variable to find the number of records in an internal table - sy-tabix or sy-dbcnt.

SY-TABIX means Table Index. This signifies the number of table index. Each row of a table has certain index or counter. The value of sy-tabix for the last entry would be equivalent to number of table entries.

SY-INDEX means the number of Iterations for a loop. bascially DO - ENDO .

SY-INDEX is not equal to SY-TABIX.

Check the belwo program

report tabix_index.

DO 100 times.

wa_tab-index = sy-index.

append wa_tab to itab.

clear wa_tab.

enddo.

loop at itab into wa_tab.

write:/1 sy-tabix.

endloop.

Regards,

Priyanka.

gopi_narendra
Active Contributor
0 Kudos
describe table itab lines N.

DESCRIBE is the statement which gives the number of records of an internal table

N returns the number of records of an internal table.

<b>Please close all your threads by assigning points to the useful answers</b>

Regards

Gopi

Former Member
0 Kudos

SYDBCNT will have the number of records in Itab and also u can use..

Describe table itab.

l_Var1 = sy-tfill..

This also will guive u the total records.

Sy-Tabix will have the index of the record which is coming in the itab.

Loop at itab.

SY-TABIX will have the index of the loop.

endloop.

Former Member
0 Kudos

Hi ,

The system variable which is used to find the no of records in internal table is sy-tfill..

describe itab .

if sy-subrc = 0.

n = sy-tfill.

endif.

Thanks & Regards

Bhaskar rao.M