动态隐藏某些特殊类型的SAP CRM附件

简介: 动态隐藏某些特殊类型的SAP CRM附件

Requirement

Only simple text file as attachment could be visible for some users but should be completely hidden for other users without enough authorizations.

The requirement could be fulfilled via BAdI:

image.pngimage.pngCLASS zcl_im_cl_att_auth_impl DEFINITION

PUBLIC

FINAL

CREATE PUBLIC .

PUBLIC SECTION.

INTERFACES if_ex_crm_doc_authority .

CLASS-METHODS class_constructor .

PROTECTED SECTION.

PRIVATE SECTION.

CONSTANTS cv_doc_lo TYPE string VALUE 'BDS_LOC22'. "#EC NOTEXT

CONSTANTS cv_doc_ph TYPE string VALUE 'BDS_POC22'. "#EC NOTEXT

CLASS-DATA sv_file_tab TYPE sdok_fltab .

CLASS-METHODS check_internal

CHANGING

!ios_auth TYPE skwf_ios

!ios_not_auth TYPE skwf_ioerrs .

CLASS-METHODS get_file_type

IMPORTING

!is_io TYPE skwf_io

RETURNING

VALUE(rv_type) TYPE w3conttype .

ENDCLASS.

 

CLASS ZCL_IM_CL_ATT_AUTH_IMPL IMPLEMENTATION.

* ---------------------------------------------------------------------------------------+

* | Static Private Method ZCL_IM_CL_ATT_AUTH_IMPL=>CHECK_INTERNAL

* +-------------------------------------------------------------------------------------------------+

* | [<-->] IOS_AUTH TYPE SKWF_IOS

* | [<-->] IOS_NOT_AUTH TYPE SKWF_IOERRS

* +--------------------------------------------------------------------------------------

METHOD check_internal.

CHECK sy-uname = 'WANGJER'.

DATA: lv_type TYPE w3conttype.

LOOP AT ios_auth ASSIGNING FIELD-SYMBOL() WHERE class = cv_doc_lo.

lv_type = get_file_type(  ).

IF lv_type <> 'text/plain'.

APPEND INITIAL LINE TO ios_not_auth ASSIGNING FIELD-SYMBOL().

MOVE-CORRESPONDING  TO .

-id = 'ZCM_JERRY_TEST'.

-type = 'W'.

-no = '001'.

-v1 = lv_type.

DELETE ios_auth WHERE objid = -objid.

ENDIF.

ENDLOOP.

ENDMETHOD.

* ---------------------------------------------------------------------------------------+

* | Static Public Method ZCL_IM_CL_ATT_AUTH_IMPL=>CLASS_CONSTRUCTOR

* +-------------------------------------------------------------------------------------------------+

* +--------------------------------------------------------------------------------------

METHOD class_constructor.

DATA: ls_type TYPE sdokphcl,

ls_table TYPE sdokphtab.

SELECT SINGLE * INTO ls_type FROM sdokphcl WHERE ph_class = cv_doc_ph.

CHECK sy-subrc = 0.

SELECT SINGLE * INTO ls_table FROM sdokphtab WHERE headertab = ls_type-headertab.

CHECK sy-subrc = 0.

sv_file_tab = ls_table-filetab.

ENDMETHOD.

* ---------------------------------------------------------------------------------------+

* | Static Private Method ZCL_IM_CL_ATT_AUTH_IMPL=>GET_FILE_TYPE

* +-------------------------------------------------------------------------------------------------+

* | [--->] IS_IO TYPE SKWF_IO

* | [<-()] RV_TYPE TYPE W3CONTTYPE

* +--------------------------------------------------------------------------------------

METHOD get_file_type.

DATA: lt_object TYPE STANDARD TABLE OF sdokobject.

DATA: lt_p TYPE STANDARD TABLE OF sdoklogphy.

APPEND INITIAL LINE TO lt_object ASSIGNING FIELD-SYMBOL().

= VALUE #( class = cv_doc_lo objid = is_io-objid ).

