Please use this Script Carefully as the API updates the values to the base tables.
DECLARE
l_input_details oks_qp_pkg.input_details;
l_output_details oks_qp_pkg.price_details;
l_modif_details qp_preq_grp.line_detail_tbl_type;
l_pb_details oks_qp_pkg.g_price_break_tbl_type;
l_return_status VARCHAR2(20);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_status_tbl oks_qp_int_pvt.pricing_status_tbl;
l_final_status_tbl oks_qp_int_pvt.pricing_status_tbl;
l_count NUMBER;
l_msg_index_out NUMBER;
l_num NUMBER;
l_error_message VARCHAR2(2000);
BEGIN
l_num := 10;
l_input_details.intent := 'SP';
-- l_input_details.lse_id := 1;
-- l_input_details.chr_id := 1549063;
-- l_input_details.line_id := 364326736554344799961890872824534166768;
l_input_details.subline_id := 364326736554364142775004706891329465584; --364326736554353262442628175228757110000;
l_num := 20;
oks_qp_int_pvt.compute_price(p_api_version => 1.0
, p_init_msg_list => 'T'
, p_detail_rec => l_input_details
, x_price_details => l_output_details
, x_modifier_details => l_modif_details
, x_price_break_details => l_pb_details
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data
);
l_num := 30;
IF l_return_status <> fnd_api.g_ret_sts_success
THEN
l_num := 40;
IF l_msg_count > 0
THEN
FOR i IN 1 .. l_msg_count
LOOP
l_num := 50;
apps.fnd_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);
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR(l_msg_data, 1, 250);
ELSE
l_error_message := l_error_message || ' /' || SUBSTR(l_msg_data, 1, 250);
END IF;
END LOOP;
DBMS_OUTPUT.put_line('*****************************************');
DBMS_OUTPUT.put_line('API Error : ' || l_error_message);
DBMS_OUTPUT.put_line('*****************************************');
ELSE
apps.fnd_msg_pub.get(p_msg_index => 1, p_encoded => fnd_api.g_false, p_data => l_msg_data
, p_msg_index_out => l_msg_index_out);
DBMS_OUTPUT.put_line('*****************************************');
DBMS_OUTPUT.put_line('API Error : ' || l_msg_data);
DBMS_OUTPUT.put_line('*****************************************');
END IF;
ELSE
l_num := 60;
DBMS_OUTPUT.put_line('API Success');
DBMS_OUTPUT.put_line('Product Quantity : ' || l_output_details.prod_qty);
DBMS_OUTPUT.put_line('Product Quantity UOM : ' || l_output_details.prod_qty_uom);
DBMS_OUTPUT.put_line('Service Quantity : ' || l_output_details.serv_qty);
DBMS_OUTPUT.put_line('Service Quantity UOM : ' || l_output_details.serv_qty_uom);
DBMS_OUTPUT.put_line('Product Price List Id : ' || l_output_details.prod_price_list_id);
DBMS_OUTPUT.put_line('Service Price List Id : ' || l_output_details.serv_price_list_id);
DBMS_OUTPUT.put_line('Product Price List Line Id : ' || l_output_details.prod_price_list_line_id);
DBMS_OUTPUT.put_line('Service Price List Line Id : ' || l_output_details.serv_price_list_line_id);
DBMS_OUTPUT.put_line('Product List Unit Price : ' || l_output_details.prod_list_unit_price);
DBMS_OUTPUT.put_line('Service List Unit Price : ' || l_output_details.serv_list_unit_price);
DBMS_OUTPUT.put_line('Product Adjustment Unit Price : ' || l_output_details.prod_adj_unit_price);
DBMS_OUTPUT.put_line('Service Adjustment Unit Price : ' || l_output_details.serv_adj_unit_price);
DBMS_OUTPUT.put_line('Product Priced Quantity : ' || l_output_details.prod_priced_qty);
DBMS_OUTPUT.put_line('Product Priced UOM : ' || l_output_details.prod_priced_uom);
DBMS_OUTPUT.put_line('Product Extension Amount : ' || l_output_details.prod_ext_amount);
DBMS_OUTPUT.put_line('Service Priced Quantity : ' || l_output_details.serv_priced_qty);
DBMS_OUTPUT.put_line('Service Priced UOM : ' || l_output_details.serv_priced_uom);
DBMS_OUTPUT.put_line('Service Extended Amount : ' || l_output_details.serv_ext_amount);
DBMS_OUTPUT.put_line('Service OPerand : ' || l_output_details.serv_operand);
DBMS_OUTPUT.put_line('Service Operator : ' || l_output_details.serv_operator);
DBMS_OUTPUT.put_line('Status Code : ' || l_output_details.status_code);
DBMS_OUTPUT.put_line('Status Text : ' || l_output_details.status_text);
IF l_modif_details.COUNT > 0
THEN
l_num := 70;
FOR i IN l_modif_details.FIRST .. l_modif_details.LAST
LOOP
l_num := 80;
DBMS_OUTPUT.put_line('List Price : ' || l_modif_details(i).list_price);
END LOOP;
END IF;
l_num := 90;
IF l_pb_details.COUNT > 0
THEN
l_num := 100;
FOR i IN l_pb_details.FIRST .. l_pb_details.LAST
LOOP
l_num := 110;
DBMS_OUTPUT.put_line('Price Break List Price : ' || l_pb_details(i).list_price);
END LOOP;
END IF;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line(l_num || ' Unexpected Error : ' || SUBSTR(SQLERRM, 1, 250));
END;
DECLARE
l_input_details oks_qp_pkg.input_details;
l_output_details oks_qp_pkg.price_details;
l_modif_details qp_preq_grp.line_detail_tbl_type;
l_pb_details oks_qp_pkg.g_price_break_tbl_type;
l_return_status VARCHAR2(20);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_status_tbl oks_qp_int_pvt.pricing_status_tbl;
l_final_status_tbl oks_qp_int_pvt.pricing_status_tbl;
l_count NUMBER;
l_msg_index_out NUMBER;
l_num NUMBER;
l_error_message VARCHAR2(2000);
BEGIN
l_num := 10;
l_input_details.intent := 'SP';
-- l_input_details.lse_id := 1;
-- l_input_details.chr_id := 1549063;
-- l_input_details.line_id := 364326736554344799961890872824534166768;
l_input_details.subline_id := 364326736554364142775004706891329465584; --364326736554353262442628175228757110000;
l_num := 20;
oks_qp_int_pvt.compute_price(p_api_version => 1.0
, p_init_msg_list => 'T'
, p_detail_rec => l_input_details
, x_price_details => l_output_details
, x_modifier_details => l_modif_details
, x_price_break_details => l_pb_details
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data
);
l_num := 30;
IF l_return_status <> fnd_api.g_ret_sts_success
THEN
l_num := 40;
IF l_msg_count > 0
THEN
FOR i IN 1 .. l_msg_count
LOOP
l_num := 50;
apps.fnd_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);
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR(l_msg_data, 1, 250);
ELSE
l_error_message := l_error_message || ' /' || SUBSTR(l_msg_data, 1, 250);
END IF;
END LOOP;
DBMS_OUTPUT.put_line('*****************************************');
DBMS_OUTPUT.put_line('API Error : ' || l_error_message);
DBMS_OUTPUT.put_line('*****************************************');
ELSE
apps.fnd_msg_pub.get(p_msg_index => 1, p_encoded => fnd_api.g_false, p_data => l_msg_data
, p_msg_index_out => l_msg_index_out);
DBMS_OUTPUT.put_line('*****************************************');
DBMS_OUTPUT.put_line('API Error : ' || l_msg_data);
DBMS_OUTPUT.put_line('*****************************************');
END IF;
ELSE
l_num := 60;
DBMS_OUTPUT.put_line('API Success');
DBMS_OUTPUT.put_line('Product Quantity : ' || l_output_details.prod_qty);
DBMS_OUTPUT.put_line('Product Quantity UOM : ' || l_output_details.prod_qty_uom);
DBMS_OUTPUT.put_line('Service Quantity : ' || l_output_details.serv_qty);
DBMS_OUTPUT.put_line('Service Quantity UOM : ' || l_output_details.serv_qty_uom);
DBMS_OUTPUT.put_line('Product Price List Id : ' || l_output_details.prod_price_list_id);
DBMS_OUTPUT.put_line('Service Price List Id : ' || l_output_details.serv_price_list_id);
DBMS_OUTPUT.put_line('Product Price List Line Id : ' || l_output_details.prod_price_list_line_id);
DBMS_OUTPUT.put_line('Service Price List Line Id : ' || l_output_details.serv_price_list_line_id);
DBMS_OUTPUT.put_line('Product List Unit Price : ' || l_output_details.prod_list_unit_price);
DBMS_OUTPUT.put_line('Service List Unit Price : ' || l_output_details.serv_list_unit_price);
DBMS_OUTPUT.put_line('Product Adjustment Unit Price : ' || l_output_details.prod_adj_unit_price);
DBMS_OUTPUT.put_line('Service Adjustment Unit Price : ' || l_output_details.serv_adj_unit_price);
DBMS_OUTPUT.put_line('Product Priced Quantity : ' || l_output_details.prod_priced_qty);
DBMS_OUTPUT.put_line('Product Priced UOM : ' || l_output_details.prod_priced_uom);
DBMS_OUTPUT.put_line('Product Extension Amount : ' || l_output_details.prod_ext_amount);
DBMS_OUTPUT.put_line('Service Priced Quantity : ' || l_output_details.serv_priced_qty);
DBMS_OUTPUT.put_line('Service Priced UOM : ' || l_output_details.serv_priced_uom);
DBMS_OUTPUT.put_line('Service Extended Amount : ' || l_output_details.serv_ext_amount);
DBMS_OUTPUT.put_line('Service OPerand : ' || l_output_details.serv_operand);
DBMS_OUTPUT.put_line('Service Operator : ' || l_output_details.serv_operator);
DBMS_OUTPUT.put_line('Status Code : ' || l_output_details.status_code);
DBMS_OUTPUT.put_line('Status Text : ' || l_output_details.status_text);
IF l_modif_details.COUNT > 0
THEN
l_num := 70;
FOR i IN l_modif_details.FIRST .. l_modif_details.LAST
LOOP
l_num := 80;
DBMS_OUTPUT.put_line('List Price : ' || l_modif_details(i).list_price);
END LOOP;
END IF;
l_num := 90;
IF l_pb_details.COUNT > 0
THEN
l_num := 100;
FOR i IN l_pb_details.FIRST .. l_pb_details.LAST
LOOP
l_num := 110;
DBMS_OUTPUT.put_line('Price Break List Price : ' || l_pb_details(i).list_price);
END LOOP;
END IF;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line(l_num || ' Unexpected Error : ' || SUBSTR(SQLERRM, 1, 250));
END;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.