来自我的同事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:

  1. @EndUserText.label: 'Auto assigned mapping role for ZMX_SalesArea_DCL'
  2. @MappingRole: true
  3. define role ZMX_SalesArea_DCL {
  4. grant select on ZMX_SalesArea_DCL
  5. where (SalesPlanPurpose = '0' and (SalesOrganization, DistributionChannel, Division) =
  6. aspect pfcg_auth (V_VBAK_VKO,
  7. VKORG,
  8. VTWEG,
  9. SPART,
  10. actvt = '03'))
  11. OR (SalesPlanPurpose = '1' and (SalesOrganization) =
  12. aspect pfcg_auth (V_VBRK_VKO,
  13. VKORG,
  14. actvt = '03'));
  15. }

The logic in the CDS view:

  1. define view ZMX_SalesArea_DCL
  2. as select from
  3. I_SalesArea
  4. {
  5. key SalesOrganization,
  6. key DistributionChannel,
  7. key Division,
  8. '0' as SalesPlanPurpose
  9. }
  10. union all select from I_SalesArea
  11. {
  12. key SalesOrganization,
  13. key DistributionChannel,
  14. key Division,
  15. '1' as SalesPlanPurpose
  16. };

Authorization test on QW9/910

User: MILES01

Authorization:

Test Report:

  1. REPORT mx_test_sa_dcl.
  2. PARAMETERS:
  3. p_purp TYPE C LENGTH 1.
  4. DATA:
  5. lt_tab TYPE STANDARD TABLE OF i_salesarea_dcl.
  6. SELECT * FROM i_salesarea_dcl INTO TABLE @lt_tab
  7. WHERE salesplanpurpose = @p_purp.
  8. LOOP AT lt_tab ASSIGNING FIELD-SYMBOL(<fs_row>).
  9. WRITE:/ <fs_row>-salesorganization, <fs_row>-distributionchannel, <fs_row>-division, <fs_row>-salesplanpurpose.
  10. ENDLOOP.
  11. 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介绍的更多相关文章

  1. 如何在SAP云平台ABAP编程环境里把CDS view暴露成OData服务

    Jerry 2016年在学习SAP CDS view时,曾经写过一个CDS view的自学系列,其中有一篇提到了一个很方便的注解: @OData.publish: true 加上这个注解的CDS vi ...

  2. 使用CDS view开发SAP Marketing contact的facet追溯工具

    这篇SAP社区博客里,我的一位同事介绍了SAP Marketing里contact facet数据模型的存储表: https://blogs.sap.com/2016/07/01/how-does-s ...

  3. SAP S/4HANA extensibility扩展原理介绍

    SAP产品总的extensibility扩展原理介绍: 看Jerry这篇文章. SAP Cloud for Customer Extensibility的设计与实现 我的同事Boris写的. 而本文是 ...

  4. SAP C/4HANA Sales Cloud使用OData服务和第三方系统集成的一个具体例子

    出于工作需要,Jerry写了这篇文章,给某些Partner做参考. 以前Jerry曾经介绍过SAP C/4HANA的五朵云到底包含哪些具体产品,其实在SAP官网上有更权威的中文解释: https:// ...

  5. Jerry的CDS view自学系列

    My CDS view self study tutorial - part 1 how to test odata service generated by CDS view https://blo ...

  6. cds view 创建和调用

    cds view 是一个core data service, 能够将数据库表虚拟化为一个虚拟表(double).因为各个使用sap的公司,使用的数据库数据是不同的,所以提供一个数据库的虚拟.  通过向 ...

  7. SAP S/4HANA生产订单创建时使用的工厂数据是从什么地方带出来的

    大家如果使用我github上的这段代码创建S/4HANA的生产订单时,一定会发现,我在代码里并没有硬编码来指定生产订单的ID,然而运行时会发现我在系统里配置的这个2800被自动使用了,这是怎么做到的呢 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. lua热重载

    热重载,就是不重新开unity让代码的变化直接看出来,一般在开发时候使用 lua中通过require导入的文件,最终都存在package.loaded这个table中.require会判断是否文件已经 ...

  2. jcef视频教程

    http://www.cnblogs.com/Johness/p/java-cef-1-building.html

  3. CentOS 升级 openSSH

    openSSH作为linux远程连接工具,容易受到攻击,必须更新版本来解决,低版本有如下等漏洞: a. OpenSSH 远程代码执行漏洞(CVE-2016-10009) b.  OpenSSH aut ...

  4. Redis数据持久化机制AOF原理分析一---转

    http://blog.csdn.net/acceptedxukai/article/details/18136903 http://blog.csdn.net/acceptedxukai/artic ...

  5. 移动端手势事件 hammer.JS插件

                      一.引入hammer.JS 1.下载地址:http://download.csdn.net/detail/webxiaoma/9872249 2.官网地址:http ...

  6. Windows Server 2008系统中IE8启用和禁用JS

    Windows Server 2008系统中IE8默认是启用IE ESC(ie 增强)的,这样会导致该IE不支持JS,开启方法: 1.开始->管理工具->服务器管理器 2.点击服务器管理- ...

  7. WAMP环境配置-Apache服务器的安装

    一.下载 下载地址:http://httpd.apache.org/ 在这里就可以下载想下载的版本了 二.安装 我这次环境配置安装的是Apache-2.4.23版本! (最近我在反复安装PHP的时候出 ...

  8. Java - 深拷贝技巧

    先让我描述一下问题:我在某Action(struts2.x)-A中写了一个功能P,以当前用户的某个标识F == 1时需要走这个功能,而且这个功能因某些原因已经侵入到了其他一些method中.顺便一提, ...

  9. [javaEE] javaweb的mvc设计思想

    Servlet:在Servlet中拼接html内容 JSP:在html中拼接java JSP+JavaBean:利用javaBean将大量的代码提取走 Servlet+JSP+JavaBean:Ser ...

  10. 三:Mybatis知识整理(3)

    一:mybatis中模糊查询的方法: 1.直接传参法:在java传参时进行拼接 -- %keyword% 2.mysql内置函数:concart('%',#{keyword},'%') -- 拼接sq ...