1, 场景介绍
调用bapi BAPI_PRODORD_CHANGE 更新生产订单排产日期,单独更新生产订单没有问题,但是有时批量更新多个生产订单时会dump。
相关代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
lwa_order-basic_start_date = lwa_item-start_date.
lwa_order-basic_start_time = l_begin_time_leading_order.
lwa_order-basic_end_date = lwa_item-start_date.
lwa_order-basic_end_time = l_begin_time_leading_order.
lwa_orderx-basic_start_date = 'X'.
lwa_orderx-basic_end_date = 'X'.
CALL FUNCTION 'BAPI_PRODORD_CHANGE'
EXPORTING
number = lwa_item-aufnr
orderdata = lwa_order
orderdatax = lwa_orderx
IMPORTING
return = lwa_ret2.
* ORDER_TYPE =
* ORDER_STATUS =
* MASTER_DATA_READ =
|
dump信息:
COMMIT WORK processing cannot be interrupted.
Error in the ABAP Application Program
The current ABAP program "SAPLCOZV" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
The following are executed during the COMMIT WORK statement - the
routines registered for this with the PERFORM .. ON COMMIT statement, -
the methods registered for the events in the object services and
possibly also local updating (SET UPDATE TASK LOCAL).
An exception has occurred and has been caught. This causes the normal
sequence of the routine to be interrupted, with the result that the
program is continues before the COMMIT WORK call. As this can cause
inconsistencies, normal processing cannot be continued.
ST22截图
2, 原因分析
首先查看了 bapi BAPI_PRODORD_CHANGE 的文档,SE37
看了之后发现 ‘ you must not execute a COMMIT WORK again.’ 就是说这个bapi 已经在bapi内commit过了,不能再次commit,排除多次commit的情况(可以设置一个statement的断点,在所有commit work 和 commit work and wait的语句停),只有从master data和customizing setting着手调查,
结果发现,当bapi BAPI_PRODORD_CHANGE 修改基于相同销售订单的生产订单时,就会dump,
如下:
CO03,查看pp order,发现102622719和102622728都是基于SO 690000039 行项目200的,这个会导致dump。
其他需要注意的是:调用这个bapi时,pp order的出口中不仅不能有commit work,rollback也不能有,需要排查各个出口。
以上。