‎2007 Dec 19 8:22 AM
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.
‎2007 Dec 19 8:48 AM
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...
‎2007 Dec 19 8:31 AM
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)
‎2007 Dec 19 8:32 AM
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,
‎2007 Dec 19 8:34 AM
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
‎2007 Dec 19 8:40 AM
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.
‎2007 Dec 19 8:37 AM
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.
‎2007 Dec 19 8:40 AM
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
‎2007 Dec 19 8:41 AM
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
‎2007 Dec 19 8:44 AM
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.
‎2007 Dec 19 8:48 AM
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...
‎2007 Dec 19 8:54 AM
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
‎2007 Dec 19 9:21 AM
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