使用代码删除SAP CRM的附件(attachment)数据
In the beginning I consider it is very easy to delete attachments via code, just like below. I have defined one method with following two importing parameters and one returning parameter:
(1) iv_bor_type type string – the BOR type of your business object (2) iv_uuid type raw16 – the guid of your business object instance (3) rv_successful type abap_bool – indicates whether the deletion is successful
DATA: ls_bo TYPE SIBFLPORB,
lt_loios TYPE SKWF_IOS,
ls_loios TYPE SKWF_IO,
ls_error TYPE SKWF_ERROR,
lt_badios TYPE SKWF_IOERRS,
lv_del_flag TYPE ABAP_BOOL.
ls_bo-instid = iv_uuid.
ls_bo-typeid = iv_bor_type.
ls_bo-catid = 'BO'.
rv_successful = abap_false.
CALL METHOD cl_crm_documents=>get_info
EXPORTING
business_object = ls_bo
IMPORTING
loios = lt_loios.
LOOP AT lt_loios INTO ls_loios.
CALL METHOD cl_crm_documents=>lock
EXPORTING
is_bo = ls_bo
is_loio = ls_loios
IMPORTING
es_error = ls_error.
IF ls_error IS NOT INITIAL.
RETURN.
ENDIF.
ENDLOOP.
CALL METHOD cl_crm_documents=>delete
EXPORTING
business_object = ls_bo
ios = lt_loios
IMPORTING
bad_ios = lt_badios
error = ls_error.
IF ls_error IS INITIAL. " deletion failed
rv_successful = abap_true.
ENDIF.
Through testing I found it works perfectly well with most of BOR type like product, IBASE, BP, and one order.
However, it does not work for my new BOR type CRMSOCPOST in CRM7.0 EHP3 – the relationship between my BO and the attachments is not really deleted until an explicit call COMMIT WORK is written in the report. However, for any other standard CRM BOR type, the COMMIT WORK is not needed. Why? After some debugging finally I find answer. Have you already observed the comments below? It is written quite clearly: if the business object exists in the database, the COMMIT WORK is not needed.
Back to my case, since CRMSOCPOST is a new BOR type created in CRM7.0 EHP3, the function module does not recognize it, so the code reached line 225, and then the BO instance is regarded as non-exist in DB. So an explicit COMMIT WORK is always necessary to make deletion work.
- springmvc下载文件
- PHP获取URL地址的一些坑
- 使用ResourceBundle读取配置文件
- 关于exp statistics的问题和简单测试(82天)
- laravel访问路由在nginx服务器上无法处理
- How Tomcat Works, A Guide to Developing Your Own Java Servlet Container
- 【开发指南】如何为nexus 5编译固件
- 支持向量机(SVM)入门详解(续)与python实现
- 数据库
- 关于Bom头的一些坑
- 使用shell脚本查看数据库负载情况(81天)
- 无法连接远程mysql数据库解决方案
- 归档问题导致的数据库无法启动 (80天)
- ubuntu上安装php7.0+nginx+mysql
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- ABAP面试问题 - 不使用加减乘除等操作比较两个整数大小
- SAP订单上Shipping抬头和行项目字段的持久化实现原理
- SAP CRM订单模型CRMD_SHIPPING的单元测试方法
- 给SAP WebClient UI的表格行项目增添PDF预览功能
- 如何将ABAP透明表的内容导入PostgreSQL数据库
- 使用代理模式改善SAP UI5应用的图片加载体验
- 如何使用ABAP open SQL的locator
- dotnet 新 SDK Style 项目格式如何使用 InternalsVisibleToAttribute 功能
- WPF dotnet core 如何开启 Pointer 消息的支持
- web Storage的特点
- 四、实现跨域访问
- hadoop集群搭建
- java和node.js使用md5算法实现对数据的加密与加盐操作
- 反射--调用构造方法
- ABAP,Java和JavaScript的local class