DECLARE
gpr_return_status VARCHAR2 (1) := NULL;
gpr_msg_count NUMBER := 0;
gpr_msg_data VARCHAR2 (2000);
gpr_price_list_rec qp_price_list_pub.price_list_rec_type;
gpr_price_list_val_rec qp_price_list_pub.price_list_val_rec_type;
gpr_price_list_line_tbl qp_price_list_pub.price_list_line_tbl_type;
gpr_price_list_line_val_tbl qp_price_list_pub.price_list_line_val_tbl_type;
gpr_qualifiers_tbl qp_qualifier_rules_pub.qualifiers_tbl_type;
gpr_qualifiers_val_tbl qp_qualifier_rules_pub.qualifiers_val_tbl_type;
gpr_pricing_attr_tbl qp_price_list_pub.pricing_attr_tbl_type;
gpr_pricing_attr_val_tbl qp_price_list_pub.pricing_attr_val_tbl_type;
ppr_price_list_rec qp_price_list_pub.price_list_rec_type;
ppr_price_list_val_rec qp_price_list_pub.price_list_val_rec_type;
ppr_price_list_line_tbl qp_price_list_pub.price_list_line_tbl_type;
ppr_price_list_line_val_tbl qp_price_list_pub.price_list_line_val_tbl_type;
ppr_qualifiers_tbl qp_qualifier_rules_pub.qualifiers_tbl_type;
ppr_qualifiers_val_tbl qp_qualifier_rules_pub.qualifiers_val_tbl_type;
ppr_pricing_attr_tbl qp_price_list_pub.pricing_attr_tbl_type;
ppr_pricing_attr_val_tbl qp_price_list_pub.pricing_attr_val_tbl_type;
k NUMBER := 1;
j NUMBER := 1;
BEGIN
oe_debug_pub.initialize;
oe_debug_pub.setdebuglevel (5);
oe_msg_pub.initialize;
DBMS_OUTPUT.put_line ('Debug File = ' || oe_debug_pub.g_dir || '/' || oe_debug_pub.g_file);
--dbms_output.put_line('after get price list ');
/* setup the list_header rec for update */
gpr_price_list_rec.list_header_id := '<price_list_header_id>';
gpr_price_list_rec.NAME := '<price_list_name>';
gpr_price_list_rec.list_type_code := 'PRL';
gpr_price_list_rec.description := '<price_list_description>';
gpr_price_list_rec.operation := qp_globals.g_opr_update;
-- delete the price list line rec
gpr_price_list_line_tbl (k).list_header_id := '<price_list_header_id>';
gpr_price_list_line_tbl (k).list_line_id := '<price_list_line_id>';
gpr_price_list_line_tbl (k).list_line_type_code := 'PLL';
gpr_price_list_line_tbl (k).operation := qp_globals.g_opr_delete;
--dbms_output.put_line('before process price list ');
qp_price_list_pub.process_price_list (p_api_version_number => 1
, p_init_msg_list => fnd_api.g_false
, p_return_values => fnd_api.g_false
, p_commit => fnd_api.g_false
, x_return_status => gpr_return_status
, x_msg_count => gpr_msg_count
, x_msg_data => gpr_msg_data
, p_price_list_rec => gpr_price_list_rec
, p_price_list_line_tbl => gpr_price_list_line_tbl
, p_pricing_attr_tbl => gpr_pricing_attr_tbl
, x_price_list_rec => ppr_price_list_rec
, x_price_list_val_rec => ppr_price_list_val_rec
, x_price_list_line_tbl => ppr_price_list_line_tbl
, x_price_list_line_val_tbl => ppr_price_list_line_val_tbl
, x_qualifiers_tbl => ppr_qualifiers_tbl
, x_qualifiers_val_tbl => ppr_qualifiers_val_tbl
, x_pricing_attr_tbl => ppr_pricing_attr_tbl
, x_pricing_attr_val_tbl => ppr_pricing_attr_val_tbl
);
IF ppr_price_list_line_tbl.COUNT > 0
THEN
FOR k IN 1 .. ppr_price_list_line_tbl.COUNT
LOOP
DBMS_OUTPUT.put_line ('Record = ' || k || 'Return Status = ' || ppr_price_list_line_tbl (k).return_status);
END LOOP;
END IF;
IF gpr_return_status <> fnd_api.g_ret_sts_success
THEN
RAISE fnd_api.g_exc_unexpected_error;
END IF;
DBMS_OUTPUT.put_line ('after process price list ');
FOR k IN 1 .. gpr_msg_count
LOOP
gpr_msg_data := oe_msg_pub.get (p_msg_index => k, p_encoded => 'F');
DBMS_OUTPUT.put_line ('err msg ' || k || ' is: ' || gpr_msg_data);
NULL;
END LOOP;
EXCEPTION
WHEN fnd_api.g_exc_error
THEN
gpr_return_status := fnd_api.g_ret_sts_error;
-- Get message count and data
DBMS_OUTPUT.put_line ('err msg 1 is : ' || gpr_msg_data);
WHEN fnd_api.g_exc_unexpected_error
THEN
gpr_return_status := fnd_api.g_ret_sts_unexp_error;
DBMS_OUTPUT.put_line (' msg count 2 is : ' || gpr_msg_count);
FOR k IN 1 .. gpr_msg_count
LOOP
gpr_msg_data := oe_msg_pub.get (p_msg_index => k, p_encoded => 'F');
-- Get message count and data
DBMS_OUTPUT.put_line ('err msg ' || k || ' is: ' || gpr_msg_data);
NULL;
END LOOP;
WHEN OTHERS
THEN
gpr_return_status := fnd_api.g_ret_sts_unexp_error;
-- Get message count and data
DBMS_OUTPUT.put_line ('err msg 3 is : ' || gpr_msg_data);
END;
/