`
skewen
  • 浏览: 74451 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

关于sy-subrc,我们不知道的

 
阅读更多

 had this information so thought of sharing with you all.

Values of SY-SUBRC on different ABAP statements

'sy-subrc' is a return code, set by the following ABAP statements.
As a rule, if SY-SUBRC = 0, the statement was executed successfully.

  1. ASSIGN sets SY-SUBRC to 0 if the field symbol assignment was possible, otherwise to 4.
  2. AUTHORITY-CHECK sets SY-SUBRC to 0 if the user has the required authorization, otherwise to 4, 8, 12, 16, 24, 28, 32, or 36 depending on the cause of the authorization failure.
  3. CALL DIALOG with USING sets SY-SUBRC to 0 if the processing is successful, otherwise to a value other than 0.
  4. CALL FUNCTION sets SY-SUBRC in accordance with the defined exception handling.
  5. CALL METHOD sets SY-SUBRC in accordance with the defined exception handling.
  6. CALL SELECTION-SCREEN sets SY-SUBRC to 0 if the user chooses Enter or Execute, and 4 if the user chooses Cancel.
  7. CALL TRANSACTION with USING sets SY-SUBRC to 0 if the processing is successful, otherwise to a value other than 0.
  8. CATCH SYSTEM-EXCEPTIONS sets SY-SUBRC after the ENDCATCH statement if a system exception occurs. The value is set in the program.
  9. COMMIT WORK sets SY-SUBRC to 0. COMMIT WORK AND WAIT sets SY-SUBRC to 0 if the update is successful, otherwise to a value other than 0.
  10. COMMUNICATION INIT DESTINATION ... RETURNCODE sets SY-SUBRC as specified.
  11. CONCATENATE sets SY-SUBRC to 0 if the result fits into the target variable, otherwise to 4.
  12. CREATE OBJECT sets SY-SUBRC if the exceptions of the instance constructor are handled in the program.
  13. CREATE OBJECT in OLE2 sets SY-SUBRC to 0 if an external object could be created, otherwise to 1, 2, or 3, depending on the cause.
  14. DELETE sets SY-SUBRC to 0 if the operation is successful, otherwise to 4 or another value other than 0, depending on the cause.
  15. DEMAND ... MESSAGES INTO sets SY-SUBRC to 0 if the message table is empty, otherwise to a value other than 0.
  16. DESCRIBE LIST sets SY-SUBRC to 0 if the line or list exists, otherwise to 4 or 8.
  17. EXEC SQL - ENDEXEC sets SY-SUBRC to 0 in nearly all cases. It does, however, set SYSUBRC to 4 if no entry is read in a FETCH statement.
  18. FETCH sets SY-SUBRC to 0 if at least one line was read, otherwise to 4.
  19. GENERATE SUBROUTINE POOL sets SY-SUBRC to 0 if the generation was successful, otherwise to 8.
  20. GET CURSOR sets SY-SUBRC to 0 if the cursor is correctly positioned, otherwise to 4.
  21. GET PARAMETER sets SY-SUBRC to 0 if a corresponding value exists in SAP memory, otherwise to 4.
  22. IMPORT sets SY-SUBRC to 0 if the import is successful, otherwise to 4.
  23. INSERT sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  24. LOAD REPORT sets SY-SUBRC to 0 if the operation is successful, otherwise to 4 or 8 depending on the cause of the error.
  25. LOOP sets SY-SUBRC to 0 if there is at least one pass through the extract. Otherwise, it is set to a value other than 0.
  26. LOOP AT sets SY-SUBRC to 0 if there is at least one loop pass through the internal table, otherwise to 4.
  27. MODIFY sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  28. MODIFY LINE sets SY-SUBRC to 0 if a line in the list was changed, otherwise it sets it to a value other than 0.
  29. MODIFY sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  30. OLE2 Automation, executed successfully, otherwise 1, 2, 3, or 4, depending on the cause of the error.
  31. OPEN DATASET sets SY-SUBRC to 0 if the file could be opened, otherwise to 8.
  32. Open SQL statements set SY-SUBRC to 0 if the operation is successful, otherwise to a value other than 0.
  33. OVERLAY sets SY-SUBRC to 0 if at least one character is overlaid, otherwise to 4.
  34. READ DATASET sets SY-SUBRC to 0 if the read operation was successful, otherwise to 4 or 8, depending on the cause of the error.
  35. READ LINE sets SY-SUBRC to 0 if a list line exists, otherwise to a value other than 0.
  36. READ TABLE sets SY-SUBRC to 0 if table lines are found, otherwise to 2, 4, or 8, depending on the context and cause of the error.
  37. REPLACE sets SY-SUBRC to 0 if the search string was replaced, otherwise to a value other than 0.
  38. SCROLL sets SY-SUBRC to 0 if the scrolling within the list was successful, otherwise to 4 or 8, depending on the cause.
  39. SEARCH sets SY-SUBRC to 0 if the search string was found, otherwise to 4.
  40. SELECT sets SY-SUBRC to 0 if at least one line was read, otherwise to 4, or possibly 8 in SELECT SINGLE FOR UPDATE.
  41. SET COUNTRY sets SY-SUBRC if the country code exists in table T005X, otherwise to 4.
  42. SET BIT sets SY-SUBRC to 0 if the bit could be set, otherwise to a value other than 0.
  43. SET TITLEBAR sets SY-SUBRC to 0 if the title exists, otherwise to 4.
  44. SHIFT ... UP TO sets SY-SUBRC to 0 if the position could be found within the string, otherwise to 4.
  45. SPLIT sets SY-SUBRC to 0 if the sizes of the target fields are adequate, otherwise to 4.
  46. UPDATE sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
  47. WRITE ... TO sets SY-SUBRC to 0 if the assignment is successful, otherwise to 4.
分享到:
评论

相关推荐

    ABAP 函数&接口 RFC实例

    SY-SUBRC = 0: 至少有一行数据,当ENDSELECT语句执行完,SY-DBCNT中保存着记录的个数。 SY-SUBRC = 4: 没有数据。 SY-SUBRC = 8: 只有使用“SELECT SINGLE FOR UPDATE”时才会有,  表示: WHERE条件指定的记录不止...

    SY字段含义

    通过以上对SAP ABAP中SY字段含义的详细介绍,我们可以看到这些系统变量在开发过程中扮演着非常重要的角色。它们不仅提供了关于当前执行环境的关键信息,还帮助开发者更好地控制和管理程序的执行流程。正确理解和运用...

    Sap ides 4.7 access key

    进入修改程序“LSKEYF00”的界面:进入 SE38,输入程序名 "LSKEYF00",点击修改按钮,用上述方法在任何遇到断点处修改 SY-SUBRC = 0。确定在 CASE 语句是 SY-SUBRC 值为 0),过断点后按 F8,继续运行程序。 Step 6...

    Abap基础学习文档13_使用文件.doc

    WRITE: / 'SY-SUBRC:', SY-SUBRC, / 'System Message:', MESS. ENDIF. ``` 如果SAP系统运行在UNIX环境下且“hugo.xyz”文件不存在,则上述示例将输出错误代码和系统消息。 #### 打开文件以读取 要打开文件以供...

    sap批量删除、添加、修改透明表数据

    IF sy-subrc = 0. MESSAGE i101 WITH 'Delete success.'. ENDIF. ENDIF. ``` 在这个例子中,通过检查`p_del`参数是否为`X`来判断是否执行删除操作。如果是,则会调用`DELETE FROM`语句来清空指定表的所有记录。...

    破解ACCESSKEY

    进入SE38,输入程序名"LSKEYF00",点击修改按钮(不是显示按钮),用上述方法在任何遇到断点处修改SY-SUBRC = 0。 第七步:修改程序"LSKEYF00"。在步骤6后,你就可以修改程序"LSKEYF00"了,找到“CALL 'GET_...

    SAP ABAP基本语法.docx

    * SY-SUBRC:系统执行传回值,0 表示成功 * SY-UNAME:用户 * SY-DATUM:系统日期 * SY-UZEIT:系统时间 * SY-TCODE:当前执行程序的 Transaction code * SY-INDEX:当前 LOOP 循环过的次数 * SY-TABIX:当前处理的...

    abap处理字符串[参考].pdf

    如果中找不到,则将SY-SUBRC设置为4并且不移动,否则将SY-SUBRC设置为0。内容同上。 3、根据第一个或最后一个字符移动字段串 语法:SHIFT <c> LEFT DELETING LEADING 。 SHIFT <c> RIGHT DELETING TRAILING ...

    abap处理字符串[借鉴].pdf

    - **移动字段串到给定串**:使用`SHIFT <c> UP TO <str> <mode>`可以查找特定子串并移动字符串到边缘,`SY-SUBRC`用于记录操作状态。 - **根据第一个或最后一个字符移动**:`LEFT DELETING LEADING`和`RIGHT ...

    abap小结.docx

    - `SY-SUBRC`:执行语句后的返回值,0表示成功,其他值表示不同类型的错误。 - `SY-DATUM`:记录当前服务器的日期。 - `SY-UZEIT`:获取当前服务器时间。 - `SY-ULINE`:生成255个字符长度的水平线。 - `SY-...

    SAP开发权限破解.pdf

    4. **插入可执行代码**:为了永久性地绕过权限检查,可以在断点处插入代码,比如`sy-subrc = 0`,使得每次执行到此处时,权限检查都会自动通过。完成修改后,保存并激活程序。 请注意,这些步骤展示了如何在SAP环境...

    sap-ABAP权限检查创建教程学习.rar

    4. **处理结果**:根据`sy-subrc`变量的值处理权限检查结果。`sy-subrc=0`表示权限检查通过,否则失败。 5. **角色分配**:在PFCG(Profile Generation)事务码中,为用户角色分配相应的权限对象和字段值,以授予或...

    ABAP function使用笔记

    IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. WRITE: date1, ' - ', date2, ' = ', years. " 输出结果为:20070207 - 当前日期 =...

    ABAP4语法祥解(简体中文).doc

    - SY-SUBRC:表示指令执行成功与否,'0'代表成功。 - SY-UNAME:当前用户的用户名。 - SY-DATUM:当前系统日期。 - SY-UZEIT:当前系统时间。 - SY-TCODE:当前执行的事务代码。 - SY-INDEX:循环计数。 - SY-TABIX...

    abap基本语法

    - SY-SUBRC:系统返回码,0表示成功。 - SY-UNAME:当前登录用户的用户名。 - SY-DATUM:系统日期。 - SY-UZEIT:系统时间。 - SY-TCODE:当前执行的事务代码。 - SY-INDEX:循环计数。 - SY-TABIX:内部表当前行号...

    ABAP_4语法集锦(中文版)

    - SY-SUBRC:执行操作后的返回码,'0'表示成功。 - SY-UNAME:当前用户登录的用户名。 - SY-DATUM:当前系统日期。 - SY-UZEIT:当前系统时间。 - SY-TCODE:当前执行的事务代码。 - SY-INDEX:循环中的当前迭代次数...

    abap_99乘法表

    WRITE: / 'X', SY-SUBRC UNDER 'SY-SUBRC', " 在STRING3中查找X SY-FDPOS UNDER 'SY-FDPOS'. ``` 通过以上分析,我们可以看到文章不仅详细地介绍了如何使用ABAP编写99乘法表,还介绍了ABAP中的一些实用功能,...

    SAP ABAP开发系统字段

    6. **sy-subrc**:返回最近执行的函数模块或语句的子程序返回代码。0表示成功,非零值表示错误,这在错误处理和调试中非常有用。 7. **sy-datum**和**sy-uzeit**:分别提供当前日期和时间,这些信息可用于记录日志...

    ABAP常用函数

    6. SY-SUBRC:执行状态为 0,表示成功 7. SY-UNAME:用户名 8. SY-UZEIT:当前时间 9. SY-TCODE:当前的事务代码 10. SY-LSIND:列表索引页 11. SY-LISTI:上一个列表的索引 12. SY-LILLI:绝对列表中选定行的行号 ...

    SAP_ABAP4语法详解

    * SY-SUBRC:系统执行某指令后,表示执行成功与否的变量,0 表示成功 * SY-UNAME:当前用户登录的用户名 * SY-DATUM:当前系统日期 * SY-UZEIT:当前系统时间 * SY-TCODE:当前执行程序的 Transaction code * SY-...

Global site tag (gtag.js) - Google Analytics