動態隱藏某些特殊型別的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:
Check a BAdI implementation on BAdI definition CRM_DOC_AHTORITY and copy the source code from last part of this wiki to the implementation class. The reason why using OPEN SQL to get the file type instead of using utility methodCL_CRM_DOCUMENTS=>GET_FILE_INFO or function module SKWF_PHIOS_FILE_PROPERTIES_GET is to avoid the recursive authorization call as listed below:
Source code of BAdI implementation
CLASS zcl_im_cl_att_auth_impl DEFINITIONPUBLICFINALCREATE 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 NOTEXTCONSTANTS cv_doc_ph TYPE string VALUE 'BDS_POC22'. "#EC NOTEXTCLASS-DATA sv_file_tab TYPE sdok_fltab .CLASS-METHODS check_internalCHANGING!ios_auth TYPE skwf_ios!ios_not_auth TYPE skwf_ioerrs .CLASS-METHODS get_file_typeIMPORTING!is_io TYPE skwf_ioRETURNINGVALUE(rv_type) TYPE w3conttype .ENDCLASS.CLASS ZCL_IM_CL_ATT_AUTH_IMPL IMPLEMENTATION.* <SIGNATURE>---------------------------------------------------------------------------------------+* | Static Private Method ZCL_IM_CL_ATT_AUTH_IMPL=>CHECK_INTERNAL* +-------------------------------------------------------------------------------------------------+* | [<-->] IOS_AUTH TYPE SKWF_IOS* | [<-->] IOS_NOT_AUTH TYPE SKWF_IOERRS* +--------------------------------------------------------------------------------------</SIGNATURE>METHOD check_internal.CHECK sy-uname = 'WANGJER'.DATA: lv_type TYPE w3conttype.LOOP AT ios_auth ASSIGNING FIELD-SYMBOL(<io_auth>) WHERE class = cv_doc_lo.lv_type = get_file_type( <io_auth> ).IF lv_type <> 'text/plain'.APPEND INITIAL LINE TO ios_not_auth ASSIGNING FIELD-SYMBOL(<auth_error>).MOVE-CORRESPONDING <io_auth> TO <auth_error>.<auth_error>-id = 'ZCM_JERRY_TEST'.<auth_error>-type = 'W'.<auth_error>-no = '001'.<auth_error>-v1 = lv_type.DELETE ios_auth WHERE objid = <io_auth>-objid.ENDIF.ENDLOOP.ENDMETHOD.* <SIGNATURE>---------------------------------------------------------------------------------------+* | Static Public Method ZCL_IM_CL_ATT_AUTH_IMPL=>CLASS_CONSTRUCTOR* +-------------------------------------------------------------------------------------------------+* +--------------------------------------------------------------------------------------</SIGNATURE>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.* <SIGNATURE>---------------------------------------------------------------------------------------+* | Static Private Method ZCL_IM_CL_ATT_AUTH_IMPL=>GET_FILE_TYPE* +-------------------------------------------------------------------------------------------------+* | [--->] IS_IO TYPE SKWF_IO* | [<-()] RV_TYPE TYPE W3CONTTYPE* +--------------------------------------------------------------------------------------</SIGNATURE>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(<line>).<line> = VALUE #( class = cv_doc_lo objid = is_io-objid ).CALL FUNCTION 'SDOK_LOIOS_PHIOS_GET'TABLESobject_list = lt_objectphysical_objects = lt_p.READ TABLE lt_p ASSIGNING FIELD-SYMBOL(<p>) INDEX 1.CHECK sy-subrc = 0.SELECT SINGLE mimetype FROM (sv_file_tab) INTO rv_type WHERE phio_id = <p>-objid_ph.ENDMETHOD.* <SIGNATURE>---------------------------------------------------------------------------------------+* | 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* +--------------------------------------------------------------------------------------</SIGNATURE>METHOD if_ex_crm_doc_authority~authority_check.check_internal( CHANGING ios_auth = ios_auth ios_not_auth = ios_not_auth ).ENDMETHOD.* <SIGNATURE>---------------------------------------------------------------------------------------+* | 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* +--------------------------------------------------------------------------------------</SIGNATURE>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.
Disadvantage of this solution
(1) the enhancement will be triggered whenever there is the function module SKWF_AUTH_OBJECTS_CHECK called. In Content management the check logic is done frequently.
(2) in the enhancement execution context there is no enough information to do filter logic for performance improvement.
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2717305/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 動態控制SAP CRM附件的可編輯性
- 如何阻止指定型別的SAP CRM附件被上傳到伺服器型別伺服器
- 使用程式碼修改SAP CRM附件的屬性
- SAP CRM附件模型的Authorization scope原理介紹模型
- Easyexcel匯出時如何隱藏掉某些欄位Excel
- 如何啟用SAP CRM附件UI上的advanced按鈕UI
- 如何讓你的SAP CRM應用支援附件上傳
- jqgrid動態顯示,隱藏指定列
- 使用擴充套件技術將SAP Fiori應用隱藏動態建立的UI欄位套件UI
- 淺談程式語言型別的強型別,弱型別,動態型別,靜態型別型別
- bootstrap datepicker 單獨設定某些日期的特殊背景顏色和某些月份特殊背景boot
- SAP Fiori 應用 Adapt UI 動態顯示或者隱藏的技術設計細節解析APTUI
- 使用ABAP程式碼給SAP CRM Business object建立附件AttachmentObject
- 特殊採購型別型別
- 如何把SAP CRM產品主資料隱藏的batch ID欄位顯示出來資料隱藏BAT
- SAP CRM點了附件的超連結後報錯的處理方式
- SAP 移動型別詳解型別
- 在 Laravel 中動態 隱藏 / 顯示 API 欄位LaravelAPI
- [JS高程] 特殊的原始值型別JS型別
- SAP CRM附件在應用伺服器上的儲存原理解析伺服器
- C# 中的動態型別C#型別
- CRM product UI裡assignment block的顯示隱藏邏輯UIBloC
- 動態控制C4C UI元素的顯示和隱藏UI
- Android 隱藏系統狀態列Android
- css隱藏滾動條CSS
- 【Redis】Redis的資料型別速查(5種基礎型別,5特殊型別)Redis資料型別
- win10某些設定已隱藏或由你的組織管理如何關閉Win10
- WebApplicationContext 中特殊的 bean 型別(二)--- LocaleResolverWebAPPContextBean型別
- 06-redis的三種特殊型別Redis型別
- SAP CRM AET Application Reference型別擴充套件欄位的一個例子APP型別套件
- SAP UI5 FileUploader 的隱藏 iframe 設計明細UI
- SAP CRM note的自動拷貝
- SAP MM 給合同的ITEM上傳附件以及附件查詢
- Redis 中三種特殊的資料型別Redis資料型別
- 隱藏資料夾怎麼取消隱藏 關閉隱藏檔案的辦法
- 夯實Java基礎系列2:Java基本資料型別,以及自動拆裝箱裡隱藏的秘密Java資料型別
- 如何隱藏工作列的圖示win10_win10怎麼隱藏狀態列圖示Win10
- Redis 三種特殊資料型別Redis資料型別