修改合同号的bapi
这个例子是在合同号中新增项目号:
1、先要读取该合同号的信息用一个BAPI
BAPI_CONTRACT_GETDETAIL
2、调用修改合同号的BAPI。
代码如下:
REPORT ztest_class.
DATA: lv_docnumber TYPE bapimeoutheader-number,
lt_item_condition TYPE TABLE OF bapimeoutcondition,
lt_item_conditionc TYPE TABLE OF bapimeoutcondition,
ls_item_condition TYPE bapimeoutcondition,
ls_item_conditionc TYPE bapimeoutcondition. DATA: lt_cond_validity TYPE TABLE OF bapimeoutvalidity,
lt_cond_validityc TYPE TABLE OF bapimeoutvalidity,
ls_cond_validity TYPE bapimeoutvalidity. DATA: lt_cond_validityx TYPE TABLE OF bapimeoutvalidityx,
ls_cond_validityx TYPE bapimeoutvalidityx. DATA: lt_item_conditionx TYPE TABLE OF bapimeoutconditionx,
ls_item_conditionx TYPE bapimeoutconditionx. DATA: lt_ctr_item TYPE TABLE OF bapimeoutitem,
lt_ctr_itemc TYPE TABLE OF bapimeoutitem,
ls_ctr_item TYPE bapimeoutitem. DATA: lt_ctr_itemx TYPE TABLE OF bapimeoutitemx,
ls_ctr_itemx TYPE bapimeoutitemx. DATA: lt_returnt TYPE TABLE OF bapiret2,
ls_returnt TYPE bapiret2. *DATA: ls_upload LIKE LINE OF gt_upload. DATA: lv_has_error TYPE xfeld. CALL FUNCTION 'BAPI_CONTRACT_GETDETAIL'
EXPORTING
purchasingdocument = lv_docnumber
item_data = 'X'
* ACCOUNT_DATA = ' '
condition_data = 'X'
* TEXT_DATA = ' '
* PARTNER_DATA = ' '
* RELEASE_DATA = ' '
* IMPORTING
* HEADER =
TABLES
item = lt_ctr_item
* ACCOUNT =
* DELIVERY_ADDRESS =
item_cond_validity = lt_cond_validity
item_condition = lt_item_condition
* ITEM_COND_SCALE_VALUE =
* ITEM_COND_SCALE_QUAN =
* ITEM_TEXT =
* HEADER_TEXT =
* HEAD_COND_VALIDITY =
* HEAD_CONDITION =
* HEAD_COND_SCALE_VAL =
* HEAD_COND_SCALE_QUAN =
* PARTNER =
* RELEASE_DOCU =
* EXTENSIONOUT =
* RETURN =
. " 设置要更新的字段
" 行项目
LOOP AT lt_ctr_item INTO ls_ctr_item.
APPEND ls_ctr_item TO lt_ctr_itemc. CLEAR ls_ctr_itemx.
ls_ctr_itemx-item_no = ls_ctr_item-item_no.
APPEND ls_ctr_itemx TO lt_ctr_itemx. CLEAR ls_ctr_item.
ENDLOOP. " 条件日期
LOOP AT lt_cond_validity INTO ls_cond_validity.
APPEND ls_cond_validity TO lt_cond_validityc. CLEAR ls_cond_validityx.
ls_cond_validityx-item_no = ls_cond_validity-item_no.
ls_cond_validityx-serial_id = ls_cond_validity-serial_id.
APPEND ls_cond_validityx TO lt_cond_validityx. CLEAR ls_cond_validity.
ENDLOOP. " 项目条件
LOOP AT lt_item_condition INTO ls_item_condition. CLEAR ls_item_conditionc.
MOVE-CORRESPONDING ls_item_condition TO ls_item_conditionc. CLEAR ls_item_conditionx.
ls_item_conditionx-item_no = ls_item_condition-item_no.
ls_item_conditionx-serial_id = ls_item_condition-serial_id.
ls_item_conditionx-cond_count = ls_item_condition-cond_count. * IF ls_item_condition-cond_type EQ 'PB00' AND ls_item_condition-deletion_ind EQ ''.
* READ TABLE gt_upload INTO ls_upload
* WITH KEY ebelp = ls_item_condition-item_no.
* IF sy-subrc EQ 0 AND ls_item_condition-cond_unit NE ls_upload-bprme.
* ls_item_conditionc-cond_unit = ls_upload-bprme.
* ls_item_conditionc-change_id = 'U'.
*
* ls_item_conditionx-cond_unit = 'X'.
* ENDIF.
* ENDIF.
ls_item_conditionc-change_id = 'I'.
APPEND ls_item_conditionc TO lt_item_conditionc.
ls_item_conditionx-cond_unit = 'X'.
APPEND ls_item_conditionx TO lt_item_conditionx. CLEAR ls_item_condition.
ENDLOOP. " 修改合同
CALL FUNCTION 'BAPI_CONTRACT_CHANGE'
EXPORTING
purchasingdocument = lv_docnumber
* HEADER =
* HEADERX =
* VENDOR_ADDRESS =
* TESTRUN =
* TECHNICAL_DATA =
* IMPORTING
* EXP_HEADER =
TABLES
item = lt_ctr_itemc
itemx = lt_ctr_itemx
* ACCOUNT =
* ACCOUNTPROFITSEGMENT =
* ACCOUNTX =
* DELIVERY_ADDRESS =
item_cond_validity = lt_cond_validityc
item_cond_validityx = lt_cond_validityx
item_condition = lt_item_conditionc
item_conditionx = lt_item_conditionx
* ITEM_COND_SCALE_VALUE =
* ITEM_COND_SCALE_QUAN =
* ITEM_TEXT =
* HEADER_TEXT =
* HEAD_COND_VALIDITY =
* HEAD_COND_VALIDITYX =
* HEAD_CONDITION =
* HEAD_CONDITIONX =
* HEAD_COND_SCALE_VAL =
* HEAD_COND_SCALE_QUAN =
* PARTNER =
* PARTNERX =
* RELEASE_DOCU =
* EXTENSIONIN =
* EXTENSIONOUT =
return = lt_returnt
. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ls_returnt.
修改合同号的bapi的更多相关文章
- abap 常用 function
ABAP常用函数总结 alv .smartform. excel .text.邮件 .远程访问,FTP服务器... **********常用功能function REUSE_ALV_GRID_DI ...
- 使用BAPI批量修改采购信息记录的税率
业务方面提出需求:由于国家税率从5月份开始16%更改为13%.要求开发一个批量修改采购信息记录税率的功能. 税代码就是税率,J2代表13% 这个需求在ME13里面就可以单个修改,所以可以用BDC,但后 ...
- 【ABAP系列】SAP VA02修改销售订单的BAPI举例
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP VA02修改销售订单的B ...
- 如何利用BAPI SD_SALESDOCUMENT_CHANGE修改Sales Order的字段
假设我想修改S/4HANA里Sales Order抬头的Service Date字段SERV_DATE: 首先从数据库表VBKD里查找到SERV_DATE修改之前的值为2020年1月1日 使用如下代码 ...
- BAPI
MM模块 1. BAPI_MATERIAL_SAVEDATA 创建物料主数据 注意参数EXTENSIONIN的使用,可以创建自定义字段 例如:WA_BAPI_TE_MARA-MATERIAL = IT ...
- SAP 各模块常用的BAPI
MM模块 1. BAPI_MATERIAL_SAVEDATA 创建物料主数据 注意参数EXTENSIONIN的使用,可以创建自定义字段 例如:WA_BAPI_TE_MARA-MATERIAL = IT ...
- ABAP 生产订单的创建与修改函数
ABAP 生产订单的创建与修改函数转自http://www.cnblogs.com/aBaoRong/archive/2012/04/11/2441946.html 如果生产订单过多,可以批量创建 ...
- 业务对象和BAPI
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- [SAP ABAP开发技术总结]BAPI调用
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
随机推荐
- 嵌入式:nfs挂载开发板的几个陷阱
1. host没有设置好,这个比较容易排查到. 开启portmap帮助网络应用程序找到正确的通讯端口: 开启nfs-kernel-server服务: 开启设置要export出去的服务目录. sudo ...
- poemel 端口作用
clientPort 用于connetor组件启动时候,监听的调用,用于客户端连接 port用于服务器间通信,即rpc调用时候使用,在remote组件启动时候,生成remote,即gateway实例, ...
- 使用sqlite保存数据返回主键
/// <summary> /// 返回insert后的主键值 /// </summary> /// <param name="SQLString"& ...
- Qt 操作 pdf 文件
写了好久的东西,不小心按了下返回键就没了.CSDN居然没自动保存,坑爹啊 原本还有很多信息的,现在直入正题吧. QT没有内置PDF操作的功能(其实有一个,QPrinter,不过只能写不能读,基本是半残 ...
- 基于visual Studio2013解决算法导论之050强连通分支
题目 强连通分支 解决代码及点评 // 强连通分支.cpp : 定义控制台应用程序的入口点. // #include<iostream> #define MAX 100 using ...
- C语言,链表反转
倒序思路:依次把后面的节点移往头部. struct Node{ struct Node* next; int data; }; typedef struct Node NODE; NODE* inve ...
- BZOJ 2073: [POI2004]PRZ( 状压dp )
早上这道题没调完就去玩NOI网络同步赛了.... 状压dp , dp( s ) 表示 s 状态下所用的最短时间 , 转移就直接暴力枚举子集 . 可以先预处理出每个状态下的重量和时间的信息 . 复杂度是 ...
- ant 关键字和关键语句
学习ant推荐的两个blog http://www.cnblogs.com/huozhicheng/archive/2010/04/08/2533199.htmlhttp://www.cnblogs. ...
- Oracle时间戳
查询某一具体时间某张表的数据,可以用时间戳进行查询. 例如: SELECT * FROM sac14 AS OF TIMESTAMP to_date('201508310930','yyyymmddh ...
- duilib之源码分析
<duilib之源码分析>1 stdAfx.h * lengthof(x) 计算数组长度宏 * MAX 两值最大 * MIN 两值最小 * CLAMP(x,a,b) x在a,b之间则取 ...