转:使用脚本关闭订单头

本文详细介绍了在订单行工作流结束后,如何通过手动运行WorkflowBackgroundProcess或使用脚本来关闭订单头的方法。提供了两个脚本示例,一个适用于存在订单头部工作流的情况,另一个则用于不存在订单头部工作流的场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

订单的关闭是自动的,在所有行工作流结束(Close或者Cancel)后0.5天,订单头也将在Workflow Background Process的推动下关闭。

还有另外一种说法:you can wait until month-end and the “Order Flow – Generic” workflow will close it for you.

所以造成了很多时候订单行已经关闭了,但订单头还是处于Booked状态,这个时候如果你想Close订单头,你可以手动运行Workflow Background Process来关闭订单,也可以使用脚本来close Order Header.

脚本一:

begin  
fnd_global.apps_initialize(:USER_ID, :RESP_ID, :RESP_APPL_ID);  
end;  
/  
  
/*If Work Flow exist for Order header then use the script below. This will close the Order  
After running this script run "Workflow Background Process" */  
begin  
wf_engine.completeactivity  
(  
'OEOH', --item_type  
'9999999', --item_key = header_id .... pass the HEADER_ID of the order you want to close  
'CLOSE_WAIT_FOR_L', -- apps.wf_process_activities.activity_name where instance_id= apps.wf_item_activity_statuses.process_activity  
null  
);  
end;  
/  
Commit;  
  
====================  
/*If Work Flow does NOT exist for Order then use the script below .  
After running this script run "Workflow Background Process" */  
  
declare  
l_return_status VARCHAR2(240);  
l_msg_count NUMBER;  
l_msg_data VARCHAR2(240);  
l_header_id NUMBER := 99999999; --pass the HEADER_ID of the order you want to close  
begin  
OE_ORDER_CLOSE_UTIL.Close_Order  
( p_api_version_number => 1.0  
, p_header_id => l_header_id  
, x_return_status => l_return_status  
, x_msg_count => l_msg_count  
, x_msg_data => l_msg_data  
);  
dbms_output.put_line('status = ' l_return_status);  
end;  
/  
Commit;  
  
/* After running this script run "Workflow Background Process" */  
**********************************************************************  
**********************************************************************  

 

脚本二:你要确保订单行都被关闭了的情况用这个脚本

Select HEADER_ID, OPEN_FLAG, FLOW_STATUS_CODE  
from apps.oe_order_lines_all  
where org_id=:org_id and header_id =:HEADER_ID; --pass the ORG_ID and HEADER_ID of the order you want to close  
  
update apps.oe_order_headers_all  
set open_flag = 'N' , FLOW_STATUS_CODE= 'CLOSED'  
where org_id=:org_id and header_id =:HEADER_ID; --pass the ORG_ID and HEADER_ID of the order you want to close  
  
Commit;  

 

转载于:https://www.cnblogs.com/toowang/p/3665624.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值