您的位置:首页 > 其它

ABAP SY标签

2016-05-20 15:56 489 查看

ABAP System Fields

常用如下所示:

SY-SUBRC:语句执行后的返回值,0表示成功

SY-DATUM:当前服务器日期

SY-UZEIT:当前服务器时间

SY-ULINE:255长度的水平线

SY-VLINE:垂直线

SY-INDEX:循环说执行的次数

SY-TABIX:内表循环的次数

SY-DYNNR:当前Screen号

SY-MANDT:当前登录的Client号

SY-STEPL:返回当前操作的屏幕行号(Table Control)

SY-LOOPC:当前表格控件在屏幕中的总行数(Table Control)

SY-UCOMM:PAI所出发的功能代码

SY-DYNNR:当前屏幕号

SY-MSGID:Message Class

SY-MSGNR:Message Number

SY-MSGTY:Message Type

SY-MSGV1~4:Message Variant

SY-LINCT:REPROT语句中设定的LINE-COUNT

SY-LINSZ:REPROT语句中设定的LINE-SIZE

SY-SROWS:当前窗口的列表行数

SY-SCOLS:当前窗口的列表栏目数

SY-PAGNO:当前页的页码

SY-LINNO:当前选定行的行号

SY-COLNO:当前选定列的列号

SY-LSIND:当前列表索引,第一级列表为1

SY-LILLI:选择某行时光标行位置

SY-CUROW:选择某行时光标列位置

可在SE11中查询表“SYST”,如下图所示有详细介绍



图 表SYST

F1 Help中详细的介绍

ABAP System Fields

System fields are filled by the
ABAP runtime environment and can be used in an ABAP program to query system statuses. Except for one field (sy-repid), the system fields are variables, but nevertheless they should be used only for read access; otherwise, important
information for the execution of subsequent programs may be lost. System fields in ABAP programs can be overwritten in rare cases only, to control system behavior.

With the exception of sy-repid, the data types of the system fields are defined in the structure
SYST in ABAP Dictionary, and are instantiated in ABAP programs as components of the predefined structure
sy. The structure sy exists once in an internal session and is shared by all programs in this internal session.

The structure sy can also be addressed using
syst. There is also a predefined data type sy, which can be used instead of the data type SYST of ABAP Dictionary.

The table below shows the system fields which can be used in ABAP programs. All other components of structure
sy are either intended only for internal use by the ABAP runtime environment or are obsolete.

