销售订单增强字段 bapi更新
如果增强字段在销售订单抬头(vbak)上,则要将增强字段一并append到如下四个表/结构中:
- VBAKKOZ
- VBAKKOZX
- BAPE_VBAK
- BAPE_VBAKX
在行项目(vbap)上:
- VBAPKOZ
- VBAPKOZX
- BAPE_VBAP
- BAPE_VBAPX
在运货计划行(VBEP)上:
- VBEPKOZ
- BEPKOZX
- BAPE_VBEP
- BAPE_VBEPX
下面介绍如何向bapi中extensionin参数赋值数据,具体代码如
* 接口调用日志
DATA: LT_LOG TYPE STANDARD TABLE OF ZZT_INFLOG,
LW_LOG TYPE ZZT_INFLOG. DATA: ORDER_HEADER_INX LIKE BAPISDH1X,
SCHEDULE_LINES LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE,
SCHEDULE_LINESX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE,
ORDER_ITEM_IN LIKE BAPISDITM OCCURS 0 WITH HEADER LINE,
ORDER_ITEM_INX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE,
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE. DATA: LWA_BAPE_VBAK TYPE BAPE_VBAK,
LWA_BAPE_VBAKX TYPE BAPE_VBAKX, LWA_BAPE_VBAP TYPE BAPE_VBAP,
LWA_BAPE_VBAPX TYPE BAPE_VBAPX, LWA_VALUEPART(240),
LIT_PAREX LIKE TABLE OF BAPIPAREX WITH HEADER LINE. DATA: BEGIN OF IT_TAB OCCURS 0,
VBELN TYPE VBELN,
POSNR TYPE POSNR,
ETENR TYPE ETENR,
LIFSP TYPE LIFSP_EP,
END OF IT_TAB. RANGES: R_VBELN FOR VBAP-VBELN,
R_POSNR FOR VBAP-POSNR. IF SALESDOCUMENT IS INITIAL.
E_STATU = 'E'.
E_MESS = '单号为空!'.
EXIT.
ENDIF. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = SALESDOCUMENT
IMPORTING
OUTPUT = SALESDOCUMENT. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = SALESPOSNR
IMPORTING
OUTPUT = SALESPOSNR. IF SALESDOCUMENT IS NOT INITIAL.
R_VBELN-SIGN = 'I'.
R_VBELN-OPTION = 'EQ'.
R_VBELN-LOW = SALESDOCUMENT.
APPEND R_VBELN.
ENDIF.
IF SALESPOSNR IS NOT INITIAL.
R_POSNR-SIGN = 'I'.
R_POSNR-OPTION = 'EQ'.
R_POSNR-LOW = SALESPOSNR.
APPEND R_POSNR.
ENDIF. ***获得计划行号
SELECT VBELN POSNR ETENR LIFSP
INTO TABLE IT_TAB
FROM VBEP
WHERE VBELN IN R_VBELN
AND POSNR IN R_POSNR
AND ETENR = '0001'. IF IT_TAB[] IS INITIAL.
E_STATU = 'E'.
E_MESS = '订单项的计划行数据不存在!'.
EXIT.
ENDIF. ORDER_HEADER_INX-UPDATEFLAG = 'U'. LOOP AT IT_TAB.
SCHEDULE_LINES-ITM_NUMBER = IT_TAB-POSNR.
SCHEDULE_LINES-SCHED_LINE = IT_TAB-ETENR.
SCHEDULE_LINES-REQ_DLV_BL = REQ_DLV_BL. " Q1/Q2
IF REQ_DATE IS NOT INITIAL.
SCHEDULE_LINES-REQ_DATE = REQ_DATE . "原始需求日期
ENDIF.
APPEND SCHEDULE_LINES. SCHEDULE_LINESX-UPDATEFLAG = 'U'.
SCHEDULE_LINESX-ITM_NUMBER = IT_TAB-POSNR.
SCHEDULE_LINESX-SCHED_LINE = IT_TAB-ETENR.
SCHEDULE_LINESX-REQ_DLV_BL = 'X'.
IF REQ_DATE IS NOT INITIAL.
SCHEDULE_LINESX-REQ_DATE = 'X'.
ENDIF.
APPEND SCHEDULE_LINESX. *&-->增强字段
IF FDATU IS NOT INITIAL OR IM_BHDAT IS NOT INITIAL OR IM_BHTIM IS NOT INITIAL. CLEAR: LWA_BAPE_VBAP,LIT_PAREX.
LWA_BAPE_VBAP-VBELN = IT_TAB-VBELN.
LWA_BAPE_VBAP-POSNR = IT_TAB-POSNR.
IF FDATU IS NOT INITIAL.
LWA_BAPE_VBAP-FDATU = FDATU .
ENDIF.
IF IM_BHDAT IS NOT INITIAL.
LWA_BAPE_VBAP-Q1Q2DAT = IM_BHDAT .
ENDIF.
IF IM_BHTIM IS NOT INITIAL.
LWA_BAPE_VBAP-Q1Q2TIM = IM_BHTIM .
ENDIF. LIT_PAREX-STRUCTURE = 'BAPE_VBAP'.
LIT_PAREX+30 = LWA_BAPE_VBAP.
APPEND LIT_PAREX. CLEAR: LWA_BAPE_VBAPX,LIT_PAREX.
LWA_BAPE_VBAPX-VBELN = IT_TAB-VBELN.
LWA_BAPE_VBAPX-POSNR = IT_TAB-POSNR.
IF FDATU IS NOT INITIAL.
LWA_BAPE_VBAPX-FDATU = 'X' .
ENDIF.
IF IM_BHDAT IS NOT INITIAL.
LWA_BAPE_VBAPX-Q1Q2DAT = 'X' .
ENDIF.
IF IM_BHTIM IS NOT INITIAL.
LWA_BAPE_VBAPX-Q1Q2TIM = 'X' .
ENDIF. LIT_PAREX-STRUCTURE = 'BAPE_VBAPX'.
LIT_PAREX+30 = LWA_BAPE_VBAPX.
APPEND LIT_PAREX. ENDIF. *&-->日志
CLEAR: LW_LOG.
LW_LOG-INTTY = 'A1'.
LW_LOG-DIRECT = '2'.
LW_LOG-INFTX = '订单计划行标记,以及备货日期更新'.
LW_LOG-CAFUN = 'ZRFC_SO_CHANGE'. "调用函数
LW_LOG-IKEY1 = REQ_DLV_BL.
LW_LOG-IKEY2 = REQ_DATE.
LW_LOG-IKEY3 = IM_BHDAT.
LW_LOG-IKEY3 = FDATU.
CONCATENATE ZAUTL IM_ZXQBL INTO LW_LOG-LOGTX.
APPEND LW_LOG TO LT_LOG. *&-->行项目
CLEAR: ORDER_ITEM_IN,ORDER_ITEM_INX.
ORDER_ITEM_IN-ITM_NUMBER = IT_TAB-POSNR.
APPEND ORDER_ITEM_IN.
ORDER_ITEM_INX-ITM_NUMBER = IT_TAB-POSNR.
ORDER_ITEM_INX-UPDATEFLAG = 'U'.
APPEND ORDER_ITEM_INX. ENDLOOP. *&-->增强字段 抬头数据
IF ZAUTL IS NOT INITIAL OR IM_ZXQBL IS NOT INITIAL.
CLEAR:LWA_BAPE_VBAK,LWA_BAPE_VBAKX,LWA_VALUEPART.
LWA_BAPE_VBAK-VBELN = SALESDOCUMENT. IF ZAUTL IS NOT INITIAL.
LWA_BAPE_VBAK-ZAUTL = ZAUTL. "分批标记
ENDIF.
IF IM_ZXQBL IS NOT INITIAL.
LWA_BAPE_VBAK-ZXQBL = IM_ZXQBL. "保持原始需求标记
ENDIF.
* lwa_valuepart = lwa_bape_vbak.
LIT_PAREX-STRUCTURE = 'BAPE_VBAK'.
LIT_PAREX+30 = LWA_BAPE_VBAK.
APPEND LIT_PAREX. CLEAR:LWA_BAPE_VBAK,LWA_VALUEPART.
LWA_BAPE_VBAKX
-VBELN = SALESDOCUMENT. IF ZAUTL IS NOT INITIAL.
LWA_BAPE_VBAKX
-ZAUTL = 'X'. "分批标记
ENDIF.
IF IM_ZXQBL IS NOT INITIAL.
LWA_BAPE_VBAKX
-ZXQBL = 'X'. "保持原始需求标记
ENDIF.
* lwa_valuepart = lwa_bape_vbakx.
LIT_PAREX
-STRUCTURE = 'BAPE_VBAKX'.
LIT_PAREX+30
= LWA_BAPE_VBAKX.
APPEND LIT_PAREX. CLEAR:LWA_BAPE_VBAKX,LWA_VALUEPART. ENDIF. CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT
= SALESDOCUMENT
ORDER_HEADER_INX
= ORDER_HEADER_INX
TABLES
RETURN = RETURN
ORDER_ITEM_IN
= ORDER_ITEM_IN
ORDER_ITEM_INX
= ORDER_ITEM_INX
SCHEDULE_LINES
= SCHEDULE_LINES
SCHEDULE_LINESX
= SCHEDULE_LINESX
EXTENSIONIN
= LIT_PAREX[]. READ TABLE RETURN WITH KEY TYPE = 'E'.
IF SY-SUBRC <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'. E_STATU = 'S'.
E_MESS
= '更新成功!'. "保存日期
IF LT_LOG[] IS NOT INITIAL.
CALL FUNCTION 'ZF_SAVE_LOG'
TABLES
IT_LOG
= LT_LOG.
IF SY-SUBRC EQ 0.
COMMIT WORK.
ENDIF.
ENDIF. ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
E_STATU
= 'E'.
E_MESS
= RETURN-MESSAGE.
CLEAR: LT_LOG[].
ENDIF. CLEAR: SALESDOCUMENT,
ORDER_HEADER_INX
,
RETURN[]
,
SCHEDULE_LINES[]
,
SCHEDULE_LINESX[]
. ENDFUNCTION.
销售订单增强字段 bapi更新的更多相关文章
- SAP销售订单屏幕字段控制隐藏,必输等
1.T-CODE:shd0 创建变式 , 点击确认按钮后,SAP进入下一个屏幕,然后重复上面的操作,直到所有屏幕已完成设置. 如果后续屏幕不需要设置,可点击“退出并保存”按钮.保存后,进入下图所示页 ...
- SAP MM 销售订单库存与普通库存之间相互转换过账后对于EBEWH以及MBEWH表的更新
SAP MM 销售订单库存与普通库存之间相互转换过账后对于EBEWH以及MBEWH表的更新 1,DEMO数据 物料号:1300009995 工厂:2160 销售订单号/item号:0010097627 ...
- 如何用代码填充S/4HANA销售订单行项目的数量字段
我的任务是用代码生成S/4HANA销售订单(Sales Order)的行项目,并且填充对应的quantity(数量)值. 最开始我用了下面的代码,把quantity的值写入item字段target_q ...
- 销售订单、外向交货单、交货 bapi
转自[http://www.cnblogs.com/elegantok/archive/2009/10/18/1585398.html]***********SALES ORDER INPUT CRE ...
- 【ABAP系列】SAP 销售订单的行项目里条件的增强
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP 销售订单的行项目里条件的 ...
- 【ABAP系列】SAP VA02修改销售订单的BAPI举例
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP VA02修改销售订单的B ...
- SAP四代增强实现:销售订单复制项目文本时不需要显示文本框和回车
最近接收到一个业务需求,在SAP依据销售订单复制时,如果订单里面的项目有多个文本,系统就会显示复制的文本框处理,让用户选择是否复制,这个就让销售很不舒服,如果有几十个项目,每个项目有几个文本,那就就要 ...
- VA01销售订单批导问题解决
1业务场景 事务代码:VA01创建销售订单,VA02修改销售订单 可以通过BAPI_SALESORDER_CREATEFROMDAT2批量创建 可以通过BAPI_SALESORDER_CHANGE批量 ...
- 销售订单(SO)-API-更新销售订单
更新销售订单和创建销售订单差不多,调用的API相同,只是传入的时候标识不一样:operation := oe_globals.g_opr_update 示例代码如下: PROCEDURE update ...
随机推荐
- SVN MERGE 方法(原创)
SNV merge操作 1. 创建分支 A
- Geographical distance
Introduction Calculating the distance between geographical coordinates is based on some level of abs ...
- .NET Core R2安装及示例教程
.NET Core R2安装及示例教程 Install for Windows - Visual Studio 2015 1 Download Visual Studio 2015 Make sure ...
- CentOS---网络配置具体解释
一.配置文件具体解释 在RHEL或者CentOS等Redhat系的Linux系统里.跟网络有关的主要设置文件例如以下: /etc/host.conf 配置域名服务client的控制文件 ...
- UVA - 10895 Matrix Transpose
UVA - 10895 Matrix Transpose Time Limit:3000MS Memory Limit:Unknown 64bit IO Format:%lld & % ...
- android中使用百度定位sdk实时的计算移动距离
; //5秒刷新一次 private Handler refreshHandler = new Handler(){ //刷新界面的Handler public void handleMessag ...
- ReactiveCocoa入门教程——第一部分【转载】
作为一个iOS开发者,你写的每一行代码几乎都是在响应某个事件,例如按钮的点击,收到网络消息,属性的变化(通过KVO)或者用户位置的变化(通过CoreLocation).但是这些事件都用不同的方式来处理 ...
- spring中bean的作用域属性single与prototype的区别
https://blog.csdn.net/linwei_1029/article/details/18408363
- 【selenium+python】自动化测试目录与文件结构
一.首先,看一下完整的项目目录结构图,如下: ==================目录结构================== ==================目录结构============== ...
- python 基础 9.0 安装MySQL-python-1.2.5客户端
一. 安装客户端 python 标准数据库接口为Python DB-API,Python DB-API 为开发人员提供了数据应用编程接口.参考地址:https://wiki.python.or ...