ABAP 740的新语法 - 使用BO association的方式进行内表连接操作
ABAP Mesh is also a new feature in 740. Let’s use an example to demonstrate how it works:
I have defined two types for developers and managers. developer type has a field manager which points to his manager, while manager type does not have any reference to his managing employee.
types: begin of t_manager,
name type char10,
salary type int4,
end of t_manager,
tt_manager type sorted table of t_manager with unique key name.
types: begin of t_developer,
name type char10,
salary type int4,
manager TYPE char10,
end of t_developer,
tt_developer type sorted table of t_developer with unique key name.
I also use the new grammar – inline data declaration to fill developer and manager table. So far nothing special.
DATA: lt_developer TYPE tt_developer,
lt_manager TYPE tt_manager.
DATA(Jerry) = VALUE t_developer( name = 'Jerry' salary = 1000 manager = 'Jason' ).
DATA(Tom) = VALUE t_developer( name = 'Tom' salary = 2000 manager = 'Jason' ).
DATA(Bob) = VALUE t_developer( name = 'Bob' salary = 2100 manager = 'Jason' ).
DATA(Jack) = VALUE t_developer( name = 'Jack' salary = 1000 manager = 'Thomas' ).
DATA(David) = VALUE t_developer( name = 'David' salary = 2000 manager = 'Thomas' ).
DATA(John) = VALUE t_developer( name = 'John' salary = 2100 manager = 'Thomas' ).
DATA(Jason) = VALUE t_manager( name = 'Jason' salary = 3000 ).
DATA(Thomas) = VALUE t_manager( name = 'Thomas' salary = 3200 ).
INSERT Jerry INTO TABLE lt_developer.
INSERT Tom INTO TABLE lt_developer.
INSERT Bob INTO TABLE lt_developer.
INSERT Jack INTO TABLE lt_developer.
INSERT David INTO TABLE lt_developer.
INSERT John INTO TABLE lt_developer.
INSERT Jason INTO TABLE lt_manager.
INSERT Thomas INTO TABLE lt_manager.
Now I define one ABAP mesh t_team with two component managers and developers. With association ‘my_employee’, I connect the internal table managers to developers, so that I could easily find all developers of a given manager. The association ‘my_manager’ just enables the connection in opposite direction: find out the manager of a given developer.
You can compare how I find Jerry’s manager and find all developers whose manager are Thomas using new ABAP mesh and the traditional way.
The result are exactly the same.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
相关文章
- Webstorm/Phpstorm中设置连接FTP,并快速进行文件比较,上传下载,同步等操作
- 配置win10专用虚拟网络时提示已拒绝远程连接解决办法
- Apache HTTP Server 与 Tomcat 的三种连接方式介绍
- URLConnection的连接、超时、关闭用法总结
- golang中使用gorm连接mysql操作
- 【问题解决方案】Keras手写数字识别-ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接
- linux shell 字符串操作详解 (长度,读取,替换,截取,连接,对比,删除,位置 )
- linux shell 字符串操作详解 (长度,读取,替换,截取,连接,对比,删除,位置 )
- 程序员的算法趣题Q30: 插线板连接方式
- 使用Visual Studio的动态连接库创建通用数据库连接对话框
- SAP fiori上直接连接到操作系统层面 然后进行相关操作的需求
- linux 文件名称前后缀操作函数----取目录函数dir、取文件名称函数notdir、取后缀函数suffix、取前缀basename、加后缀函数addsuffix、加前缀addprefix、连接函数join
- 使用Jdbc的方式连接Clickhouse列式数据库
- Eclipse连接到My sql数据库之前操作
- 使用MVC写模式jsp连接到数据库操作
- distinct 去重复查询——两个表join 连接,去掉重复的数据
- HTTP长连接和短连接(转)
- python3.6 使用 pymysql 连接 Mysql 数据库及 简单的增删改查操作
- redis客户端连接过多不释放
- pymongo中的连接操作:Connection()与MongoClient()
- Pandas高阶--数据规整(1)--数据合并concat(2)--数据连接merge(3)数据重构stackunstack
- VB.net:VB.net编程语言学习之基于VS软件连接SQL Server(利用ADO.NET操作数据库/添加新数据源/DataGridView数据表格控件)的简介、案例应用之详细攻略
- Servlet | 连接数据库、使用IDEA工具开发Servlet