NameTypeLengthContent
sy-abcdec26Contains the Latin alphabet. Can be used to access individual letters directly by specifying the offset/length, regardless of the
code page.
sy-batchc1"X" in an ABAP program running in the background; otherwise initial.
sy-binptc1"X" when processing
batch input sessions and in ABAP programs called by CALL TRANSACTION USING; otherwise initial.
sy-calldc1A blank in the first program of a
call sequence; otherwise "X". Set to "X" after calls using
CALL TRANSACTION, CALL DIALOG, or SUBMIT ... AND RETURN. Empty if the program was started using
LEAVE TO TRANSACTION or by a transaction code entered on the
screen. A call using
SUBMIT (without AND RETURN) takes the value of the calling program.
sy-callrc8When printing lists, contains a value that indicates where printing was started, for example
NEW-PAGE for program-driven printing or RSDBRUNT for printing from the
selection screen.
sy-colnoi-Current position during the creation of a list in the list buffer. Counting begins at 1. In non-Unicode systems, this position also corresponds to the column in the displayed list. In Unicode
systems this is only guaranteed for the lower and upper output limits, since a single character may occupy more columns in the list than positions in the list buffer.
sy-cpagei-Page number of the top page in the list display where a list event was triggered. Counting begins at 1.
sy-cprogc40In externally called
procedures, the name of the calling program; otherwise the name of the current program. If an externally called procedure calls another external procedure,
sy-cprog contains the name of the
framework program, and is not set to the name of the framework program of the subsequent calling program.
sy-cucoli-Horizontal cursor position on the screen of a
dynpro. Counting begins at column 2.
sy-curowi-Vertical cursor position on the screen of a dynpro. Counting begins at line 1.
sy-datarc1"X" for PAI, if at least one input field of a screen was changed by a user or some other data being passed.
sy-datlod-User date, for example "19990723"; can be set by GET TIME.
sy-datumd-System date. Can be set by
GET TIME.
sy-daystc1"X" in summer time in the system time zone; otherwise initial.
sy-dbcnti-SQL statements set the content of sy-dbcnt to the number of table rows processed.
sy-dbnamc20For executable programs, the associated
logical database.
sy-dbsysc10Central database system, for example "ORACLE" or "INFORMIX".
sy-dyngrc4Screen group of the current dynpro. In
Screen Painter, multiple dynpros can be assigned to the same screen group, which can be used, for example, to make modifications to all screens in the group at once.
sy-dynnrc4Number of the current dynpro. In
selection screen processing, the current selection screen. In list processing, the number of the subscreen dynpro. When processing a
subscreen dynpro (including in
tabstrips), the number of this dynpro.
sy-fdaywb-Factory calendar weekday in the system time zone; Monday = 1, ..., Friday = 5.
sy-fdposi-Occurrence when using certain searches in character-like and byte-like data objects.
sy-hostc32Network name of the computer on which the current
application server is instantiated, for example "KSAP0001" or "HS01234".
sy-indexi-Loop index. In DO and WHILE loops, contains the number of previous loop passes, including the current pass.
sy-languc1Single-character language key, for example "E", "D", "F", for the current
text environment. Set by the logon language of the user or by the statement
SET LOCALE.
sy-ldbpgc40In executable programs, the
database program of the associated logical database.
sy-lillii-List row on which a list event was triggered. Counting begins at 1 and includes the
page header.
sy-lincti-Page length of the current list when the list is created.
sy-linct is 0 for a standard list of any length and has a value not equal to 0 for lists with fixed page lengths.
sy-linnoi-Current list row when the list is created. Counting begins at 1 and includes the page header.
sy-linszi-Row width of the current list in the list buffer when the list is created.
sy-liselc255Content of the list row in the list buffer where the cursor was in the displayed list when a list event was triggered (limited to the first 255 characters).
sy-listii-List level of the list in which a list event was triggered.
sy-loopci-Number of currently displayed rows in a
table control.
sy-lsindi-List level of the list that is currently being created (basic list: 0, details lists: greater than 0). For every interactive list event,
sy-lsind is automatically increased by an increment of 1.
sy-lsind can be changed in ABAP programs when navigating between details lists.
sy-macoli-Number of columns on the left margin when printing lists.
sy-mandtc3Client ID used by the current user to log on, for example "401" or "800".
sy-marowi-Number of rows on the top margin when printing lists.
sy-modnoi-Indexing of the external sessions. Contains the value 0 in the first session. In new sessions that are opened using the Create Session function or by calling a
transaction with /o in the command field of the
standard toolbar, this value is increased by 1.
sy-msgidc20After the statement MESSAGE, contains the message class.
sy-msgnon3After the statement MESSAGE, contains the message number.
sy-msgtyc1After the statement MESSAGE, contains the message type.
sy-msgv1 ... sy-msgv4c50After the statement MESSAGE, contain the field content used for the placeholders of the
message.
sy-opsysc10Operating system of the current
application server, for example "SOLARIS" or "HP-UX".
sy-pagnoi-Current page when the list is created.
sy-pfkeyc20GUI status of the current
dynpro.
sy-prdsnc6Contains the name of the spool file when printing.
sy-repidc40Name of the current ABAP program In procedures called externally, the name of the
framework program of the
procedure. If
sy-repid is passed to an external procedure as an actual parameter, then the formal parameter is set to the name of the caller.
sy-saprlc4AS ABAP release, for example "46D" or "610".
sy-scolsi-Number of columns in the current
screen layout.
sy-slsetc14Variant used to fill a
selection screen. The associated program name can be seen in
sy-cprog.
sy-sponon10Contains the name of the spool number when printing lists.
sy-srowsi-Number of rows in the current screen layout.
sy-stacoi-Number of the first displayed column of the list in which a list event was triggered. Counting begins at 1.
sy-staroi-Number of the top displayed list row of the top displayed page of the list where a list event was triggered. Counting begins at 1 and does not include the
page header.
sy-stepli-Index of the current row in a table control. This is set for every loop pass.
sy-subrci-Return code set by many ABAP statements. In general, the value 0 means that the statement was executed with no problems. Depending on which statement set
sy-subrc, the cause of an error can be derived from this value. The content of
sy-subrc is undefined after statements where
sy-subrc's setting is not documented explicitly.
sy-sysidc8Name of AS ABAP, for example "S01" or "K99".
sy-tabixi-Row number in the table index of an
internal table. Contains the last row accessed using a
primary or secondary table index. Is set to 0 when accessed using a
hash algorithm.
sy-tcodec20Name of the current transaction code. Initial in
background processing, unless a transaction was called during background processing.
sy-tfilli-In the statements DESCRIBE TABLE,
LOOP AT, and READ TABLE, sy-tfill is given the number of rows of the accessed internal table.
sy-timlot-User time, for example "152557". Can be set by GET TIME.
sy-titlec70Text that appears in the title bar of the dynpro.
sy-tlengi-In the statements DESCRIBE TABLE,
LOOP AT, and READ TABLE, sy-tleng is given the row size of the accessed internal table.
sy-tvar0 ... sy-tvar9c20Values can be assigned to these system fields in the program. In the event
TOP-OF-PAGE, the content of sy-tvar0 through
sy-tvar9 replaces the placeholders "&0" through "&9" in the list headers and column headers of the text elements of the program.
sy-tzonei-Time difference of the
system time to the
UTC reference time in seconds, for example "3600" or "10800".
sy-ucommc70Function code that triggered the event
PAI.
sy-ulinec255Contains a horizontal line of the length 255 for displays in lists.
sy-unamec12Logon name of the user, for example "KELLERH". See also
User-Specific Program Flow.
sy-uzeitt-System time; can be set by
GET TIME.
sy-vlinec1Contains a vertical line (|) for displays in lists.
sy-wtitlc1Set to "N" in the statements REPORT,
PROGRAM, and FUNCTION-POOL, if the addition
NO STANDARD PAGE HEADING is used; otherwise initial.
sy-zonloc6User time zone, for example "CET" or "PST".
The system field sy-repid is no longer a part of the structures
syst or sy. Instead, each program contains the predefined constants
sy-repid and syst-repid, which both contain the name of the relevant program. There are also two predefined types with the same names,
sy-repid and syst-repid, of type
c and length 40.

