The following two methods may be used to populate the price list.
A) QP: Bulk Import of Price List
B) Pricing API (QP_PRICE_LIST_PUB.Process_Price_List).
Price List Setup API.(QP_PRICE_LIST_PUB.Process_Price_List):
=================================================The Price List Setup package consists of entities to set up price lists.
The Price List Setup package QP_Price_List_PUB.Process_Price_List contains the following public record type and table of records entities:
- Process_Price_List: QP_Price_List_PUB.Process_Price_List:.Takes two record types and six table types as input parameters. Use this API to insert, update, and delete price lists and to set up a price list for a given P_PRICE_LIST_REC record structure.
We can use the API in the following mentioned way:
- Set up multiple price list lines by giving multiple price list line definitions in the P_ PRICE_LIST_LINE_TBL table structure.
- Attach multiple qualifiers at the price list header level by giving multiple qualifiers in the P_QUALIFIERS_TBL table structure.
- Attach multiple pricing attributes to price list lines by giving the pricing attributes in the P_PRICING_ATTR_TBL table structure.
- Price_List_Rec_Type: Corresponds to the columns in the price list header tables QP_ LIST_HEADERS_B and QP_LIST_HEADERS_TL.
- Price_List_Val_Rec_Type: Attributes that store the meaning of id or code columns in the price list header table QP_LIST_HEADERS_B, for example, Currency.
- Price_List_Line_Rec_Type: Corresponds to columns in the price list line table and related modifiers tables QP_LIST_LINES and QP_RLTD_MODIFIERS.
- Price_List_Line_Tbl_Type: Table of Price_List_Line_Rec_Type.
- Price_List_Line_Val_Rec_Type: Attributes that store the meaning of id or code columns in the price list line table QP_LIST_LINES, for example, Price_By_Formula.
- Price_List_Line_Val_Tbl_Type: Table of Price_List_Line_Val_Rec_Type.
- Qualifiers_Rec_Type: Corresponds to the columns in the qualifier table QP_QUALIFIERS.
- Qualifiers_Tbl_Type: Table of Qualifiers_Rec_Type.
- Qualifiers_Val_Rec_Type: Made up of attributes that store the meaning of id or code columns in the qualifiers table QP_QUALIFIERS, for example, Qualifier_Rule.
- Qualifiers_Val_Tbl_Type: Table of Qualifiers_Val_Rec_Type.
- Pricing_Attr_Rec_Type: Corresponds to the columns in the pricing attributes table QP_ PRICING_ATTRIBUTES.
- Pricing_Attr_Tbl_Type: Table of Pricing_Attr_Rec_Type.
- Pricing_Attr_Val_Rec_Type: Attributes that store the meaning of id or code columns in the pricing attributes table QP_PRICING_ATTRIBUTES, for example, Accumulate.
- Pricing_Attr_Val_Tbl_Type: Table of Pricing_Attr_Val_Rec_Type.
— R12 – OM – Script to insert Item into pricelist using qp_price_list_pub API
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
— INITIALIZATION REQUIRED FOR R12
mo_global.set_policy_context (‘S’, 308);
mo_global.init(‘ONT’);
fnd_global.apps_initialize (user_id => 2083,
resp_id => 21623,
resp_appl_id => 660);
gpr_price_list_rec.list_header_id := 33019; — Enter the list_header_id from qp_list_headers
gpr_price_list_rec.NAME := ‘TST_PRICE_LIST’; — Enter the price list name
gpr_price_list_rec.list_type_code := ‘PRL’;
gpr_price_list_rec.description := ‘TEST PRICE LIST’; –Enter the price list Description
gpr_price_list_rec.operation := qp_globals.g_opr_update;
k := 1; — create the price list line rec
gpr_price_list_line_tbl (k).list_header_id := 33019; — Enter the list_header_id from qp_list_headers
gpr_price_list_line_tbl (k).list_line_id := fnd_api.g_miss_num;
gpr_price_list_line_tbl (k).list_line_type_code := ‘PLL’;
gpr_price_list_line_tbl (k).operation := qp_globals.g_opr_create;
gpr_price_list_line_tbl (k).operand := 10; –Enter the Unit Price
gpr_price_list_line_tbl (k).arithmetic_operator := ‘UNIT_PRICE’;
j := 1;
gpr_pricing_attr_tbl (j).pricing_attribute_id := fnd_api.g_miss_num;
gpr_pricing_attr_tbl (j).list_line_id := fnd_api.g_miss_num;
gpr_pricing_attr_tbl (j).product_attribute_context := ‘ITEM’;
gpr_pricing_attr_tbl (j).product_attribute := ‘PRICING_ATTRIBUTE1’;
gpr_pricing_attr_tbl (j).product_attr_value := ‘102785’; — Enter the inventory_item_id
gpr_pricing_attr_tbl (j).product_uom_code := ‘EA’; — Enter the UOM
gpr_pricing_attr_tbl (j).excluder_flag := ‘N’;
gpr_pricing_attr_tbl (j).attribute_grouping_no := 1;
gpr_pricing_attr_tbl (j).price_list_line_index := 1;
gpr_pricing_attr_tbl (j).operation := qp_globals.g_opr_create;
dbms_output.put_line(‘Calling qp_price_list_pub.process_price_list API to Enter Item Into Price List’);
dbms_output.put_line(‘=============================================’);
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(‘No Of Record Got Insterted=> ‘ k);
dbms_output.put_line(‘Return Status = ‘ ppr_price_list_line_tbl(k).return_status);
END LOOP;
END IF;
IF ppr_price_list_line_tbl(k).return_status = fnd_api.g_ret_sts_success THEN
Commit;
DBMS_OUTPUT.put_line (‘The Item has been successfully loaded into the price list’);
Else
Rollback;
DBMS_OUTPUT.put_line (‘The Item has not been loaded into the price list’);
end if;
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(‘The Error Message Due to which The Item has not been loaded to Price List ‘ k ‘ is: ‘ gpr_msg_data);
END LOOP;
END;
— R12 – OM-Script to delete item from Price list using QP_PRICE_LIST_PUB API
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);
— setup the list_header rec for update
gpr_price_list_rec.list_header_id := 33019; — Price List Header Id (List_header_id)
gpr_price_list_rec.NAME := ‘TST_PRICE_LIST’; — Price List Name
gpr_price_list_rec.list_type_code := ‘PRL’;
gpr_price_list_rec.description := ‘TEST PRICE LIST’; — 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 := 33019; — Price List Header Id (List_header_id)
gpr_price_list_line_tbl (k).list_line_id := 2003808; — Price List Line Id (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(‘Calling qp_price_list_pub.process_price_list API to Delete Item From Price List’);
DBMS_OUTPUT.put_line(‘==============================================’);
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(‘No Of Record Got Deleted=> ‘ k);
DBMS_OUTPUT.put_line(‘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
Commit;
DBMS_OUTPUT.put_line (‘The Item Has Been Successfully Deleted from The Price List Using API’);
Else
Rollback;
RAISE fnd_api.g_exc_unexpected_error;
END IF;
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 (‘The Error Message’ 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;
WHEN fnd_api.g_exc_unexpected_error THEN
gpr_return_status := fnd_api.g_ret_sts_unexp_error;
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 (‘The Error Message’ k ‘ is: ‘ gpr_msg_data);
NULL;
END LOOP;
WHEN OTHERS THEN
gpr_return_status := fnd_api.g_ret_sts_unexp_error;
END;
Recent Comments