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

system variales

Former Member
0 Likes
740

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
Read only

Former Member
0 Likes
715

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

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 .

5 REPLIES 5
Read only

Former Member
0 Likes
716

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

Read only

Former Member
0 Likes
715

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.

Read only

gopi_narendra
Active Contributor
0 Likes
715
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

Read only

Former Member
0 Likes
715

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.

Read only

Former Member
0 Likes
715

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