怎么阻止指定類型的SAP CRM附件被上傳到服務(wù)器,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來學(xué)習(xí)下,希望你能有所收獲。
創(chuàng)新互聯(lián)專注于懷柔企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站建設(shè),商城網(wǎng)站建設(shè)。懷柔網(wǎng)站建設(shè)公司,為懷柔等地區(qū)提供建站服務(wù)。全流程按需開發(fā)網(wǎng)站,專業(yè)設(shè)計,全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)要求:不允許最終用戶上載大小大于給定限制(例如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() 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 -action = 'CREATE_DOCUMENT'. DATA(ls_bo) = VALUE sibflporb( instid = -instidbor typeid = -typeidbor catid = -catidbor ). DATA(ls_loios) = VALUE skwf_io( objtype = -objtype class = -class objid = -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中看到錯誤消息。
看完上述內(nèi)容是否對您有幫助呢?如果還想對相關(guān)知識有進(jìn)一步的了解或閱讀更多相關(guān)文章,請關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)的支持。