1、SY-SCOLS: 屏幕总列数;SY-MANDT: 當前系統編號(CLIENT NUMBER)SY-VLINE: 画竖线SY-ULINE: 画横线SY-PAGNO: 当前页号SY-LINSZ: 当前报表宽度SY-LINCT: 当前报表长度SPACE: 空字符串SY-LSIND: 列表索引页SY-LISTI: 上一个列表的索引SY-LILLI: 绝对列表中选定行的行号SY-CUROW: 屏幕上的行SY-CUCOL: 光标列SY-CPAGE: 列表的当前显示页SY-STARO:真实行号SY-LISEL: 选择行的内容,长度为255SY-LINNO: 当前行系统内部有一个专门存放系统变量的结构SYS
2、T,其中最常用的系统变量有:SY-REPID: ABAP 程式名,目前的主程式SY-CPROG: ABAP 程式名SY-SYSID: R/3 系統,R/3 系統名稱SY-UCOMM: 畫面,PAI 驅動的功能代碼,一般用來參照定義變量 当前LOOP循环过的次数 READ TABLE it_po INDEX 1 此時變量值1下面說下sy-index 和 sy-tabix的區別sy-index和sy-tabix都是系统字段,用来记录循环的次数。sy-index 在DO.ENDDO循环里有效,而sy-tabix在loop at .endloop里有效。運行下面的例子能更好的理解:DATA: BEGI
3、N OF line,col1 TYPE i,col2 TYPE i,END OF line.DATA itab LIKE TABLE OF line WITH HEADER LINE.DO 30 TIMES.line-col1 = sy-index.line-col2 = sy-index * sy-index.APPEND line TO itab.ENDDO.LOOP AT itab .DO 2 TIMES.WRITE: / sy-tabix:,sy-tabix,itab-col1, sy-index:,sy-index,itab-col2.ENDLOOP.sy-dbcnt:Sy-dbcn
4、t代表有多少条记录被处理了例如:當我們查詢記錄放入內表,判斷內表中是否有數據就可以用if sy-dbcnt = 0 MESSAGE s000.STOP. ENDIF.sy-tfill:返回当前内表(Internal Table)内的记录数。但是要小心,那些字段随各自的内表(Internal Table)改变。例:如果你循环(Loop at)(读取)itab,sy-tfill返回itab的记录数。如 果你在循环(Loop at)(读取)内表(Internal Table)itab的内部嵌套循环(Loop at)(读取)内表(Internal Table)jtab,sy-tfill返回的不再是it
5、ab的记录数,而是jtab的!所以如果你需要使用itab的记录数,请先把sy-tfill的 值传递给其它变量。无论如何,sy-tfill永远保存当前的记录数。例如記錄內表記錄條數:DESCRIBE TABLE itab LINES sy-tfill. 当前系统编号(CLIENT NUMBER)sy-pagno sy-lsind 列表索引页sy-listi 上一个列表的索引sy-linsz 当前报表宽度sy-lilli 绝对列表中选定的行号sy-linct sy-curow 屏幕上的行space 空字符sy-cucol sy-cpage 列表的当前显示页sy-staro 真实行号sy-lisel
6、 sy-linno 当前行SY-SLSET:SY-SUBRC 的含义= FUNCTION MODULE (或RFC中) SY-SUBRC 的含义 = 使用SELECT语句选择查询: SY-SUBRC = 0: 至少有一行数据,当ENDSELECT语句执行完,SY-DBCNT中保存着记录的个数。SY-SUBRC = 4: 没有数据。SY-SUBRC = 8: 只有使用“SELECT SINGLE FOR UPDATE”时才会有, 表示: WHERE条件指定的记录不止一行,结果是没有记录被选中。使用INSERT语句,向表中插入一行,必须注意INSERT的顺序与表中字段的顺序一致: 插入成功,SY-
7、DBCNT包含了插入的行数,0或1。 由于有相同的KEY存在,所以插入失败。使用LOOP语句来遍历一个内表: 循环至少被执行一次。 循环没有被执行,可能是没有数据,也可能是没有符合条件的记录。使用DELETE语句来删除一条记录: 找到一行并删除之,如果该表有不唯一主键,也就是有多条重复的记录,则只删除第一条记录。 没有找到符合条件的记录,也没有删除。使用UPDATE语句来更新一条记录: 找到记录并更新,(如果有多条记录呢?) 没有找到符合条件的记录,也没有更新。ABAP程序系统字段中英文详解注_华亭慧剑译系统字段由ABAP运行时环境填写,并且可以用来在ABAP程序中查询系统状态。除了一个例外(
8、sy-repid),系统字段都是变量,但是它们都是只读的。此外,更多程序执行的重要信息通常都被丢弃。ABAP程序中的系统字段只在极少需要控制系统行为的时候才能被重写。System fields are filled by the ABAP runtime environment and can be used in an ABAP program to query system statuses. With one exception (sy-repid), system fields are variables, but they should only be accessed on a r
9、ead-only basis. Otherwise, important information for further program execution often gets lost. System fields in ABAP programs can only be overwritten in a few cases to control system behavior.对于例外的sy-repid,这个系统字段的数据类型在ABAP字典的SYST结构(6.10版以后)中定义,作为sy结构(也可以用SYST来定位)的组件在ABAP程序中有示例。sy结构在一个内部会话期间内只存在一次,并
10、且在这个内部会话期间内被所有程序使用。下表列出了在ABAP程序中可以使用的系统字段。所有sy结构的其他组件则或者在ABAP运行时环境内部使用或者已经废弃。With the exception of sy-repid, the data types of the system fields are defined in the ABAP Dictionary in the structure SYST (as of release 6.10), and are instantiated in ABAP programs as components of the predefined struct
11、ure sy, which can also be addressed using SYST. The structure sy exists only once in an internal session and is used by all programs of an internal session at the same time. The following table shows the system fields that can be used in ABAP programs. All other components of the structure sy are ei
12、ther intended for internal use by the ABAP runtime environment or are obsolete.名称Name类型Type说明Contentsy-abcdec(26)包含了字母表。可以用来通过指定偏移/长度直接访问独立的字母,而无需考虑代码页。Contains the alphabet. Can be used to access individual letters directly by specifying the offset/length, regardless of the code page.sy-batchc(1)在一
13、个后台运行的ABAP程序中设置为“X”,否则就是初始值。Set to X in an ABAP program that runs in the background, otherwise initial.sy-binpt在批处理输入会话中设置为“X”,在ABAP程序中调用using CALL TRANSACTION USING。否则就是初始值。 during processing of batch input sessions, and in ABAP programs called using CALL TRANSACTION USING. Otherwise initial.sy-cal
14、ld在一个调用序列中的第一个程序里为空字符串,否则为值“X”。在调用using CALL TRANSACTION,CALL DIALOG或者SUBMIT . AND RETURN后变为“X”。如果程序以LEAVE TO TRANSACTION或者从一个屏幕事务开始的话,则为空。使用SUBMIT(没有AND RETURN)时设定为调用它的程序的值。Contains a blank character in the first program in a call sequence , otherwise contains the value . Is set to after calls usin
15、g CALL TRANSACTION , CALL DIALOG, or SUBMIT . AND RETURN. Empty if the program was started using LEAVE TO TRANSACTION or a transaction from the screen. A call using SUBMIT (without AND RETURN) assumes the value of the calling program.sy-callrc(8)当打印清单时,显示打印从何处开始的值,例如NEW-PAGE为程序控制的打印,或者RSDBRUNT为从一个选择
16、屏幕打印。When printing lists, contains a value that displays where the printing was started, for example, NEW-PAGE for program-controlled printing, or RSDBRUNT for printing from the selection screen.sy-colnoi在清单缓冲区中创建清单过程中的当前位置。从1开始计算。在非Unicode系统中,这个位置也符合显示清单中的列。在Unicode系统中,由于清单缓冲区中的一个字符可能占多列,这只保证每个输出的最
17、低和最高的输出能力。Current position during 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 applicable to each output, as o
18、ne character may take up more columns in the list than positions in the list buffer.sy-cpage当清单事件被触发时,显示在清单顶端的页码。从1开始。Page number of the page displayed at the top of the list for which a list event was triggered. Counting begins at 1.sy-cprogc(40)在外部程序调用中,调用程序的名字,否则就是当前程序的名字。如果一个程序包含多级程序调用,sy-cprog包
19、含框架程序的名字,而不是设置为程序调用序列中的框架程序名字。In procedures called externally, the name of the calling program, Otherwise the name of the current program. If a procedure called externally calls another external procedure, sy-cprog contains the name of the framework program, and is not set to the name of the framewo
20、rk program of the subsequent calling program.sy-cucol在屏幕上显示的横向指针的位置。从第2列开始。Horizontal cursor position in the display on a screen. Counting begins at column 2.sy-curow在屏幕上显示的纵向指针的位置。从第1行开始。Vertical cursor position on the screen display of a screen. Counting begins at line 1.sy-datar在PAI中,如果屏幕上至少有一个输入
21、字段的值被用户或其他数据传输所更改,则为“X”,否则为初始值。At PAI, contains if at least one input field of a screen has been changed by a user or by further data transfer, otherwise initial.sy-datlod用户的当前日期,例如:,。可以用GET TIME来设置。Local date of the user, for example , . Can be set using GET TIME.sy-datumSAP系统的本地日期。Local date of th
22、e SAP system. Can be set using GET TIME.sy-dayst在夏令时中设置为“X”,否则为初始值。 during summertime, otherwise initial.sy-dbcntSQL语句把sy-dbcnt的内容设置为处理过的表行数。SQL statements set the content of sy-dbcnt to the number of processed table lines.sy-dbnamc(20)在执行程序中,表示连接的逻辑数据库。In executable programs, the linked logical dat
23、abase.sy-dbsysc(10)使用的数据库系统,例如ORACEL, INFORMIX。Central database system, for example, ORACLE, INFORMIX.sy-dyngrc(4)当前屏幕的屏幕组。在屏幕画笔中,几个屏幕可以指定给一个公共屏幕组,例如,可以用来一次修改同一个屏幕组中的全部屏幕。Screen group of the current screen. In the Screen Painter, several screens can be assigned to a common screen group, which can be
24、 used, for example, for making modifications to all screens in the group at once.sy-dynnr当前的屏幕号。在选择屏幕处理过程中,这指定了当前被选中的屏幕。在列表处理过程中,说明了子屏幕容器的数量。在子屏幕屏幕过程中(包括选项卡),说明了屏幕数量。Number of the current screen. During selection screen processing, this is the current selection screen. During list processing, the nu
25、mber of the subscreen container. During processing of a subscreen screen (including in tabstrips), this screen number.sy-fdaywb工厂日历的周日,Monday为1,Friday为5。Factory calendar weekday, Monday = 1, ., Friday = 5.sy-fdpos在字符类型数据对象操作时查找定位。Found location in operations with character-type data objects.sy-host应
26、用服务器的名字,例如,KSAP0001,HS01234。Name of the application server, for example, KSAP0001, HS01234.sy-index循环索引。在DO和WHILE循环中,指包含了本次循环的循环次数。Loop index. In DO and WHILE loops, contains the number of the loop passes including the current pass.sy-langu单字符的语言键,例如,D,E,F,给当前的文本环境使用。通过依照当前用户的登录语言,或使用SET LOCALE语句设定。
27、Single-character language key, for example, D, E, F, for the current text environment. Set according to the logon language of the user or by using the statement SET LOCALE.sy-ldbpg在可执行程序中,指定了连接的逻辑数据库的数据库程序。In executable programs, the database program of the linked logical database.sy-lilli当清单事件被触发时的
28、清单行数,从1开始计算并包含页抬头。List line for which a list event was triggered. Counting begins at 1 and includes the page header.sy-linct在当前清单创建时的页长。sy-linct在一个任意长度的标准清单中的值为0,而在定义了页长的清单中不为0。Page length of the current list during list creation. sy-linct is 0 for a standard list of any length, and has a value that is not 0 for lists with a defined page length.
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1