怎么阻止指定类型的SAPCRM附件被上传到服务器
怎么阻止指定类型的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中看到错误消息。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。
当前题目:怎么阻止指定类型的SAPCRM附件被上传到服务器
分享URL:http://myzitong.com/article/iihoih.html