SY-SUBRC
一般是对read table和select语句使用。
loop at g_it_data where level < <wa_data>-level and seq < <wa_data>-seq and ( ( item_category = 'M' and assembly = 'X' ) or level = 1 ).
<wa_data>-cpmtr = g_it_data-cpmtr.
if <wa_data>-cpmtr is not initial.
exit.
endif.
endloop.
if <wa_data>-cpmtr is not initial. 不要写成 if sy-subrc = 0,这样的逻辑是有问题的。
下面这段代码问题很严重:
CLEAR g_it_data.
READ TABLE g_it_data WITH KEY cpmtr = <wa_data>-cpmtr level = <wa_data>-level .
IF sy-subrc eq 0.
IF g_it_data-ctgry IS NOT INITIAL.
<wa_data>-ctgry = g_it_data-ctgry.
ENDIF.
ELSE.
CLEAR: tmp_sublevel,g_it_data.
tmp_sublevel = <wa_data>-level + 1.
READ TABLE g_it_data WITH KEY cpmtr = <wa_data>-cpmtr level = tmp_sublevel.
IF sy-subrc eq 0.
<wa_data>-ctgry = g_it_data-ctgry.
ENDIF.
ENDIF.
自己写这段代码的目的是,先从同样level,同样cpmtr的记录里去找,找不到就往下一层去找。
当在同样的level找时,read table一但有记录,那么sy-subrc就为零,没读到才不会为零,才会继续在g_it_data里去找下一层。
注意这里,本意是找不到就往下一层找,而代码是read table,没有找到同样level,同样cpmtr的记录就往下找,可是同一个内表里,肯定是会让read table的sy-subrc为零的。
这里应该换判断,不使用嵌套的read table,而是像上面一样,单独判断“ctgry”是否为零。
SY-SUBRC的更多相关文章
- [SAP ABAP开发技术总结]OPEN SQL
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- ABAP ALV DEMO示例源码
关于ALV表格颜色,感觉这种需求在项目中用到的时候不是很多,但是前一段时间面试的时候,面试官问了我关于ALV单元格颜色的问题. 以前了解过一点,回答的不是很好,后来百度了一下,大概了解了一些,今天工作 ...
- SY全局系统字段
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- CPU状态信息us,sy,ni,id,wa,hi,si,st含义
转自:http://blog.csdn.net/sasoritattoo/article/details/9318893 转自:http://fishermen.iteye.com/blog/1995 ...
- 对二进制加密(分散保存-s=sy+a+b)
#include <stdio.h> #define L 40 void jiaM(int * s,int * a,int *b,int *sy); void jieM(int * a,i ...
- spring3+structs2整合hibernate4时报org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void sy.dao.impl.UserDaoImpl.setSessionFactory(org.hibernate.SessionFactory);
今天在spring3+structs2整合hibernate4时报如下错误,一直找不到原因: org.springframework.beans.factory.BeanCreationExcepti ...
- Linux CPU负载状态:%us/%sy/%ni/%id/%wa/%hi/%si/%st含义
原文 Linux CPU负载状态:%us/%sy/%ni/%id/%wa/%hi/%si/%st含义 缙哥哥发现用了雅黑的探针,在 Linux 的 CPU 状态信息中发现,有“%us.%sy.%ni. ...
- 初识Ubuntu 18.04(更换系统头像,截图,sy)
其实我认识ubuntu也有一段时间了,只是我一直沉迷Windows无法自拔,但是熟悉一下ubuntu的环境对于各项比赛以及今后的工作还是很有用处的,不过在未来的很长一段时间里,我只会以一个普通用户的身 ...
- top命令查看CPU状态信息:%us、%sy、%ni、%id、%wa、%hi、%si、%st 表示的是什么意思
Linux CPU负载状态:%us/%sy/%ni/%id/%wa/%hi/%si/%st含义 2018-08-26 分类:Linux 评论(0) 缙哥哥发现用了雅黑的探针,在 Linux 的 C ...
- python使用笔记10--os,sy模块
os操作文件,可以输入绝对路径,也可以输入相对路径 windows使用路径用\连接 Linux使用路径用/连接 但是我的电脑是windows 用/也没问题 1.os常用方法 1 import os 2 ...
随机推荐
- get return value of python in shell
from: https://stackoverflow.com/questions/2115615/assigning-value-to-shell-variable-using-a-function ...
- vue:在router里面给页面加title
vue中给组件页面加页面标题:{ path: '/', name: 'index', component: disconnect, meta: { title: '首页' } }, { path: ' ...
- Haskell语言学习笔记(74)GADTs
GADTs GADTs(Generalised Algebraic Data Types,广义代数数据类型)是对代数数据类型的一种扩展. 它允许在定义数据类型时明确指定类型参数的类型并使用模式匹配. ...
- Kotlin语言学习笔记(2)
类(classes) // 类声明 class Invoice { } // 空的类 class Empty // 主体构造器(primary constructor) class Person co ...
- 如何在Windows下安装MYSQL,并截图说明
说明 : window 下安装 mysql 虽然简单,但是细节不注意就会安装失败,特别是配置服务器时,Current Root Password:为空:如果输入密码了在后面安装会报错.(不知道设置这个 ...
- C++ 关于MFC多线程编程中的一些注意事项 及自定义消息的处理
在多线程编程中,最简单的方法,无非就是利用 AfxBeginThread 来创建一个工作线程,看一下这个函数的说明: CWinThread* AFXAPI AfxBeginThread( AFX_T ...
- swift重写导航控制器类的 initialize 方法
//这个方法,是当这个类第一次被创建时调用,且只调用一次 override class func initialize() { let navBar = UINavigationBar.appeara ...
- eclipse git 忽略文件
ps:git中只有.gitignore文件需要先加索引再提交,其它的都可以直接提交
- Python基础学习Day3 数据类型的转换、int、str、bool、字符串的常用方法、for循环
一.数据类型的转换 常用的是:int 转str.str转int.int转bool 时 非零即为 True . # 数据类型之间转换 ***** # int <--> str str(i ...
- Choosing the Type at Runtime
[Choosing the Type at Runtime] You cannot use a general expression as the React element type. If you ...