Está en la página 1de 4

6/10/12

3.7. Pricing APIs

Prev

Chapter 3. Advanced Pricing Part III. Order to Cash (O2C) Cycle

Next

3.7. Pricing APIs


3.7.1. Pricing Scenario1 Sample script which inserts a Price List with 3 price list lines, and the product information for each of the lines(Product Information is stored in pricing attributes table in product attribute columns). This sample price list does not have any qualifiers or price breaks or non product-information type of pricing attributes.
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 --dbms_output.put_line('after get price list '); /* set the list_header_id to g_miss_num */ gpr_price_list_rec.list_header_id := FND_API.G_MISS_NUM; gpr_price_list_rec.name := 'Sample1-PL 1024'; gpr_price_list_rec.list_type_code := 'PRL'; gpr_price_list_rec.description := 'Sample price list'; /* you can set the currency of price list to whatever, say FRA */ gpr_price_list_rec.currency_code := 'USD'; gpr_price_list_rec.operation := QP_GLOBALS.G_OPR_CREATE; FOR K IN 1..3 LOOP 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; gpr_price_list_line_tbl(K).arithmetic_operator := 'UNIT_PRICE'; END LOOP; /* product_attr_value stores inventory item id - product_attribute for Item Number is Pricing_Attribute1 product_attribute_context is ITEM. Each line can have one or more pricing attributes. PRICE_LIST_LINE_INDEX is used to link the child (pricing attributes) to the parent(line). When you have pricing attributes like color, length, width etc, populate the fields pricing_attribute_context, pricing_attribute, pricing_attr_value_from, pricing_attr_value_to and comparison_operator_code ( '=' or 'between') and repeat the product_attr_value and its attribute and context for each record. */ 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 := '62061'; gpr_pricing_attr_tbl(J).PRODUCT_UOM_CODE := 'Ea'; 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; J := 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 := '62081'; gpr_pricing_attr_tbl(J).PRODUCT_UOM_CODE := 'Ea'; gpr_pricing_attr_tbl(J).EXCLUDER_FLAG := 'N';

Restore Objects In AD
Restore Active Directory At The Object Level. Free Trial Download!
www.Quest.com/Active-Directory

www.confluentminds.com/Trainings/SCM/Topic3.7_Ch3_Part3.html

1/4

6/10/12

3.7. Pricing APIs

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 := 2; gpr_pricing_attr_tbl(J).operation := QP_GLOBALS.G_OPR_CREATE; J := 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 := '62083'; gpr_pricing_attr_tbl(J).PRODUCT_UOM_CODE := 'Ea'; 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 := 3; gpr_pricing_attr_tbl(J).operation := QP_GLOBALS.G_OPR_CREATE; --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 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 '); 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); Rollback; 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' ); /* oe_msg_pub.Count_And_Get ( p_count=> gpr_msg_count , p_data=> gpr_msg_data ); */ --Get message count and data --dbms_output.put_line('err msg ' || k ||'is: ' || gpr_msg_data); null; end loop; Rollback; 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); Rollback; end;

3.7.2. Pricing Scenario2 This sample script inserts a Pricing Formula with seven different pricing formula lines to demonstrate the six formula line types supported in Advanced Pricing formulas: * Price List Line (PLL) * Function (FUNC) * List Price(LP) * Numeric Constant (NUM) * Pricing Attribute (PRA) * Factor List(ML) * Modifier Value (MV) Oracle Basic Pricing supports three formula line types: www.confluentminds.com/Trainings/SCM/Topic3.7_Ch3_Part3.html

2/4

6/10/12

3.7. Pricing APIs

