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

general

Former Member
0 Likes
1,172

what is the use of SY-DBCNT system variable .

8 REPLIES 8
Read only

Former Member
0 Likes
1,103

hi

sy-dbcnt - number of records processed in database table

also chk this link

Read only

Former Member
0 Likes
1,103

PLEASE STOP MULTI-POSTING !

ASK YOUR QUESTIONS IN ONE THREAD !!!

Thanks,

Stéphane.

Post Scriptum : Use "F1" key ....

Read only

Former Member
0 Likes
1,103

Hi Pinky,

This system variable gives the count for number of records retrived from the database after a select query

Regards,

Kasi S

Read only

Former Member
0 Likes
1,103

Hi d_pinky,

SY-DBCNT - DB operations, number of table lines processed

Read only

Former Member
Read only

suresh_datti
Active Contributor
0 Likes
1,103

It is a system variable that holds the value of the number of records that were processed in the database. This variable is generally used in a program to get the no records read /updated via SELECT , INSERT & other db statements.

ex:

select count(*) from pa0001 where

endda = '99991231'/.

if sy-dbcnt eq 0.

write: / 0, 'employees selected'(t01).

else:

write: / sy-dbcnt, 'employees selected'(t01).

endif.

~Suresh

Read only

Former Member
0 Likes
1,103

AWARD POINTS and CLOSE THREADS....

http://help.sap.com/saphelp_46c/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm

ABAP System Fields

The ABAP system fields are active in all ABAP programs. They are filled by the runtime environment, and you can query their values in a program to find out particular states of the system. Although they are variables, you should not assign your own values to them, since this may overwrite information that is important for the normal running of the program. However, there are some isolated cases in which you may need to overwrite a system variable. For example, by assigning a new value to the field SY-LSIND, you can control navigation within details lists.

The names and data types of the system fields are contained in the ABAP Dictionary structure SYST. To address them in an ABAP program, use the form SY-. If you have deleted sessions, the system fills free numbers before increasing the count further. Sessions started using CALL TRANSACTION … STARTING NEW TASK begin again at 0.

SY-UNAME

Username of the current user, such as KELLERH, BC400-01…

Information About Current Date and Time

The following system fields are always set automatically. The GET TIME statement synchronizes the time on the application server with the time on the database server and writes it to the field SY-UZEIT. SY-DATUM and the system fields for the local timezone (SY-TIMLO, SY-DATLO, and SY-ZONLO) are also reset.

SY-DATLO

User’s local date, for example 19981129, 19990628, …

SY-DATUM

Current application server date, for example 19981130, 19990627, …

SY-DAYST

X during summertime, otherwise space.

SY-FDAYW

Factory calendar day of the week: Monday = 1 … Friday = 5.

SY-TIMLO

User’s local time, for example 154353, 225312, …

SY-TZONE

Time difference in seconds between local time and Greenwich Mean Time (UTC), for example, 360, 10800.

SY-UZEIT

Current application server time. for example 164353, 215312, …

SY-ZONLO

User’s time zone, for example, EST, UTC, …

Information About the Current ABAP Program

SY-CALLD

X if the program was started using CALL TRANSACTION, CALL DIALOG, or SUBMIT … . Space if the program was started using LEAVE TO TRANSACTION or using a transaction code from a screen. SY-CALLD is always space when a batch input session is being processed.

SY-CPROG

The name of the calling program in an external routine, otherwise the name of the current program.

SY-DBNAM

The name of the logical database linked to an executable program.

SY-DYNGR

Screen group to which the current screen belongs. You can assign several screens to one screen group, for example, to allow you to modify them all identically.

SY-DYNNR

Number of the current screen. During selection screen processing, SY-DYNNR contains the screen number of the current selection screen. During list processing, it contains the number of the container screen. During subscreen processing, SY-DYNNR contains the number of the subscreen. This also applies to tabstrip controls.

SY-LDBPG

In executable programs, the database program of the associated logical database.

SY-REPID

Name of the current ABAP program. For externally-called procedures, it is the name of the main program of the procedure. If you pass SY-REPID as an actual parameter to an external procedure, the formal parameter does not contain the name of the caller, but that of the main program of the procedure. To avoid this, assign SY-REPID to an auxiliary variable and use that in the call, or use the system field SY-CPROG.

SY-TCODE

The current transaction code.

Background Processing

SY-BATCH

X if the ABAP program is running in the background, otherwise space

Batch Input

SY-BINPT

X while a batch input session is running and when an ABAP program is called using CALL TRANSACTION USING, otherwise space.

OPTIONS FROM in the CALL TRANSACTION USING statement can set SY-BINPT to space either for the entire duration of the program, or at the end of the BDC data.

SY-BINPT is always space during a CATT procedure.

ABAP Programming

Constants

SY-ABCDE

Contains the alphabet. You can use this field with offset to retrieve a letter of the alphabet regardless of codepage.

