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.
- ASSIGN sets SY-SUBRC to 0 if the field symbol assignment was possible, otherwise to 4.
- 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.
- CALL DIALOG with USING sets SY-SUBRC to 0 if the processing is successful, otherwise to a value other than 0.
- CALL FUNCTION sets SY-SUBRC in accordance with the defined exception handling.
- CALL METHOD sets SY-SUBRC in accordance with the defined exception handling.
- CALL SELECTION-SCREEN sets SY-SUBRC to 0 if the user chooses Enter or Execute, and 4 if the user chooses Cancel.
- CALL TRANSACTION with USING sets SY-SUBRC to 0 if the processing is successful, otherwise to a value other than 0.
- CATCH SYSTEM-EXCEPTIONS sets SY-SUBRC after the ENDCATCH statement if a system exception occurs. The value is set in the program.
- 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.
- COMMUNICATION INIT DESTINATION ... RETURNCODE sets SY-SUBRC as specified.
- CONCATENATE sets SY-SUBRC to 0 if the result fits into the target variable, otherwise to 4.
- CREATE OBJECT sets SY-SUBRC if the exceptions of the instance constructor are handled in the program.
- 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.
- DELETE sets SY-SUBRC to 0 if the operation is successful, otherwise to 4 or another value other than 0, depending on the cause.
- DEMAND ... MESSAGES INTO sets SY-SUBRC to 0 if the message table is empty, otherwise to a value other than 0.
- DESCRIBE LIST sets SY-SUBRC to 0 if the line or list exists, otherwise to 4 or 8.
- 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.
- FETCH sets SY-SUBRC to 0 if at least one line was read, otherwise to 4.
- GENERATE SUBROUTINE POOL sets SY-SUBRC to 0 if the generation was successful, otherwise to 8.
- GET CURSOR sets SY-SUBRC to 0 if the cursor is correctly positioned, otherwise to 4.
- GET PARAMETER sets SY-SUBRC to 0 if a corresponding value exists in SAP memory, otherwise to 4.
- IMPORT sets SY-SUBRC to 0 if the import is successful, otherwise to 4.
- INSERT sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
- LOAD REPORT sets SY-SUBRC to 0 if the operation is successful, otherwise to 4 or 8 depending on the cause of the error.
- 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.
- LOOP AT sets SY-SUBRC to 0 if there is at least one loop pass through the internal table, otherwise to 4.
- MODIFY sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
- 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.
- MODIFY sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
- OLE2 Automation, executed successfully, otherwise 1, 2, 3, or 4, depending on the cause of the error.
- OPEN DATASET sets SY-SUBRC to 0 if the file could be opened, otherwise to 8.
- Open SQL statements set SY-SUBRC to 0 if the operation is successful, otherwise to a value other than 0.
- OVERLAY sets SY-SUBRC to 0 if at least one character is overlaid, otherwise to 4.
- 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.
- READ LINE sets SY-SUBRC to 0 if a list line exists, otherwise to a value other than 0.
- 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.
- REPLACE sets SY-SUBRC to 0 if the search string was replaced, otherwise to a value other than 0.
- SCROLL sets SY-SUBRC to 0 if the scrolling within the list was successful, otherwise to 4 or 8, depending on the cause.
- SEARCH sets SY-SUBRC to 0 if the search string was found, otherwise to 4.
- SELECT sets SY-SUBRC to 0 if at least one line was read, otherwise to 4, or possibly 8 in SELECT SINGLE FOR UPDATE.
- SET COUNTRY sets SY-SUBRC if the country code exists in table T005X, otherwise to 4.
- SET BIT sets SY-SUBRC to 0 if the bit could be set, otherwise to a value other than 0.
- SET TITLEBAR sets SY-SUBRC to 0 if the title exists, otherwise to 4.
- SHIFT ... UP TO sets SY-SUBRC to 0 if the position could be found within the string, otherwise to 4.
- SPLIT sets SY-SUBRC to 0 if the sizes of the target fields are adequate, otherwise to 4.
- UPDATE sets SY-SUBRC to 0 if the operation is successful, otherwise to 4.
- WRITE ... TO sets SY-SUBRC to 0 if the assignment is successful, otherwise to 4.
分享到:
相关推荐
SY-SUBRC = 0: 至少有一行数据,当ENDSELECT语句执行完,SY-DBCNT中保存着记录的个数。 SY-SUBRC = 4: 没有数据。 SY-SUBRC = 8: 只有使用“SELECT SINGLE FOR UPDATE”时才会有, 表示: WHERE条件指定的记录不止...
通过以上对SAP ABAP中SY字段含义的详细介绍,我们可以看到这些系统变量在开发过程中扮演着非常重要的角色。它们不仅提供了关于当前执行环境的关键信息,还帮助开发者更好地控制和管理程序的执行流程。正确理解和运用...
进入修改程序“LSKEYF00”的界面:进入 SE38,输入程序名 "LSKEYF00",点击修改按钮,用上述方法在任何遇到断点处修改 SY-SUBRC = 0。确定在 CASE 语句是 SY-SUBRC 值为 0),过断点后按 F8,继续运行程序。 Step 6...
WRITE: / 'SY-SUBRC:', SY-SUBRC, / 'System Message:', MESS. ENDIF. ``` 如果SAP系统运行在UNIX环境下且“hugo.xyz”文件不存在,则上述示例将输出错误代码和系统消息。 #### 打开文件以读取 要打开文件以供...
IF sy-subrc = 0. MESSAGE i101 WITH 'Delete success.'. ENDIF. ENDIF. ``` 在这个例子中,通过检查`p_del`参数是否为`X`来判断是否执行删除操作。如果是,则会调用`DELETE FROM`语句来清空指定表的所有记录。...
进入SE38,输入程序名"LSKEYF00",点击修改按钮(不是显示按钮),用上述方法在任何遇到断点处修改SY-SUBRC = 0。 第七步:修改程序"LSKEYF00"。在步骤6后,你就可以修改程序"LSKEYF00"了,找到“CALL 'GET_...
* SY-SUBRC:系统执行传回值,0 表示成功 * SY-UNAME:用户 * SY-DATUM:系统日期 * SY-UZEIT:系统时间 * SY-TCODE:当前执行程序的 Transaction code * SY-INDEX:当前 LOOP 循环过的次数 * SY-TABIX:当前处理的...
如果中找不到,则将SY-SUBRC设置为4并且不移动,否则将SY-SUBRC设置为0。内容同上。 3、根据第一个或最后一个字符移动字段串 语法:SHIFT <c> LEFT DELETING LEADING 。 SHIFT <c> RIGHT DELETING TRAILING ...
- **移动字段串到给定串**:使用`SHIFT <c> UP TO <str> <mode>`可以查找特定子串并移动字符串到边缘,`SY-SUBRC`用于记录操作状态。 - **根据第一个或最后一个字符移动**:`LEFT DELETING LEADING`和`RIGHT ...
- `SY-SUBRC`:执行语句后的返回值,0表示成功,其他值表示不同类型的错误。 - `SY-DATUM`:记录当前服务器的日期。 - `SY-UZEIT`:获取当前服务器时间。 - `SY-ULINE`:生成255个字符长度的水平线。 - `SY-...
4. **插入可执行代码**:为了永久性地绕过权限检查,可以在断点处插入代码,比如`sy-subrc = 0`,使得每次执行到此处时,权限检查都会自动通过。完成修改后,保存并激活程序。 请注意,这些步骤展示了如何在SAP环境...
4. **处理结果**:根据`sy-subrc`变量的值处理权限检查结果。`sy-subrc=0`表示权限检查通过,否则失败。 5. **角色分配**:在PFCG(Profile Generation)事务码中,为用户角色分配相应的权限对象和字段值,以授予或...
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 - 当前日期 =...
- SY-SUBRC:表示指令执行成功与否,'0'代表成功。 - SY-UNAME:当前用户的用户名。 - SY-DATUM:当前系统日期。 - SY-UZEIT:当前系统时间。 - SY-TCODE:当前执行的事务代码。 - SY-INDEX:循环计数。 - SY-TABIX...
- SY-SUBRC:系统返回码,0表示成功。 - SY-UNAME:当前登录用户的用户名。 - SY-DATUM:系统日期。 - SY-UZEIT:系统时间。 - SY-TCODE:当前执行的事务代码。 - SY-INDEX:循环计数。 - SY-TABIX:内部表当前行号...
- SY-SUBRC:执行操作后的返回码,'0'表示成功。 - SY-UNAME:当前用户登录的用户名。 - SY-DATUM:当前系统日期。 - SY-UZEIT:当前系统时间。 - SY-TCODE:当前执行的事务代码。 - SY-INDEX:循环中的当前迭代次数...
WRITE: / 'X', SY-SUBRC UNDER 'SY-SUBRC', " 在STRING3中查找X SY-FDPOS UNDER 'SY-FDPOS'. ``` 通过以上分析,我们可以看到文章不仅详细地介绍了如何使用ABAP编写99乘法表,还介绍了ABAP中的一些实用功能,...
6. **sy-subrc**:返回最近执行的函数模块或语句的子程序返回代码。0表示成功,非零值表示错误,这在错误处理和调试中非常有用。 7. **sy-datum**和**sy-uzeit**:分别提供当前日期和时间,这些信息可用于记录日志...
6. SY-SUBRC:执行状态为 0,表示成功 7. SY-UNAME:用户名 8. SY-UZEIT:当前时间 9. SY-TCODE:当前的事务代码 10. SY-LSIND:列表索引页 11. SY-LISTI:上一个列表的索引 12. SY-LILLI:绝对列表中选定行的行号 ...
* SY-SUBRC:系统执行某指令后,表示执行成功与否的变量,0 表示成功 * SY-UNAME:当前用户登录的用户名 * SY-DATUM:当前系统日期 * SY-UZEIT:当前系统时间 * SY-TCODE:当前执行程序的 Transaction code * SY-...