专栏首页Jerry的SAP技术分享SAP S/4HANA CDS View的访问控制实现:DCL介绍

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)

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • SAP S/4HANA CDS View的访问控制实现:DCL介绍

    Authorization Objects are business concept, they are distinguished by business s...

    Jerry Wang
  • SAP Hybris platform和Netweaver的缓存(Cache)设计机制

    (1 )The Hybris Cache is a part of the Hybris persistence layer.

    Jerry Wang
  • 一个ABAP重构的实例:CL_CRM_LEAD_CREATE~SELECT_CAMPAIGNS_BY_SQL

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 ...

    Jerry Wang
  • SAP S/4HANA CDS View的访问控制实现:DCL介绍

    Authorization Objects are business concept, they are distinguished by business s...

    Jerry Wang
  • 模型加速--LCNN: Lookup-based Convolutional Neural Network

    LCNN: Lookup-based Convolutional Neural Network CVPR2017 https://github.com/il...

    用户1148525
  • tweet情感分析流程

    关键字全网搜索最新排名 【机器学习算法】:排名第一 【机器学习】:排名第二 【Python】:排名第三 【算法】:排名第四 前言 自然语言处理(NLP)中一个很...

    昱良
  • UESTC 485 Game(康托,BFS)

    Today I want to introduce an interesting game to you. Like eight puzzle, it is a...

    ShenduCC
  • UESTC 485 Game(康托展开,bfs打表)

    Game Time Limit: 4000/2000MS (Java/Others) Memory Limit: 65535/65535KB (Ja...

    ShenduCC
  • iOS CPU架构 arm64/armv7s/armv7/armv7k/i386/x86_64

    转自:https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/

    望天
  • 【神器】vimum在浏览器中键盘操作选择、复制、粘贴,键盘党的最爱

    阿炬

扫码关注云+社区

领取腾讯云代金券