Programming Guidelines

Evaluate system fields in the right position

Do not use obsolete or internal system fields

Do not write to system fields

Do not use system fields as actual parameters

Do not use system fields in statements that set the fields

Do not use system fields on the user interface

Notes

The content of system fields is defined only as stated in the table above, or as described in individual ABAP statements. In any other contexts, the content of system fields is not reliable. In particular those statements whose effect on system fields is
undocumented can influence the content of certain system fields in undefined ways, for example
sy-subrc. This applies especially to statements that call ABAP code implicitly or explicitly when executed.

If possible, a system field should be evaluated directly after the statement that set it, to prevent it from being overwritten by other statements. If necessary, the values of system fields should be saved in auxiliary variables.

A system field should only be used as an operand in a
read position if its content is not set by the same statement. Otherwise, the system may behave unexpectedly.

System fields and the associated structure SYST have an entirely program-internal function. No
dynpro fields should be created with reference to system fields, since the associated
field helps are not intended for end users.

Internal system fields are intended entirely for internal use in the ABAP runtime environment and in the ABAP kernel. Never overwrite them from within an ABAP program and do not even process them in read-only mode.

The obsolete system fields were usually kept during the transition from R/2 to R/3, however they are no longer filled. These system fields can no longer be used.

An extended list of system fields is available in the
Application Help.

The static methods of the system class
CL_ABAP_SYST also provide important system states. The use of these methods can replace the evaluation of the associated system fields in cases where it is important that a system field has not been incorrectly overwritten in the program.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: