十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
怎么阻止指定类型的SAP CRM附件被上传到服务器,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
创新互联专注于怀柔企业网站建设,响应式网站建设,商城网站建设。怀柔网站建设公司,为怀柔等地区提供建站服务。全流程按需开发网站,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务要求:不允许最终用户上载大小大于给定限制(例如400KB)的附件。
解决方案:
(1) 通过SPRO->客户关系管理->基本功能->内容管理->业务加载项->
更改文件的确认
(2) 将以下源代码复制到BAdI实现。有关代码详细信息,请参阅每行的注释。
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实现:
现在,如果上传的附件超过400KB,最终用户将在UI中看到错误消息。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联-成都网站建设公司行业资讯频道,感谢您对创新互联的支持。