系统版本
:
RDBMS : 9.2.0.6.0
RDBMS : 9.2.0.6.0
Oracle应用产品 : 11.5.10.2
由于失效成品编码时,系统提示如下:
该提示有二种情况:
1.检查发现该成品的销售订单行状态一直是”等待发运“。汗!!!!!!!!!!!有三年以上的销售订单没有发运一直不取消。难怪不能失效。通过如下sql
2.虽然该成品编码的销售订单行全部关闭状态,但是由于销售题头流程问题导致销售订单题头状态未关闭,同样也会提示。
检查发现2018年以前有4K多行”等待发运“的订单行,如此多销售订单行没有取消,现在手工取消不现实呀。只能用系统的API来取消。查看系统标准的Form源代码,主要调用API包如:oe_oe_form_cancel_line.Process_cancel_quantity
@H_301_36@Declare l_return_status Varchar2(30) := null; l_msg_count number := 0; l_msg_data varchar2(2000) := null; l_mc_err_handling_flag NUMBER := Null; ---取消类型:F表示完全取消,P表示部分取消。当为部分取消时,取消数量不能为空 l_cancel_type varchar2(2) := 'F'; --l_cancelation_reason_code varchar2(30) := name_in('audit_qty.reasons_code'); l_LineCount Number := 1; --取消记录条数 --取消订单行OE_ORDER_LINES_ALL.Line_Id 使用逗号隔分开,LINE_ID可以是来自不同销售订单 l_LineList varchar2(32000) := '320564,12432324'; --取消数量 l_cancel_quantity Number; --取消备注 l_Comments Varchar2(200) := '20180414批量取消操作'; --取原因代码 l_ReasonsCode Number := 1; l_error_count number; l_UserId Number := 1110; l_RespId Number := 50247; l_RespApplId Number := 660; l_msg_index_out NUMBER(10); Begin --初始化 fnd_global.apps_initialize(user_id => l_UserId,resp_id => 50247,resp_appl_id => l_RespApplId); --调用API oe_oe_form_cancel_line.Process_cancel_quantity(p_num_of_records => l_LineCount,--oe_cancel_lines.g_line_count,p_record_ids => l_LineList,--oe_cancel_lines.g_line_list,p_cancel_to_quantity => l_cancel_quantity,p_cancellation_comments => l_Comments,--Name_in('audit_qty.comments'),p_reason_code => l_ReasonsCode,--l_cancelation_reason_code,p_cancellation_type => l_cancel_type,p_mc_err_handling_flag => l_mc_err_handling_flag,x_msg_count => l_msg_count,x_msg_data => l_msg_data,x_return_status => l_return_status,x_error_count => l_error_count); if l_return_status <> 'S' then FOR i IN 1 .. l_msg_count LOOP Oe_Msg_Pub.get(p_msg_index => i,p_encoded => Fnd_Api.G_FALSE,p_data => l_msg_data,p_msg_index_out => l_msg_index_out); DBMS_OUTPUT.put_line('message is:' || l_msg_data || ',' || 'message index is:' || l_msg_index_out); END LOOP; Rollback; else commit; end if; End;