SAP S/4HANA CDS View的访问控制实现:DCL介绍
来自我的同事Xu Miles
Authorization Objects are business concept, they are distinguished by business scenario.
Therefore, there might be a lot of Authorization Objects using the same Authorization Field. Such as VKORG.

In Sales Planning, there're two Authorization Objects related to Sales Area, V_VBAK_VKO and V_VBRK_VKO, they represent transaction scenario Sales Document and Billing Document repectively. If we want to extract the Sales Area master data, technically we could use any Authorization Object with Authorization Field VKORG, VTWEG, SPART.
However, considering the authorization of the business user, we need to use Authorization Object V_VBAK_VKO and V_VBRK_VKO separately when end user is planning for income sales or sales volume.
To do this, we could use additional CDS view + DCL to realize.
Example on ERG/001:
CDS: ZMX_SalesArea_DCL
DCL: ZMX_SalesArea_DCL
The logic in DCL:
@EndUserText.label: 'Auto assigned mapping role for ZMX_SalesArea_DCL'
@MappingRole: true
define role ZMX_SalesArea_DCL {
grant select on ZMX_SalesArea_DCL
where (SalesPlanPurpose = '0' and (SalesOrganization, DistributionChannel, Division) =
aspect pfcg_auth (V_VBAK_VKO,
VKORG,
VTWEG,
SPART,
actvt = '03'))
OR (SalesPlanPurpose = '1' and (SalesOrganization) =
aspect pfcg_auth (V_VBRK_VKO,
VKORG,
actvt = '03'));
}
The logic in the CDS view:
define view ZMX_SalesArea_DCL
as select from
I_SalesArea
{
key SalesOrganization,
key DistributionChannel,
key Division,
'0' as SalesPlanPurpose
}
union all select from I_SalesArea
{
key SalesOrganization,
key DistributionChannel,
key Division,
'1' as SalesPlanPurpose
};
Authorization test on QW9/910
User: MILES01
Authorization:
Test Report:
REPORT mx_test_sa_dcl.
PARAMETERS:
p_purp TYPE C LENGTH 1.
DATA:
lt_tab TYPE STANDARD TABLE OF i_salesarea_dcl.
SELECT * FROM i_salesarea_dcl INTO TABLE @lt_tab
WHERE salesplanpurpose = @p_purp.
LOOP AT lt_tab ASSIGNING FIELD-SYMBOL(<fs_row>).
WRITE:/ <fs_row>-salesorganization, <fs_row>-distributionchannel, <fs_row>-division, <fs_row>-salesplanpurpose.
ENDLOOP.
WRITE:/ 'Finished.'.
The logic flow is that firstly we use SalesPlanUUID to get SalesPlanPurpose, then with SalesPlanPurpose we could get the Sales Area master data via the corresponding Authorization Objects.
SalesPlanPurpose: 0 (Incoming sales)

SalesPlanPurpose: 1(Sales Volume)

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

SAP S/4HANA CDS View的访问控制实现:DCL介绍的更多相关文章
- 如何在SAP云平台ABAP编程环境里把CDS view暴露成OData服务
Jerry 2016年在学习SAP CDS view时,曾经写过一个CDS view的自学系列,其中有一篇提到了一个很方便的注解: @OData.publish: true 加上这个注解的CDS vi ...
- 使用CDS view开发SAP Marketing contact的facet追溯工具
这篇SAP社区博客里,我的一位同事介绍了SAP Marketing里contact facet数据模型的存储表: https://blogs.sap.com/2016/07/01/how-does-s ...
- SAP S/4HANA extensibility扩展原理介绍
SAP产品总的extensibility扩展原理介绍: 看Jerry这篇文章. SAP Cloud for Customer Extensibility的设计与实现 我的同事Boris写的. 而本文是 ...
- SAP C/4HANA Sales Cloud使用OData服务和第三方系统集成的一个具体例子
出于工作需要,Jerry写了这篇文章,给某些Partner做参考. 以前Jerry曾经介绍过SAP C/4HANA的五朵云到底包含哪些具体产品,其实在SAP官网上有更权威的中文解释: https:// ...
- Jerry的CDS view自学系列
My CDS view self study tutorial - part 1 how to test odata service generated by CDS view https://blo ...
- cds view 创建和调用
cds view 是一个core data service, 能够将数据库表虚拟化为一个虚拟表(double).因为各个使用sap的公司,使用的数据库数据是不同的,所以提供一个数据库的虚拟. 通过向 ...
- SAP S/4HANA生产订单创建时使用的工厂数据是从什么地方带出来的
大家如果使用我github上的这段代码创建S/4HANA的生产订单时,一定会发现,我在代码里并没有硬编码来指定生产订单的ID,然而运行时会发现我在系统里配置的这个2800被自动使用了,这是怎么做到的呢 ...
- Create Fiori List App Report with ABAP CDS view – PART 2
In the Part 1 blog, we have discussed below topics CDS annotations for Fiori List Report. How to cre ...
- Create Fiori List App Report with ABAP CDS view – PART 1
From Create Fiori List App Report with ABAP CDS view – PART 1 In this blog, I am going to show How C ...
随机推荐
- MacOS系统下的图形化工具
MacOS系统下的图形化工具 MacOS系统下安装了Git后,发现如果Git中有中文文档操作还是比较麻烦(需要输入中文的文件名).图形化对Git的操作还是相对于方便一些.所以准备找一个图形化的工具. ...
- golang基础---Slice切片
切片Slice在go语言中是单独的类型(指向底层的数组),不同于python(对可迭代对象操作的工具),注意区分数组和slice的区别 定义一个空slice,格式var s []int,这种既没有长度 ...
- 如何限制html标签input的长度
如何限制html标签input的长度 示例: <form action="/example/html/form_action.asp" method="get&qu ...
- ajax返回整个页面
- Java API 之 动态代理
一.代理模式 如图:由于某些原因我们希望对该实现类进行访问控制.功能增强等,那么加入一层代理层,用代理层来调用实现类是一个很好的方式来解决这个问题,我们可以在调用实现类功能前后进行校验或者加入一些功能 ...
- 一台电脑上运行两个tomcat
1.建立两个文件夹,tomcat1,tomcat2,分别在里面放入tomcat7文件(非安装版) 2.改配置 tomcat1中的配置就不用改了,直接用默认配置 tomcat2中的配置要改要,改conf ...
- maven配置环境
今天初学maven,先学习一下如何在windows下面配置maven,当然你要先配置好jdk的环境. 第一步,上官网下载maven插件,网址是:点击打开链接 第二步,解压文件夹,放在某一个盘符下,我是 ...
- 学习stylus笔记
最近在研究v-cli3.0,发现了一种新的预处理器,于是花了一些时间去学习下. 学习网站 基本上这个网站上,讲的已经很详情.我下面把我在学习之中的笔记和觉得自己用的多方法贴出来. 1.缩排 使用缩排和 ...
- csharp:.net 3.5 using System.Runtime.Serialization.Json read json
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- hdu 4513 吉哥系列故事——完美队形II (manachar算法)
吉哥系列故事——完美队形II Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) P ...