SY-ULINE

Contains a horizontal line with length 255 that you can use when creating lists.

SY-VLINE

Contains a vertical line (|) that you can use when creating lists.

Loops

SY-INDEX

In a DO or WHILE loop, SY-INDEX contains the number of loop passes including the current pass.

Strings

SY-FDPOS

Location of hit in string operations.

When you use CO,CN, CA, NA, CS, NS, CP, and NP, offset values are assigned to SY-FDPOS depending on the search result.

SEARCH … FOR … sets SY-FDPOS to the offset of the search string.

Internal Tables

SY-TABIX

Current line of an internal table. SY-TABIX is set by the statements below, but only for index tables. The field is either not set or is set to 0 for hashed tables.

APPEND sets SY-TABIX to the index of the last line of the table, that is, it contains the overall number of entries in the table.

COLLECT sets SY-TABIX to the index of the existing or inserted line in the table. If the table has the type HASHED TABLE, SY-TABIX is set to 0.

LOOP AT sets SY-TABIX to the index of the current line at the beginning of each loop lass. At the end of the loop, SY-TABIX is reset to the value that it had before entering the loop. It is set to 0 if the table has the type HASHED TABLE.

READ TABLE sets SY-TABIX to the index of the table line read. If you use a binary search, and the system does not find a line, SY-TABIX contains the total number of lines, or one more than the total number of lines. SY-INDEX is undefined if a linear search fails to return an entry.

SEARCH 0. The field is automatically increased by one in each interactive list event. You may change the value of SY-LSIND yourself in the program to enable you to navigate between lists. Changes to SY-LSIND do not take effect until the end of a list event. It is therefore a good idea to place the relevant statement at the end of the corresponding processing block.

SY-LSTAT

Program-controlled name for list levels. You can assign values to SY-LSTAT during list creation. The value of SY-LSTAT when the list is finished is saved with the list. In an interactive list event, SY-LSTAT is set to the value assigned to it during creation of the list in which the event occurred. SY-LSTAT is no longer maintained, and you should not use it in your programs.

SY-STACO

Number of the first displayed column of the list from which the event was triggered. The counter begins at 1.

SY-STARO

Number of the topmost displayed line of the topmost displayed page of the list from which the event was triggered. The counter begins at 1, not including the page header.

Printing Lists

When you print lists, the spool and runtime systems require certain internal information that is set in the following system fields when you start printing.

SY-CALLR

Contains a value indicating where printing was started, for example, NEW-PAGE for program-controlled printing, or RSDBRUNT for printing from a selection screen.

SY-PRDSN

Contains the name of the spool file during printing.

SY-SPONO

Contains the spool number during printing.

SY-MAROW, SY-MACOL

The SET MARGIN statement fills the system fields SY-MAROW and SY-MACOL. These determine the number of lines in the top margin and the number of columns in the left-hand margin respectively.

Print Parameters

The print parameters are passed to the spool system by the runtime environment, using a structure with the ABAP Dictionary type PRI_PARAMS. Before this structure existed, system fields were used instead. When you start printing, some of the fields from PRI_PARAMS are still written into system fields with the same names. However, you should not use these system fields yourself.

Messages

When the MESSAGE statement occurs, the following system fields are set. When the MESSAGE … RAISING statement occurs in a function module or method, these fields are also set in the calling program if it is to handle the exception.

SY-MSGID

SY-MSGID contains the message class

SY-MSGNO

SY-MSGNO contains the message number

SY-MSGTY

SY-MSGTY contains the message type

SY-MSGV1,…,SY-MSGV4

SY-MSGV1 to SY-MSGV4 contain the fields used to replace the placeholders in the message.

Special Actions that Fill Message Fields

When you use an ENQUEUE function module to set a lock, and the FOREIGN_LOCK exception occurs, the field SY-MSGV1 contains the name of the owner of the lock.

When you use CALL TRANSACTION or CALL DIALOG with the USING addition, a message that occurs during the screen chain is returned in the fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 ... SY-MSGV4.

In Remote Function Call (RFC), error messages are retrieved from the remote system and placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO,SY-MSGV1, SY-MSGV2, SY-MSGV3, SY-MSGV4. The fields are also set when a short dump or a message with type X occurs.

Internal System Fields

Internal system fields are exclusively for internal use in the ABAP runtime environment and the system kernel. They must not be overwritten in any circumstances, and should also not be read in ABAP programs.

SY-CFWAE

Undocumented

SY-CHWAE

Undocumented

SY-DEBUG

Undocumented

SY-DSNAM

File name for spool output

SY-ENTRY

Undocumented

SY-FFILE

Flat file (USING/GENERATING DATASET).

SY-FLENG

Length of a field

SY-FODEC

Number of decimal places in a field

SY-FOLEN

Output length of a field

SY-FTYPE

Data type of a field

