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

indexes

Former Member
0 Likes
561

hi!

diffrence between sy-index, sy-tabix, sy-dbcnt.

regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
539

Hi!

SY-INDEX is actualized within a DO ... ENDDO cycle.

SY-TABIX is actualized within LOOP ... ENDLOOP, and it points to the actual record in the internal table.

SY-DBCNT contains the number, how many records have you selected into an internal table, after a SELECT command. If it is 0, the no records were found.

Regards

Tamás

Message was edited by:

Tamás Nyisztor

4 REPLIES 4
Read only

Former Member
0 Likes
540

Hi!

SY-INDEX is actualized within a DO ... ENDDO cycle.

SY-TABIX is actualized within LOOP ... ENDLOOP, and it points to the actual record in the internal table.

SY-DBCNT contains the number, how many records have you selected into an internal table, after a SELECT command. If it is 0, the no records were found.

Regards

Tamás

Message was edited by:

Tamás Nyisztor

Read only

Former Member
0 Likes
539

Hi..

<b>SY-IND</b>EX :: it is the SYSTEM FIELD THAT gives the of current loop pass in DO or while loops.

<b>SY-TABIX</b>:: It is the loop counter in

LOOP AT..ITAB

ENDLOOP.

APPEND sets SY-TABIX to the index of the last table row, that is the total number of entries in the target table.

COLLECT sets SY-TABIX to the index of the existing or appended table row. With hashed tables, SY-TABIX is set to 0.

LOOP AT sets SY-TABIX to the index of the current table row at the beginning of every loop pass. After leaving a loop, SY-TABIX is set to the value it had before entering the loop. With hashed tables, SY-TABIX is set to 0.

READ TABLE sets SY-TABIX to the index of the table row read. If no row is found with binary search while reading, SY-TABIX contains the index of the next-highest row or the total number of rows +1. If no row is found with linear search while reading, SY-TABIX is undefined.

SEARCH <itab> FOR sets SY-TABIX to the index of the table row, in which the search string was found.

<b>SY-DBCNT</b>:: no. of records processed in database table after a query.

SY-DBCNT

SQL statements set the content of SY-DBCNT to the number of database lines processed. With SELECT loops in Open SQL, SY-DBCNT is set after the ENDSELECT statement. In Native SQL, SY-DBCNT is set after the ENDEXEC statement.

DELETE sets SY-DBCNT to the number of lines deleted.

FETCH sets SY-DBCNT to the number of lines already read by the current cursor.

INSERT sets SY-DBCNT to the number of lines inserted.

MODIFY sets SY-DBCNT to the number of lines processed.

UPDATE sets SY-DBCNT to the number of lines changed.

Return Value

Message was edited by:

Rammohan Nagam

Message was edited by:

Rammohan Nagam

Read only

Former Member
0 Likes
539

Hi,

sy-index: Loops, Current Loop Pass

sy-tabix: Internal Table, Current Row Index

sy-dbcnt: DB operations, number of table lines processed

Award if helps

Read only

Former Member
0 Likes
539

SY-INDEX --- When using loops like DO... ENDO .. WHILE , other than internal tables

DO 5 times.

write : / sy-index.

ENDDO.

SY-TABIX.. When processing internal tables

loop at itab.

write : / sy-tabix.

endloop.

SY-DBCNT..

number of records in database table.

SELECT * from ZTABLE...

here SY-DBCNT will store the number of records