公司的业务需要在发运之前对销售订单行上的计算价格标志进行更新,对于已冻结的更新为计算价格。浏览了一下一些他人的范例,包括oracle提供的示例。照搬过来,写了一个,然后测试运行,返回结果更新成功,很欣慰。结果前台一查,并没有进行更新。找了一堆的资料无果,最后看到一篇“r12中
Declare
l_header_rec Oe_Order_Pub.header_rec_type;
l_line_tbl Oe_Order_Pub.line_tbl_type;
l_line_tb2 Oe_Order_Pub.line_tbl_type;
l_action_request_tbl Oe_Order_Pub.request_tbl_type;
l_return_status VARCHAR2(1000);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
v_line_number VARCHAR2(1000);
l_index varchar2(1000);
x_header_val_rec Oe_Order_Pub.header_val_rec_type;
x_header_adj_tbl Oe_Order_Pub.header_adj_tbl_type;
x_header_adj_val_tbl Oe_Order_Pub.header_adj_val_tbl_type;
x_header_price_att_tbl Oe_Order_Pub.header_price_att_tbl_type;
x_header_adj_att_tbl Oe_Order_Pub.header_adj_att_tbl_type;
x_header_adj_assoc_tbl Oe_Order_Pub.header_adj_assoc_tbl_type;
x_header_scredit_tbl Oe_Order_Pub.header_scredit_tbl_type;
x_header_scredit_val_tbl Oe_Order_Pub.header_scredit_val_tbl_type;
x_line_val_tbl Oe_Order_Pub.line_val_tbl_type;
x_line_adj_tbl Oe_Order_Pub.line_adj_tbl_type;
x_line_adj_val_tbl Oe_Order_Pub.line_adj_val_tbl_type;
x_line_price_att_tbl Oe_Order_Pub.line_price_att_tbl_type;
x_line_adj_att_tbl Oe_Order_Pub.line_adj_att_tbl_type;
x_line_adj_assoc_tbl Oe_Order_Pub.line_adj_assoc_tbl_type;
x_line_scredit_tbl Oe_Order_Pub.line_scredit_tbl_type;
x_line_scredit_val_tbl Oe_Order_Pub.line_scredit_val_tbl_type;
x_lot_serial_tbl Oe_Order_Pub.lot_serial_tbl_type;
x_lot_serial_val_tbl Oe_Order_Pub.lot_serial_val_tbl_type;
Begin
fnd_global.apps_initialize(user_id => /*l_user_id*/ 1382,
resp_id => /*l_resp_id*/ 51448,
resp_appl_id => /*l_RESP_APPL_ID*/ 660);
mo_global.init('ONT'); --r12的安全机制,必须初始化否则报错
Oe_Msg_Pub.initialize;
Oe_Debug_Pub.initialize;
Oe_Debug_Pub.debug_on;
Oe_Debug_Pub.setdebuglevel(5);
mo_global.set_policy_context('S', 1497);--貌似也不需要
l_header_rec := Oe_Order_Pub.g_miss_header_rec; 不需要
l_header_rec.header_id := 754633;
l_header_rec.operation := Oe_Globals.G_OPR_UPDATE;
l_line_tbl(1) := Oe_Order_Pub.g_miss_line_rec;
l_line_tbl(1).line_id := 367819;
l_line_tbl(1).operation := Oe_Globals.G_OPR_UPDATE;
l_line_tbl(1).calculate_price_flag := 'Y';
dbms_output.put_line('l_line_tbl:' || l_line_tbl(1).open_flag);
Oe_Order_Pub.process_order(p_api_version_number => 1.0,
p_init_msg_list => Fnd_Api.g_false,
p_return_values => Fnd_Api.g_false,
p_action_commit => Fnd_Api.g_false,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_header_rec => l_header_rec,
p_line_tbl => l_line_tbl,--就是这里
p_action_request_tbl => l_action_request_tbl,
x_header_rec => l_header_rec,
x_header_val_rec => x_header_val_rec,
x_header_adj_tbl => x_header_adj_tbl,
x_header_adj_val_tbl => x_header_adj_val_tbl,
x_header_price_att_tbl => x_header_price_att_tbl,
x_header_adj_att_tbl => x_header_adj_att_tbl,
x_header_adj_assoc_tbl => x_header_adj_assoc_tbl,
x_header_scredit_tbl => x_header_scredit_tbl,
x_header_scredit_val_tbl => x_header_scredit_val_tbl,
x_line_tbl => l_line_tb2, --r11中这里跟p_line_tbl是一样的
x_line_val_tbl => x_line_val_tbl,
x_line_adj_tbl => x_line_adj_tbl,
x_line_adj_val_tbl => x_line_adj_val_tbl,
x_line_price_att_tbl => x_line_price_att_tbl,
x_line_adj_att_tbl => x_line_adj_att_tbl,
x_line_adj_assoc_tbl => x_line_adj_assoc_tbl,
x_line_scredit_tbl => x_line_scredit_tbl,
x_line_scredit_val_tbl => x_line_scredit_val_tbl,
x_lot_serial_tbl => x_lot_serial_tbl,
x_lot_serial_val_tbl => x_lot_serial_val_tbl,
x_action_request_tbl => l_action_request_tbl);
dbms_output.put_line('l_index:' || l_index || 'l_msg_data1:' ||
l_msg_data);
IF l_msg_count > 0 THEN
FOR l_index IN 1 .. l_msg_count LOOP
l_msg_data := Oe_Msg_Pub.get(p_msg_index => l_index, p_encoded => 'F');
END LOOP;
END IF;
dbms_output.put_line('l_index:' || l_index || 'l_msg_data:' ||
l_msg_data);
IF l_return_status = Fnd_Api.g_ret_sts_success Then
dbms_output.put_line('OK');
commit;
ELSE
dbms_output.put_line('Failed');
rollback;
END IF;
commit;
end;