4
12/22/11 Get_Custom_Price() API : The Power of Oracle Advanced Pricing 1/4 oracleappsblog.com/«/get-custom-price-api-the-power-of-oracle-advanced« MembeUV: Login | Register | Member List About This web log documents the daily experiences and learnings of Oracle Applications Consultants and Implementor's. OracleAppsBlog was founded by Richard Byrom, an Oracle Applications Consultant, 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. Syndicate RSS 1.0 RSS 2.0 (full text with comments) Atom (full text) del.icio.us (link blog) furl Home Gallery Categories Archives Feeds Links Contact About Get_Custom_Price() API : The 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) Step 1: Setup system 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 Step 2: Define Formula Define a Pricing Formula and source a formula line as Function. Nav igation: Pricing Form ulas > Form ulas Setup Step 3: Find Formula id Find the Formula_id using Examine Feature. OUacleAppVBlog

Get_Custom_Price() API _ the Power of Oracle Advanced Pricing

Embed Size (px)

Citation preview

Page 1: Get_Custom_Price() API _ the Power of Oracle Advanced Pricing

12/22/11 Get_Custom_Price() API : The Power of Oracle Advanced Pricing

1/4oracleappsblog.com/…/get-custom-price-api-the-power-of-oracle-advanced…

Members: Login | Register | Member List

§ A bou t

This web log documents the dailyexperiences and learnings of OracleApplications Consultants andImplementor's. OracleAppsBlog wasfounded by Richard Byrom, anOracle Applications Consultant,Speaker and Author.

This Blog has been categorisedaccording to the different industriesand modules that apply to OracleApplications. Should you wish toparticipate as an author for arelated module or category pleaseregister as a member and mail meto let me know which category youwould like to write under.

Richard also hosts another blogentitled WebDesignBlog - a web logand portal dedicated to the designand build of web sites.

§ Sy n di ca t e

RSS 1.0RSS 2.0 (full text with comments)Atom (full text)del.icio.us (link blog)furl

Home Gallery Categories Archives Feeds Links Contact About

Get_Custom_Price() API : T he Power of OracleAdvanced Pricing

In my previous post I tried to demonstrate one powerful extensibility feature ofOracle Advanced Pricing. Get_Custom_Price public API is another such feature thatfinds its use in many tailor-made, complex pricing requirements. Get_Custom_PriceAPI provides a user hook enabling us to retrieve pricing information from anexternal 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 takea 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)

Step 1 : Setup system 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 aformula.

Navigation: System Administrator > Profile > System

Step 2: Define Formula

Define a Pricing Formula and source a formula line as Function.

Navigation: Pricing Formulas > Formulas Setup

Step 3: Find Formula id

Find the Formula_id using Examine Feature.

OracleAppsBlog

Page 2: Get_Custom_Price() API _ the Power of Oracle Advanced Pricing

12/22/11 Get_Custom_Price() API : The Power of Oracle Advanced Pricing

2/4oracleappsblog.com/…/get-custom-price-api-the-power-of-oracle-advanced…

§ Most r ecen t en t r i es

Get_Custom_Price() API : ThePower of Oracle Advanced Pricing

§ Mon t h l y A r ch i v es

May 2009August 2008April 2008March 2008February 2008January 2008November 2007September 2007June 2007February 2007January 2007November 2006October 2006September 2006July 2006June 2006May 2006April 2006March 2006February 2006November 2005October 2005September 2005August 2005

Navigation: Help > Diagnostics > Examine

Step 4: Create Get_Custom_Price package body.

The QP_CUSTOM.Get_Custom_Price() package specification is seeded as part ofthe Advanced Pricing installation. Users wishing to customize this package shouldwrite their own body for this package specification.

Get_Custom_Price Function parameters are:

p_price_formula_id – formula identifierp_list_price – Price List Price of the line to which formula is attached.p_price_effective_date - Current datep_req_line_attrs_tbl - Pricing Attributes and Product Attributes of the current line

All the parameters are passed to the function by the Pricing Engine and can be used in

the function body. OE_ORDER_PUB.G_LINE.line_id and other global variables can

be used in the package body to reference an order line and to retrieve informationspecific 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 NUMBERIS

L_item_cost NUMBER; L_item_id NUMBER; L_organization_id NUMBER;

C_cost_plus_formula CONSTANT NUMBER := 6248;

BEGIN

L_item_id := OE_ORDER_PUB.G_LINE.inventory_item_id; L_organization_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 inventory_items_id = l_inventory_item_id AND organization_id = l_organization_id AND cost_type_id = 1;

End if;

RETURN l_item_cost;

WHEN OTHERS RETURN NULL;

END get_custom_price; END qp_custom;

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

1. Suv,

Page 3: Get_Custom_Price() API _ the Power of Oracle Advanced Pricing

12/22/11 Get_Custom_Price() API : The Power of Oracle Advanced Pricing

3/4oracleappsblog.com/…/get-custom-price-api-the-power-of-oracle-advanced…

July 2005June 2005May 2005April 2005March 2005February 2005January 2005December 2004November 2004October 2004September 2004August 2004July 2004June 2004Complete ArchivesCategory Archives

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 ourlearning from it.

This works very well when one line is priced. However if you are pricing anentire order (say using Price Order), then OE_ORDER_PUB.G_LINE structurecan keep information on only one line, and regardless of which line is beingpriced by QP (since OM submits the entire batch to QP together) you will getthe same ‘item number’ and ‘Warehouse’ (usually the one pertaining to theline where your cursor is, or the last line).

As I said, we made the same mistake, and learnt that we should only usePricing/Qualifier Attributes in Get Custom Price. The other obvious advantageof using just the Pricing/Qualifier Attribute is that you can use the samefunction regardless of which module is trying to price (in our case OrderCapture, iStore etc used the same price list).

Again this was a very well written and educating article.

regards,

PankajPosted by Pankaj Jain on 12/26 at 10:39 PM

2. I’ve put the profile ‘QP: Get Custom Price Customized’ to ‘Yes’ and when I goto the Formula Setup form, I can’t get the formula type ‘function’ appearingeven if the lookup for it is enabled. Any idea on how to resolve this issue?

Posted by kenny on 01/16 at 09:53 AM

Add Comment Information Here

Please note that comments will only be accepted from valid members of this sitewho 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:

http://

Smileys

<b> <i> <u> quote code @ <a> Close Tags

Page 4: Get_Custom_Price() API _ the Power of Oracle Advanced Pricing

12/22/11 Get_Custom_Price() API : The Power of Oracle Advanced Pricing

4/4oracleappsblog.com/…/get-custom-price-api-the-power-of-oracle-advanced…

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:

Submit � Preview

Next entry: Basic Vs Advanced Pricing

Previous entry: Pricing Scenario: How to use price breaks based on Weight?

This page has been viewed 1323812 times

Powered by ExpressionEngine