Suppose you need to price all lines of an order using pl/sql script, you may use following script. Advantage of using OE_LINE_REPRICE.Reprice_Line procedure:
- You will have access to correct value of oe_order_pub.g_line.line_id in QP_CUSTOM.get_custom_price procedure
CREATE OR REPLACE PROCEDURE skm_reprice_lines ( p_header_id NUMBER ) IS l_line_rec OE_Order_Pub.Line_Rec_Type; l_return_status VARCHAR2(10); i NUMBER; l_msg_data VARCHAR2(250); CURSOR c_lines IS SELECT line_id FROM oe_order_lines_all WHERE header_id = p_header_id; BEGIN OE_DEBUG_PUB.debug_on(); OE_DEBUG_PUB.Start_ONT_Debugger('/home/users/smisra','skm1',null); DBMS_APPLICATION_INFO.set_client_info('1'); FOR l_line IN c_lines LOOP OE_Line_Util.Query_Row ( p_line_id => l_line.line_id , x_line_rec => l_line_rec ); DBMS_OUTPUT.put_line('Line Id:' || l_line_rec.line_id); DBMS_OUTPUT.put_line('ordered_item:' || l_line_rec.ordered_item); OE_LINE_REPRICE.Reprice_Line ( p_line_rec => l_line_rec , p_Repricing_date => 'SYSDATE' , p_Repricing_event => 'LINE' , p_Honor_Price_Flag => 'Y' , x_return_status => l_return_status ) ; END LOOP; DBMS_OUTPUT.put_line('Return Message:' || l_return_status); IF fnd_msg_pub.count_msg > 0 THEN FOR j in 1..FND_MSG_PUB.count_msg LOOP FND_MSG_PUB.get ( p_msg_index => j , p_encoded => 'F' , p_data => l_msg_data , p_msg_index_out => i ); dbms_output.put_line( 'Error: ' || j || ':' || l_msg_data); END LOOP; END IF; OE_DEBUG_PUB.debug_off(); END; /
References:
http://sanjaimisra.blogspot.com/2008/05/reprice-order-line.html
PROCEDURE reprice_order (p_in_header_id IN NUMBER) IS v_header_count NUMBER; v_header_list VARCHAR2 (32000); v_line_count NUMBER; v_line_list VARCHAR2 (32000); v_price_level VARCHAR2 (32000); v_return_status VARCHAR2 (32000); v_msg_count NUMBER; v_msg_data VARCHAR2 (32000); BEGIN v_header_count := 1; v_header_list := TO_CHAR (p_in_header_id); v_price_level := 'ORDER'; BEGIN oe_order_adj_pvt.price_action (p_header_count => v_header_count, p_header_list => v_header_list, p_line_count => v_line_count, p_line_list => v_line_list, p_price_level => v_price_level, x_return_status => v_return_status, x_msg_count => v_msg_count, x_msg_data => v_msg_data ); COMMIT; IF (v_return_status != fnd_api.g_ret_sts_success) THEN dbms_output.put_line(v_msg_data); END IF; EXCEPTION WHEN OTHERS THEN dbms_output.put_line(sqlerrm); END; EXCEPTION WHEN OTHERS THEN dbms_output.put_line(sqlerrm); END reprice_order;
References:
http://www.oracleappstoday.com/2014/08/api-to-reprice-order-total-in-oracle-r12.html