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

DIFFERENCE

Former Member
0 Likes
1,036

Hi all,

can anyone tell me the exact difference between sy-dbcnt and sy-tfill. if u could explain me with two typical scenarios it will be of good use.

Useful points will be rewarded.

Thanks,

Karthi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
995

Hi,

Please see the sample code.

Sy-tfill will keep on varying when we put in loop like loop ..endloop,select..endselect,do..enddo..ect.

but sy-dbcnt will not keep on varying if we put in loop also.

sy-tfill just gives information what is the present no of recs fetched from database with the above stmt.

DATA:itab1 LIKE vbak OCCURS 0 WITH HEADER LINE.

DATA:itab2 LIKE mara OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

SELECT * FROM vbak INTO TABLE itab1 UP TO 10 ROWS.

WRITE:/ 'Material info', 20 'DBCNT value', 32 'TFILL value'.

LOOP AT itab1.

WRITE:/ itab1-vbeln,sy-dbcnt,sy-tfill.

ENDLOOP.

WRITE:/ 'Material info', 40 'SY-DBCNT value', 65 'TFILL value'.

SELECT * FROM mara INTO itab2 UP TO 10 ROWS .

WRITE:/ itab2-matnr,sy-dbcnt,sy-tfill.

ENDSELECT.

Regds

Sivaparvathi

Please reward points if helpful...

11 REPLIES 11
Read only

Former Member
0 Likes
995

sy-dbcnt

it will have the no.of records fetched/processed/affected while using the Open SQL statements with DDIC objects....(select, insert, delete.. in dbtab)

sy-tfill

it will have the no.of records fetched/processed/affected while using internal table commands (read, insert,delete .....table itab)

Read only

Former Member
0 Likes
995

Hi,

sy-tfill for number of filled lines of the table

This statement determines some properties of the internal table itab and assigns them to the specified variables. The various additions enable you to determine the table type, the number of currently filled rows and the initial memory requirement.

In addition, the system fields sy-tfill and sy-tleng are filled with the current number of table rows and the length of a table row in bytes.

For detailed information about an internal table, you should use the methods of RTTS instead of the statement DESCRIBE TABLE.

Without the specification of an addition, the statement DESCRIBE TABLE only sets the system fields sy-tfill and sy-tleng.

The current number of table rows of the internal table itab is determined and is assigned to the data object lin.The data type i is expected for the data object.

As of release 6.10, the current number of rows of an internal table can also be determined using the in-built function lines.

sy-dbcnt number of records retrived

regards,

Read only

Former Member
0 Likes
995

data: itab type table of spfli WITH HEADER LINE .

data: wa type spfli.

*the following code will fill the sy-dbcnt

select * from spfli into table itab.

write:/ sy-dbcnt, sy-tfill.

*the following code will fill the sy-tfill

READ TABLE itab WITH TABLE KEY carrid = 'AY'.

write:/ sy-dbcnt, sy-tfill.

output will be....

sy-dbcnt = 22

sy-tfill = 0

then, after read statement

sy-dbcnt = 22

sy-tfill = 7

Read only

0 Likes
995

hi,

do u mean that after the read statement in 7th row the specific record wil be read i.e. carrid = 'ay' is read only after seven lines. so the variable sy-tfill = 7.

regards,

karthi.

Read only

Former Member
0 Likes
995

Hi,

SY_TFILL

With the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL is filled with the row number of the addressed internal table.

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

Plzz reward points if it helps.

Read only

Kanagaraja_L
Active Contributor
0 Likes
995

Hi Karthi,

SY-DBCNT

SQL statements set SY-DBCNT to the number of table entries processed. In an Open SQL SELECT loop, SY-DBCNT is not set until after the ENDSELECT statement. In Native SQL, SY-DBCNT is not set until after the ENDEXEC statement.

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

FETCH sets SY-DBCNT to the number of lines read by the corresponding 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.

You should take particular care when programming the WHERE clause to ensure that you do not delete the wrong lines. For example, if you specify an empty internal table in a dynamic WHERE clause, all of the lines in the table are deleted.

If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4. SY-DBCNT contains the number of lines deleted.

SY-TFILL

After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.

Kanagaraja L

Read only

Kanagaraja_L
Active Contributor
0 Likes
995

Hi Karthi,

SY-DBCNT

SQL statements set SY-DBCNT to the number of table entries processed. In an Open SQL SELECT loop, SY-DBCNT is not set until after the ENDSELECT statement. In Native SQL, SY-DBCNT is not set until after the ENDEXEC statement.

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

FETCH sets SY-DBCNT to the number of lines read by the corresponding 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.

You should take particular care when programming the WHERE clause to ensure that you do not delete the wrong lines. For example, if you specify an empty internal table in a dynamic WHERE clause, all of the lines in the table are deleted.

If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4. SY-DBCNT contains the number of lines deleted.

SY-TFILL

After the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL contains the number of lines in the relevant internal table.

Kanagaraja L

Read only

Former Member
0 Likes
995

Hi Subramanian,

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.

SY-TFILL

With the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL is filled with the row number of the addressed internal table.

Plzz Reward if useful,

Mahi.

Read only

Former Member
0 Likes
997

Hi,

Please see the sample code.

Sy-tfill will keep on varying when we put in loop like loop ..endloop,select..endselect,do..enddo..ect.

but sy-dbcnt will not keep on varying if we put in loop also.

sy-tfill just gives information what is the present no of recs fetched from database with the above stmt.

DATA:itab1 LIKE vbak OCCURS 0 WITH HEADER LINE.

DATA:itab2 LIKE mara OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

SELECT * FROM vbak INTO TABLE itab1 UP TO 10 ROWS.

WRITE:/ 'Material info', 20 'DBCNT value', 32 'TFILL value'.

LOOP AT itab1.

WRITE:/ itab1-vbeln,sy-dbcnt,sy-tfill.

ENDLOOP.

WRITE:/ 'Material info', 40 'SY-DBCNT value', 65 'TFILL value'.

SELECT * FROM mara INTO itab2 UP TO 10 ROWS .

WRITE:/ itab2-matnr,sy-dbcnt,sy-tfill.

ENDSELECT.

Regds

Sivaparvathi

Please reward points if helpful...

Read only

abdul_hakim
Active Contributor
0 Likes
995

sy-dbcnt - no.of records read from database table..for eg.u can use this after SELECT statement to determine the no.of records read.

sy-tfill - no of lines filled in an internal table.

Cheers,

Hakim

Read only

Former Member
0 Likes
995

SY-TFILL

With the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, SY-TFILL is filled with the row number of the addressed internal table.

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