SY-GROUP

Bundling

SY-INPUT

Undocumented

SY-LPASS

Undocumented

SY-NEWPA

Undocumented

SY-NRPAG

Undocumented

SY-ONCOM

Undocumented

SY-PAUTH

Undocumented

SY-PLAYO

Undocumented

SY-PLAYP

Undocumented

SY-PNWPA

Undocumented

SY-PRI40

Undocumented

SY-PRINI

Undocumented

SY-PRLOG

Undocumented

SY-REPI2

Undocumented

SY-RSTRT

Undocumented

SY-SFOFF

Undocumented

SY-SUBCS

Call status of an executable program

SY-SUBTY

Call type of an executable program

SY-TABID

Undocumented

SY-TLOPC

Undocumented

SY-TSTIS

Undocumented

SY-XCODE

Extended function code, filled by user actions on a list (like SY-UCOMM). Before the length of SY-UCOMM was extended from 4 to 70 characters, SY-XCODE was used internally to accommodate long entries in the command field. You should always use SY-UCOMM in application programs.

SY-XFORM

SYSTEM-EXIT subroutine.

SY-XPROG

SYSTEM-EXIT program.

Obsolete System Fields

Some of the system fields in the R/3 System were originally adopted from R/2, but are no longer filled with values. They are obsolete, and must not (indeed cannot) be used.

SY-APPLI

R/2 - ID for the SAP applications installed. Not filled in R/3.

SY-BATZD

R/2 - flag for daily background scheduling. Not filled in R/3.

SY-BATZM

R/2 - flag for monthly background scheduling. Not filled in R/3.

SY-BATZO

R/2 - flag for one-time background scheduling. Not filled in R/3.

SY-BATZS

R/2 - flag for immediate background scheduling. Not filled in R/3.

SY-BATZW

R/2 - flag for weekly background scheduling. Not filled in R/3.

SY-BREP4

R/2 - root name of the report requesting background processing. Not filled in R/3.

SY-BSPLD

R/2 - flag for spool output from background processing. Not filled in R/3.

SY-CCURS

R/2 - exchange rate and result field for CURRENCY CONVERSION. Not filled in R/3.

SY-CCURT

R/2 - table exchange rate for CURRENCY CONVERSION. Not filled in R/3.

SY-CDATE

R/2 - exchange rate date for CURRENCY CONVERSION. Not filled in R/3.

SY-CTABL

R/2 - exchange rate table for CURRENCY CONVERSION. Not filled in R/3.

SY-CTYPE

R/2 - exchange rate type for CURRENCY CONVERSION. Not filled in R/3.

SY-DCSYS

Dialog system of the R/2 System. Not filled in R/3.

SY-FMKEY

Formerly the current function code menu. Not filled in R/3.

SY-LOCDB

Local database. Not implemented.

SY-LOCOP

Local database operation. Not implemented.

SY-MACDB

Formerly the file name for matchcode access. Not filled in R/3.

SY-MARKY

Current line letter for the MARK statement. The MARK statement will not be supported for much longer.

SY-TMAXL

Formerly the maximum number of entries in an internal table. Not filled in R/3.

SY-TFDSN

Formerly the name of an external storage file for extracts. Not filled in R/3.

SY-PAGCT

R/2 - the maximum number of pages per list. Not filled in R/3.

SY-PREFX

ABAP prefix for background jobs. Not filled in R/3.

SY-SFNAM

Undocumented

SY-SPONR

In R/2, you could process spool files with the TRANSFER statement, which also set SY-SPONR. Not filled in R/3.

SY-TNAME

Formerly the name of an internal table following access. Not filled in R/3.

SY-TTABC

Formerly the index of the last line of an internal table to be read. Not filled in R/3.

SY-TTABI

Formerly the offset of internal tables in the roll area. Not filled in R/3.

SY-TPAGI

Formerly flagged whether an internal table had been moved to the paging area. Not filled in R/3.

SY-WAERS

Formerly the company code currency after reading a posting segment. Not filled in R/3.

SY-WILLI

R/2 - the number of the list line selected from a detail list. Use SY-LILLI instead.

SY-WINCO

R/2 - cursor position on a detail list. Use SY-CUCOL instead.

SY-WINDI

R/2 - index of the list for a detail list. Use SY-LSIND instead.

SY-WINRO

R/2 - cursor position for a detail list. Use SY-CUROW instead.

SY-WINSL

R/2 - contents of the selected line for detail list in a window. Use SY-LISEL instead.

SY-WINX1

R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.

SY-WINX2

R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.

SY-WINY1

R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.

SY-WINY2

R/2 - window coordinates for a detail list in a window. No corresponding field in R/3.

Read only

Former Member
0 Likes
1,103

Hi Pinky,

Sy-DBCNT will give the number of database records processed.'

Reward points if it is helpful.

Regards,

Sangeetha.A