来自我的同事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介绍的更多相关文章

  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. Grunt:任务自动管理工具(收藏+转载)

    原文:http://javascript.ruanyifeng.com/tool/grunt.html 安装 命令脚本文件Gruntfile.js Gruntfile.js实例:grunt-contr ...

  2. 面向对象 OOP

    [面向对象编程OOP]   1 语言的分类 面向机器 :汇编语言 面向过程 :c语言 面向对象 :c++ Java PHP等   2 面向过程与面向对象 面向过程:专注于如何去解决一个问题的过程,编程 ...

  3. C++运行符重载、友元函数

    Complex.h #pragma once #include <iostream> using namespace std; //表示一个复数 class Complex { priva ...

  4. linux免密登录ssh验证配置方法及常见错误解决

    目标:从服务器A免密登录服务器B [配置方法] 1.在服务器A生成密钥文件,直接使用以下命令: ssh-keygen 中间遇到输入内容一路回车即可,完成后会在 ~/.ssh 目录下生成两个文件:id_ ...

  5. HttpContext在多线程异步调用中的使用方案

    1.在线程调用中,有时候会碰到操作文件之类的功能.对于开发人员来说,他们并不知道网站会被部署在服务器的那个角落里面,因此根本无法确定真实的物理路径(当然可以使用配置文件来配置物理路径),他们唯一知道的 ...

  6. 使用在线工具下载YouTube视频

    YouTube上面有数不尽的视频资源,很多人都想从上面下载自己喜欢的视频,但是不得其法.那么,究竟怎样从YouTube上面下载视频呢?其实,一点也不难.只要你在Google上面搜索free youtu ...

  7. Rabbit简单队列模式

    1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/ ...

  8. maven配置环境

    今天初学maven,先学习一下如何在windows下面配置maven,当然你要先配置好jdk的环境. 第一步,上官网下载maven插件,网址是:点击打开链接 第二步,解压文件夹,放在某一个盘符下,我是 ...

  9. mysql索引是什么?索引结构和使用详解

    索引是什么 mysql索引: 是一种帮助mysql高效的获取数据的数据结构,这些数据结构以某种方式引用数据,这种结构就是索引.可简单理解为排好序的快速查找数据结构.如果要查“mysql”这个单词,我们 ...

  10. vue支付密码

    从网上搜索了好多都很麻烦,花了点事件自己做了个,简单轻便,老少皆宜 <template> <section class="pay-mask" @click=&qu ...