3.2预定义sy-数据对象
1.ABAP System Fields
示例:
"预定义data object FORM f_pre_data_objects. "System Fields "Structure:SYST, "使用sy-xxxx,syst-xxxx, *sy-abcde c 26 A-Z,26个字母 WRITE:/ sy-abcde. *sy-batch c 1 是否后台执行'X' WRITE:/ sy-batch. *sy-binpt c 1 在批处理程序,CALL TRANSACTION USING调用程序中为“X” WRITE:/ sy-binpt. *sy-calld c 1 "CALL TRANSACTION, CALL DIALOG, or SUBMIT ... AND RETURN 设置为“X” "LEAVE TO TRANSACTION or Tcode enter in a screen 设置为空 "SUBMIT 返回调用程序值 *sy-callr c 8 "print list标明print开始点 *sy-colno i "Current position during the creation of a list in the list buffer.1开始; *sy-cpage i "Page number of the top page in the list display where a list event was triggered.1开始; *sy-cprog c 40 "external procedure name or current program; *sy-cucol i "Horizontal cursor position on the screen of a dynpro. Counting begins at column 2. *sy-curow i "Vertical cursor position on the screen of a dynpro. Counting begins at line 1. *sy-datar c 1 ""X" for PAI, if at least one input field of a screen was changed by a user or some other data being passed. *sy-datlo d "User date, for example "19990723"; can be set by GET TIME. *sy-datum d "System date. Can be set by GET TIME. *sy-dayst c 1 ""X" in summer time in the system time zone; otherwise initial. *sy-dbcnt i "SQL statements set the content of sy-dbcnt to the number of table rows processed. *sy-dbnam c 20 "For executable programs, the associated logical database. *sy-dbsys c 10 "Central database system, for example "ORACLE" or "INFORMIX". *sy-dyngr c 4 "Screen group of the current dynpro. *sy-dynnr c 4 "Number of the current dynpro. *sy-fdayw b "Factory calendar weekday in the system time zone; Monday = 1, ..., Friday = 5. *sy-fdpos i "Occurrence when using certain searches in character-like and byte-like data objects. *sy-host c 32 "Network name of the computer on which the current application server is instantiated, "for example "KSAP0001" or "HS01234". *sy-index i "Loop index. "In DO and WHILE loops, contains the number of previous loop passes, including the current pass. *sy-langu c 1 "Single-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-ldbpg c 40 "In executable programs, the database program of the associated logical database. *sy-lilli i "List row on which a list event was triggered. "Counting begins at 1 and includes the page header. *sy-linct i "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-linno i "Current list row when the list is created. "Counting begins at 1 and includes the page header. *sy-linsz i "Row width of the current list in the list buffer when the list is created. *sy-lisel c 255 "Content 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-listi i "List level of the list in which a list event was triggered. *sy-loopc i "Number of currently displayed rows in a table control. *sy-lsind i "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-macol i "Number of columns on the left margin when printing lists. *sy-mandt c 3 "Client ID used by the current user to log on, for example "401" or "800". *sy-marow i "Number of rows on the top margin when printing lists. *sy-modno i "Indexing of the external sessions. "Contains the value 0 in the first session. *sy-msgid c 20 "After the statement MESSAGE, contains the message class. *sy-msgno n 3 "After the statement MESSAGE, contains the message number. *sy-msgty c 1 "After the statement MESSAGE, contains the message type. *sy-msgv1 ... sy-msgv4 c 50 "After the statement MESSAGE, contain the field content used for the placeholders of the message. *sy-opsys c 10 "Operating system of the current application server, for example "SOLARIS" or "HP-UX". *sy-pagno i "Current page when the list is created. *sy-pfkey c 20 "GUI status of the current dynpro. *sy-prdsn c 6 "Contains the name of the spool file when printing. *sy-repid c 40 "Name of the current ABAP program In procedures called externally, "the name of the framework program of the procedure. *sy-saprl c 4 "AS ABAP release, for example "46D" or "610". *sy-scols i "Number of columns in the current screen layout. *sy-slset c 14 "Variant used to fill a selection screen. "The associated program name can be seen in sy-cprog. *sy-spono n 10 "Contains the name of the spool number when printing lists. *sy-srows i "Number of rows in the current screen layout. *sy-staco i "Number of the first displayed column of the list in which a list event was triggered. "Counting begins at 1. *sy-staro i "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-stepl i "Index of the current row in a table control. "This is set for every loop pass. *sy-subrc i "Return code set by many ABAP statements. 执行代码是否成功 *sy-sysid c 8 "Name of AS ABAP, for example "S01" or "K99". *sy-tabix i "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-tcode c 20 "Name of the current transaction code. "Initial in background processing, unless a transaction was called during background processing. *sy-tfill i "In the statements DESCRIBE TABLE, LOOP AT, and READ TABLE, "sy-tfill is given the number of rows of the accessed internal table. *sy-timlo t "User time, for example "152557". Can be set by GET TIME. *sy-title c 70 "Text that appears in the title bar of the dynpro. *sy-tleng i "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-tvar9 c 20 "Values 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-tzone i "Time difference of the system time to the UTC reference time in seconds, for example "3600" or "10800". *sy-ucomm c 70 "Function code that triggered the event PAI. *sy-uline c 255 "Contains a horizontal line of the length 255 for displays in lists. *sy-uname c 12 "Logon name of the user, for example "KELLERH". "See also User-Specific Program Flow. *sy-uzeit t "System time; can be set by GET TIME. *sy-vline c 1 "Contains a vertical line (|) for displays in lists. *sy-wtitl c 1 "Set to "N" in the statements REPORT, PROGRAM, and FUNCTION-POOL, "if the addition NO STANDARD PAGE HEADING is used; otherwise initial. *sy-zonlo c 6 "User time zone, for example "CET" or "PST".
"Constant space "space type c length 1 DATA:lv_str TYPE string. CONCATENATE space space INTO lv_str SEPARATED BY space. ENDFORM.