Oracle Basic Pricing supports three formula line types: * Pricing Attribute (PRA) * Numeric Constant (NUM) * Factor List (ML) A pricing formula header record and seven price formula lines are created. For the formula line of type Factor List, the list_header_id of an existing Factor List is used in this sample script. This script must be modified by the user so that the following column is populated with a valid list_header_id of an existing Factor List: gpr_formula_lines_tbl(K).price_modifier_list_id and the following column is populated with a valid list_line_id of an existing Price List Line from the instance where this script is run: gpr_formula_lines_tbl(K).price_list_line_id.
Declare ::::::::::: K number := 1; Begin /* Set the price_formula_id to g_miss_num to Create the Price Formula Record(Header)*/ gpr_formula_rec.price_formula_id := FND_API.G_MISS_NUM; gpr_formula_rec.name := 'Sample1-PF 1025-1'; gpr_formula_rec.description := 'Sample Pricing Formula'; gpr_formula_rec.formula := 'SQRT(1)*2-NVL(3,4)/5+6'; --Any valid Mathematical Expression including built-in database functions. --Every operand must correspond to a step_number in a price formula line. gpr_formula_rec.operation := QP_GLOBALS.G_OPR_CREATE; /* Create price formula line 1 of type 'List Price'(LP) */ K := 1; gpr_formula_lines_tbl(K).price_formula_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).price_formula_line_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).formula_line_type_code := 'LP' gpr_formula_lines_tbl(K).step_number := 1; gpr_formula_lines_tbl(K).operation := QP_GLOBALS.G_OPR_CREATE; /* Create price formula line 2 of type 'Price List Line'(PLL) */ K := K + 1; gpr_formula_lines_tbl(K).price_formula_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).price_formula_line_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).formula_line_type_code := 'PLL'; gpr_formula_lines_tbl(K).step_number := 2; gpr_formula_lines_tbl(K).price_list_line_id := 293195; -- Corresponds to the list_line_id of the item 'dw01' on the PriceList -- 'Testing 1023'. gpr_formula_lines_tbl(K).operation := QP_GLOBALS.G_OPR_CREATE; /* Create price formula line 3 of type 'Pricing Attribute'(PRA) */ K := K + 1; gpr_formula_lines_tbl(K).price_formula_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).price_formula_line_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).formula_line_type_code := 'PRA'; gpr_formula_lines_tbl(K).step_number := 3; gpr_formula_lines_tbl(K).pricing_attribute_context := 'PRICING ATTRIBUTE'; gpr_formula_lines_tbl(K).pricing_attribute := 'PRICING_ATTRIBUTE12'; -- Corresponds to the Pricing Attribute 'Insurance Cost' gpr_formula_lines_tbl(K).operation := QP_GLOBALS.G_OPR_CREATE; /* Create price formula line 4 of type 'Numeric Constant'(NUM) */ K := K + 1; gpr_formula_lines_tbl(K).price_formula_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).price_formula_line_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).formula_line_type_code := 'NUM'; gpr_formula_lines_tbl(K).step_number := 4; gpr_formula_lines_tbl(K).numeric_constant := 1000; gpr_formula_lines_tbl(K).operation := QP_GLOBALS.G_OPR_CREATE; /* Create price formula line 5 of type 'Function'(FUNC) */ -- User must customize the QP_CUSTOM.Get_Custom_Price function -- to return a numeric value and also set the profile option -- 'QP: Get Custom Price Customized' to 'Yes' at the Site Level to -- successfully use this formula line type (FUNC) in their formulas. K := K + 1; gpr_formula_lines_tbl(K).price_formula_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).price_formula_line_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).formula_line_type_code := 'FUNC'; gpr_formula_lines_tbl(K).step_number := 5; gpr_formula_lines_tbl(K).operation := QP_GLOBALS.G_OPR_CREATE; /* Create price formula line 6 of type 'Factor List'(ML) */ K := K + 1; gpr_formula_lines_tbl(K).price_formula_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).price_formula_line_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).formula_line_type_code := 'ML'; gpr_formula_lines_tbl(K).step_number := 6;

www.confluentminds.com/Trainings/SCM/Topic3.7_Ch3_Part3.html

3/4

6/10/12

3.7. Pricing APIs

gpr_formula_lines_tbl(K).price_modifier_list_id := 50174; -- Corresponds to the list_header_id of an existing Factor List -- 'ABC' gpr_formula_lines_tbl(K).operation := QP_GLOBALS.G_OPR_CREATE; /* Create price formula line 7 of type 'Modifier Value'(MV) */ K := K + 1; gpr_formula_lines_tbl(K).price_formula_id := FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).price_formula_line_id:= FND_API.G_MISS_NUM; gpr_formula_lines_tbl(K).formula_line_type_code := 'MV' gpr_formula_lines_tbl(K).step_number := 7; gpr_formula_lines_tbl(K).operation := QP_GLOBALS.G_OPR_CREATE; --dbms_output.put_line('before process price formula '); QP_PRICE_FORMULA_PUB.Process_Price_Formula ( 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_FORMULA_rec => gpr_formula_rec , p_FORMULA_LINES_tbl => gpr_formula_lines_tbl , x_FORMULA_rec => ppr_formula_rec , x_FORMULA_val_rec => ppr_formula_val_rec , x_FORMULA_LINES_tbl => ppr_formula_lines_tbl , x_FORMULA_LINES_val_tbl => ppr_formula_lines_val_tbl ); 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 formula '); 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); Rollback; 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' ); /* oe_msg_pub.Count_And_Get ( p_countgpr_msg_count , p_data => gpr_msg_data ); */ --Get message count and data --dbms_output.put_line('err msg ' || k ||'is: ' || gpr_msg_data); null; end loop; Rollback; 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); Rollback; end; / Commit;

Copyright 2000-2005 ConfluentMinds Pvt Ltd. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of ConfluentMinds Pvt Ltd. Use is subject to license terms. Prev Home A Techno-functional Guide to Oracle Applications - Supply Chain Management.Your feedback please. Next

www.confluentminds.com/Trainings/SCM/Topic3.7_Ch3_Part3.html

4/4

También podría gustarte