CALL FUNCTION 'SDOK_LOIOS_PHIOS_GET'

TABLES

object_list = lt_object

physical_objects = lt_p.

READ TABLE lt_p ASSIGNING FIELD-SYMBOL(

) INDEX 1.

CHECK sy-subrc = 0.

SELECT SINGLE mimetype FROM (sv_file_tab) INTO rv_type WHERE phio_id =

-objid_ph.

ENDMETHOD.

* ---------------------------------------------------------------------------------------+

* | Static Public Method ZCL_IM_CL_ATT_AUTH_IMPL=>IF_EX_CRM_DOC_AUTHORITY~AUTHORITY_CHECK

* +-------------------------------------------------------------------------------------------------+

* | [--->] ACTIVITY TYPE SKWF_ACTVT

* | [--->] PARENT_FOLDER TYPE SKWF_IO(optional)

* | [--->] APPLICATION TYPE SKWF_APPL(optional)

* | [--->] CURRENT_BUSINESS_OBJECT TYPE SIBFLPORB(optional)

* | [--->] IOS TYPE SKWF_IOS

* | [<-->] IOS_AUTH TYPE SKWF_IOS

* | [<-->] IOS_NOT_AUTH TYPE SKWF_IOERRS

* +--------------------------------------------------------------------------------------

METHOD if_ex_crm_doc_authority~authority_check.

check_internal( CHANGING ios_auth = ios_auth ios_not_auth = ios_not_auth ).

ENDMETHOD.

* ---------------------------------------------------------------------------------------+

* | Static Public Method ZCL_IM_CL_ATT_AUTH_IMPL=>IF_EX_CRM_DOC_AUTHORITY~AUTHORITY_CHECK_SEARCH_RESULT

* +-------------------------------------------------------------------------------------------------+

* | [--->] CURRENT_BUSINESS_OBJECT TYPE SIBFLPORB(optional)

* | [--->] IOS_WITH_LINKED_BOS TYPE CRM_KW_BOS

* | [<-->] IOS_AUTH TYPE SKWF_IOS

* | [<-->] IOS_NOT_AUTH TYPE SKWF_IOERRS

* +--------------------------------------------------------------------------------------

METHOD if_ex_crm_doc_authority~authority_check_search_result.

check_internal( CHANGING ios_auth = ios_auth ios_not_auth = ios_not_auth ).

ENDMETHOD.

ENDCLASS.image.png


目录
相关文章
|
6月前
|
开发者 数据处理 数据管理
SAP HANA 的不同类型
SAP HANA 的不同类型
SAP HANA 的不同类型
|
6月前
|
人工智能 搜索推荐 Serverless
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
使用金庸的著作,来测试阿里通义千问最新开放的长文档处理功能
|
6月前
|
存储
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
使用 ABAP 代码打印出 SAP CRM 系统里所有维护了 Sales Area 的 business partner id
SAP ABAP OData 服务里需要指定 guid 类型的请求参数时,正确语法是什么?
SAP ABAP OData 服务里需要指定 guid 类型的请求参数时,正确语法是什么?
|
6月前
|
Web App开发 开发者 存储
介绍一个 webp 格式转 png 格式的软件:XNConvert
介绍一个 webp 格式转 png 格式的软件:XNConvert
介绍一个 webp 格式转 png 格式的软件:XNConvert
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
|
6月前
|
数据库
SAP CRM产品主数据无法根据产品描述字段进行搜索的原因
SAP CRM产品主数据无法根据产品描述字段进行搜索的原因
|
6月前
|
中间件
什么是 SAP CRM 系统里的 Initial Download
什么是 SAP CRM 系统里的 Initial Download
|
6月前
|
中间件
什么是 SAP CRM Initial Download
什么是 SAP CRM Initial Download
|
6月前
|
存储 数据管理 数据处理
SAP CRM 里 Attachment 搜索的实现逻辑介绍
SAP CRM 里 Attachment 搜索的实现逻辑介绍