You are on page 1of 4

12/22/11

Get_Custom_Price() API : The Power of Oracle Advanced Pricing

O acleApp Blog
Home Gallery Categories Archives Feeds Links Contact About

Membe : Login | Register | Member List

A b ou t
This web log documents the daily experiences and learnings of Oracle Applications C onsultants and Implementor's. OracleAppsBlog was founded by Richard Byrom, an Oracle Applications C onsultant, Speaker and Author. This Blog has been categorised according to the different industries and modules that apply to Oracle Applications. Should you wish to participate as an author for a related module or category please register as a member and mail me to let me know which category you would like to write under. Richard also hosts another blog entitled WebDesignBlog - a web log and portal dedicated to the design and build of web sites.

Get _Cust om_Price( ) API : T he Power of Oracle Advanced Pricing


In my previous post I tried to demonstrate one powerful extensibility feature of Oracle Advanced Pricing. Get_Custom_Price public API is another such feature that finds its use in many tailor-made, complex pricing requirements. Get_Custom_Price API provides a user hook enabling us to retrieve pricing information from an external system and to use it in a formula. Oracle white paper Don t Customize, Extend! in Metalink demonstrated the use of it with sample code. Here we will take a very common and simple pricing scenario to show the use of this public API.

Scenario:
Apply 10% Margin on cost of the item. (Costing Method = Standard)

St ep 1 : Set up syst em profile


Set the profile option QP: Get Custom Price Customized to Yes . If the profile is set to Yes , then the pricing engine would execute this function if it is attached to a formula. Nav igation: S stem Adm inistrator > Profile > S stem

S y n di ca t e
RSS 1.0 RSS 2.0 (full text with comments) Atom (full text) del.icio.us (link blog) furl

St ep 2: Define Formula
Define a Pricing Formula and source a formula line as Function. Nav igation: Pricing Form ulas > Form ulas Setup

St ep 3: Find Formula id
Find the Formula_id using Examine Feature.
oracleappsblog.com/ /get-custom-price-api-the-power-of-oracle-advanced 1/4

12/22/11

Get_Custom_Price() API : The Power of Oracle Advanced Pricing

Nav igation: Help > Diagnostics > E am ine

St ep 4: Creat e Get _Cust om_Price package body.


The QP_CUSTOM.Get_Custom_Price() package specification is seeded as part of the Advanced Pricing installation. Users wishing to customize this package should write their own body for this package specification. Get_Custom_Price Function parameters are:
p_price_formula_id formula identifier p_list_price Price List Price of the line to which formula is attached. p_price_effective_date - C urrent date p_req_line_attrs_tbl - Pricing Attributes and Product Attributes of the current line

All the parameters are passed to the function b the Pricing Engine and can be used in the function bod . OE_ORDER_PUB.G_LINE.line_id and other global variables can be used in the package bod to reference an order line and to retrieve information specific to current order line.
A typical Get_Custom_Price package body may look like: CREATE OR REPLACE PACKGE BODY QP_CUSTOM AS FUNCTION get_custom_price( P_pricing_formula_id IN NUMBER, P_list_price IN NUMBER, P_price_effective_date IN DATE, P_req_line_attrs_tbl IN qp_formula_pricecalc_pvt.req_line_attrs_tbl) RETURN NUMBER IS L_item_cost NUMBER; L_item_id NUMBER; L_organi ation_id NUMBER; C_cost_plus_formula CONSTANT NUMBER := 6248; BEGIN L_item_id := OE_ORDER_PUB.G_LINE.inventor _item_id; L_organi ation_id := OE_ORDER_PUB.G_LINE.ship_to_org_id; If p_price_formula_id = c_cost_plus_formula THEN SELECT item_cost INTO l_item_cost FROM CST_ITEM_COST_TYPE_V WHERE inventor _items_id = l_inventor _item_id AND organi ation_id = l_organi ation_id AND cost_t pe_id = 1; End if; RETURN l_item_cost; WHEN OTHERS RETURN NULL; END get_custom_price; END qp_custom;
1. Suv,

Most r ecen t en t r i es
Get_C ustom_Price() API : The Power of Oracle Advanced Pricing

Mon t h l y A r ch i v es
May 2009 August 2008 April 2008 March 2008 February 2008 January 2008 November 2007 September 2007 June 2007 February 2007 January 2007 November 2006 October 2006 September 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 November 2005 October 2005 September 2005 August 2005

Poste d by Suv Biswas on 10/24 at 09:55 PM

oracleappsblog.com/

/get-custom-price-api-the-power-of-oracle-advanced

2/4

12/22/11
July 2005 June 2005 May 2005 April 2005 March 2005 February 2005 January 2005 December 2004 November 2004 October 2004 September 2004 August 2004 July 2004 June 2004 C omplete Archives C ategory Archives

Get_Custom_Price() API : The Power of Oracle Advanced Pricing

Very neat article. In your get_custom_price function example you have used ----L_item_id := OE_ORDER_PUB.G_LINE.inventory_item_id; L_organization_id := OE_ORDER_PUB.G_LINE.ship_to_org_id; -----We did the exact same thing on a project and I wanted to share our learning from it. This works very well when one line is priced. However if you are pricing an entire order (say using Price Order), then OE_ORDER_PUB.G_LINE structure can keep information on only one line, and regardless of which line is being priced by QP (since OM submits the entire batch to QP together) you will get the same item number and Warehouse (usually the one pertaining to the line where your cursor is, or the last line). As I said, we made the same mistake, and learnt that we should only use Pricing/Qualifier Attributes in Get Custom Price. The other obvious advantage of using just the Pricing/Qualifier Attribute is that you can use the same function regardless of which module is trying to price (in our case Order Capture, iStore etc used the same price list). Again this was a very well written and educating article. regards, Pankaj
Poste d by Pank aj Jain on 12/26 at 10:39 PM

2. I ve put the profile QP: Get Custom Price Customized to Yes and when I go

to the Formula Setup form, I can t get the formula type function appearing even if the lookup for it is enabled. Any idea on how to resolve this issue?

Poste d by k e nny on 01/16 at 09:53 AM

Add Commen I nforma ion Here


Please note that comments will only be accepted from valid members of this site who provide feedback that is beneficial to readers of the blog. ALL comments (even those from members) will be subject to moderation. Name:

Email:

Location:

URL:

h p://
Smileys
<b> <i> < > q o e code @ <a> Clo e Tag

oracleappsblog.com/

/get-custom-price-api-the-power-of-oracle-advanced

3/4

12/22/11

Get_Custom_Price() API : The Power of Oracle Advanced Pricing

Remembe m pe

onal info ma ion ?

No if me of follo - p commen S bmi he o d o ee belo :

S bmi

Pre ie
Ne en : Ba ic V Ad anced P icing o e p ice b eak ba ed on Weigh ?

P e io
Thi

en

: P icing Scena io: Ho


be e n ie e d 1323812 im e ionEngine

page ha

Po e e d b

E p e

oracleappsblog.com/

/get-custom-price-api-the-power-of-oracle-advanced

4/4

You might also like