怎么阻止指定類型的SAP CRM附件被上傳到服務(wù)器,很多新手對此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。
要求:不允許最終用戶上載大小大于給定限制(例如400KB)的附件。
解決方案:
(1) 通過SPRO->客戶關(guān)系管理->基本功能->內(nèi)容管理->業(yè)務(wù)加載項(xiàng)->
更改文件的確認(rèn)
(2) 將以下源代碼復(fù)制到BAdI實(shí)現(xiàn)。有關(guān)代碼詳細(xì)信息,請參閱每行的注釋。
METHOD if_ex_crm_documents~carry_out_action. CONSTANTS: cv_max_size TYPE int4 VALUE 409600. "400KB DATA: lt_loios TYPE skwf_ios, ls_error TYPE skwf_error, lv_size TYPE sdok_fsize, lt_badios TYPE skwf_ioerrs. READ TABLE changed_documents ASSIGNING FIELD-SYMBOL(<first_line>) INDEX 1. CHECK sy-subrc = 0. " The badi implementation will be called whenever there is change on attachment ( create, update and delete), since it is necessary to filter out the change " mode CHECK <first_line>-action = 'CREATE_DOCUMENT'. DATA(ls_bo) = VALUE sibflporb( instid = <first_line>-instidbor typeid = <first_line>-typeidbor catid = <first_line>-catidbor ). DATA(ls_loios) = VALUE skwf_io( objtype = <first_line>-objtype class = <first_line>-class objid = <first_line>-objid ). APPEND ls_loios TO lt_loios. CALL METHOD cl_crm_documents=>get_file_info EXPORTING loio = ls_loios IMPORTING file_size = lv_size. CHECK lv_size >= cv_max_size. " Since this BAdI implementation could only be called after the attachment is created, so technically speaking we could not prevent the attachment creation indeed, but could only delete the attachment after its creation CALL METHOD cl_crm_documents=>delete EXPORTING business_object = ls_bo ios = lt_loios IMPORTING bad_ios = lt_badios error = ls_error. COMMIT WORK AND WAIT. " raise an error message to prompt user to upload the attachment with smaller size lo_service->add_message( EXPORTING iv_msg_type = 'E' iv_msg_id = 'ZCM_JERRY_TEST' iv_msg_number = '000' ). ENDMETHOD.
激活BAdI實(shí)現(xiàn):
現(xiàn)在,如果上傳的附件超過400KB,最終用戶將在UI中看到錯(cuò)誤消息。
看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)的支持。
新聞名稱:怎么阻止指定類型的SAPCRM附件被上傳到服務(wù)器-創(chuàng)新互聯(lián)
網(wǎng)頁URL:http://jinyejixie.com/article40/jihho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、做網(wǎng)站、網(wǎng)站收錄、網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容