You are on page 1of 15

Ignore Pricing for Order Lines

Custom Hook
An Oracle White Paper
Apr 2009
Ignore Pricing for Order Lines Custom Hook

OVERVIEW

This document gives an overview of the new functionality that is an


enhancement to Oracle Advanced Pricing functionality. This enhancement is
released as a part of 11.5.10 and R12 releases of Oracle Applications.
The motive of this enhancement is driven by the performance gain that desired
by the users if majority of the order lines are not significant to pricing and can
carry a zero price.
Note: For information regarding setup for orders, please refer to Order
Management manuals. For details on the setup for advanced pricing, please refer
to advanced pricing users guide. Reference My Oracle Support (formerly
MetaLink) Note 91798.1 - Order Management Product Suite Documentation.

Purpose of introducing the Custom Hook

In many scenarios, there is a need to price only certain number of order/quote


items using the pricing set up. For rest of the items the price is picked from some
dummy price list that will carry certain price. These items are completely
insignificant to pricing and no more processing is needed for these items in the
pricing engine call other than fetching a price from some dummy price list.
Usually, customers intentionally set the list price of these items as 0 or set up a
price list line with ALL ITEMS" as 0.
Mostly model items have lot of marketing or manufacturing option items
included which have no significance from pricing perspective. Still the lines fro
these items are sourced to pricing for processing and after lot of unnecessary
processing the prices fetched for these lines are 0. Due to this these lines are a
extra burden on pricing and cause performance issues. Especially in case of
bigger orders significant amount of time can be saved if pricing engine could
ignore these lines.
The Ignore Pricing custom hook provides users an opportunity to inform pricing
engine to ignore such lines that could result in substantial performance gain.

1
Important implementation Notes:
The sales order line with an item setup to ignore pricing will be completely
ignored by pricing engine for any other processing. Here are a few examples.
Example 1:
An item Item_A has been identified as a zero priced item by the custom hook.
The item is included in item category cat_A.. If a modifier is set up for
application to category cat_A, it will not be applied to the sales order line that
has ordered item item_A.

Example 2:
Item A and Item B belong to Item Category CAT1. A modifier line is setup for
this Item Category, where the group quantity is from 10-99, and then it will
apply a 10% discount. Item B has been identified as a zero priced item by the
custom hook. The following Order is booked.
Order line 1 - Item A - qty 8
Order line 2 - Item B - qty 15
The CAT1 group quantity would be 8 and not 23 (8+15), since order line 2 is for
an item that is setup as a zero priced item, which means that it is not considered
by the pricing engine. Therefore, this modifier for group quantity 10-99 would
not apply.

Example 3:

Item_0 and Item_1 belong to Item Category CAT_A. A modifier line is setup for
the Item Category CAT_A, where the group amount is from 1000-99999, and
then it will apply a 10% discount. Item_1 has been identified as a zero priced
item by the custom hook. The following Order is booked.
Order line 1 Item_0 - qty 8 with unit list price 100.
Order line 2 Item_1 - qty 10 with unit list price as 100.
The CAT_A group amount would be 800 and not 1800 (800+1000), since order
line 2 is for an item that is setup as a zero priced item, which means that it is not
considered by the pricing engine. Therefore, this modifier for group amount
1000-99999 would not apply.

Customer needs to evaluate the scenarios similar to the ones explained above
and then design the ignore items pattern logic for the custom hook.

2
Ignore Pricing Custom Hook Implementation

An overview of the tasks involved in the implementation of ignore pricing


custom hook is depicted in the following flowchart

Identify a pattern for zero


priced items.

No Is such a pattern
available?

Yes

Use Advance Pricing


provided custom hook API
to set the default price for
these items to zero.

Set the QP: Custom Ignore


Pricing profile to Y.

End

3
Pricing Engine Execution
An overview of pricing engine execution for this functionality is depicted in the
following diagram

Pricing call is made to


price an item.

Build Context API


No
checks for QP:
Custom Ignore Pricing
profile? Is it set?

Yes

Build Context API calls the


Ignore_itemline_for_pricing API
from QP_Custom_Ignore package.

Is it a zero price
item?

No Yes

Source all the line attributes. Set the price for this line as zero.
No changes made to the item Source only needed attributes.
line and calculate_price_flag.
Set calculate_price_flag to N to
prevent any further pricing changes.

Proceed further with the pricing engine call.

4
Implementing QP_custom_ignore.Ignore_itemline_for_pricing

If you intend to use ignore_itemline_for_pricing you must create a package body


for qp_custom_ignore with the procedure ignore_itemline_for_pricing.

The pricing engine calls the qp_custom_ignore.ignore_itemline_for_pricing API


with the following set of parameters:
p_request_type_code: IN VARCHAR2
Pass appropriate parameter value to determine correct line structure depending
on the application that calls pricing engine.
E.g. for using OE_ORDER_PUB.G_LINE structure, pass this parameter as
ONT or, for using ASO_PRICING_INT.G_LINE_REC structure, pass this
parameter as ASO.

x_ignore: OUT NOCOPY VARCHAR2


Set this parameter in the ignore_itemline_for_pricing API to true if the line has
to be ignored for price processing, false if line has to be processed by engine for
list price derivation and for applying other adjustments.

x_default_price_list_id: OUT NOCOPY NUMBER


If x_ignore is set to true then user must set x_default_price_list_id to a valid
list_header_id of an active price list with an entry of ALL_ITEMS of zero price.
This is a mandatory step as Price list is a mandatory field on Sales Order line.
Though pricing engine will not use this price list in the list header search it is
needed to have the price list active so that other pricing engine calls with the
profile option QP: Custom Ignore Pricing profile set to N will not fail.
Implementation Hint User may create a new dummy pricelist that user can use
to identify whether the item has been priced as zero price item. User can also
restrict using this dummy pricelist for other normal pricing transactions by
restricting it with some appropriate qualifier.

5
Implementation Examples.

Assumption A dummy pricelist is created having list_header_id 12345.

Example 1:
User has identified following 4 items as zero priced items. These are mostly the
configured option items that are attached to majority of the models sold by the
company using sales order form.
Item Inventory_item_id
A 11111
B 22222
C 33333
D 44444
CREATE OR REPLACE PACKAGE BODY QP_CUSTOM_IGNORE AS
PROCEDURE IGNORE_ITEMLINE_FOR_PRICING(

p_request_type_code IN VARCHAR2

,x_ignore OUT VARCHAR2

,x_default_price_list_id OUT NUMBER )

IS

l_item_id VARCHAR2(240);

BEGIN

if p_request_type_code = ONT' then

l_item_id := OE_ORDER_PUB.G_LINE.inventory_item_id;

if (l_item_id IN (11111,22222,33333,44444)) then

x_ignore := 'Y';

x_default_price_list_id := 12345;

Else

x_ignore := 'N';

x_default_price_list_id := 0;

end if;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

6
end if;

END IGNORE_ITEMLINE_FOR_PRICING;

END QP_CUSTOM_IGNORE;

7
Example 2:

The user has identified a line flow say, zero_price_line. If the line_type_code
is defaulted/updated to this value before a pricing call then pricing for these lines
should be ignored and the price should be set to zero in sales order line.
CREATE OR REPLACE PACKAGE BODY QP_CUSTOM_IGNORE AS
PROCEDURE IGNORE_ITEMLINE_FOR_PRICING(p_request_type_code IN
VARCHAR2

,x_ignore OUT VARCHAR2

,x_default_price_list_id OUT NUMBER

IS

BEGIN

IF p_request_type_code = 'ONT' THEN

IF (OE_ORDER_PUB.G_LINE.line_type_code = 'ZERO_PRICE_LINE')
THEN

x_ignore := 'Y';

x_default_price_list_id := 12345;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

END IGNORE_ITEMLINE_FOR_PRICING;

END QP_CUSTOM_IGNORE;

8
Example 3

User has designed a specific format to name the option items those need to be
considered as zero priced. The names of these items end with _zp tag.
CREATE OR REPLACE PACKAGE BODY QP_CUSTOM_IGNORE AS
PROCEDURE IGNORE_ITEMLINE_FOR_PRICING(p_request_type_code IN
VARCHAR2

,x_ignore OUT VARCHAR2

,x_default_price_list_id OUT NUMBER

) IS

BEGIN

IF p_request_type_code = 'ONT' THEN

IF ( (OE_ORDER_PUB.G_LINE.item_type_code = 'OPTION' AND


(OE_ORDER_PUB.G_LINE.ordered_item LIKE '%_zp' )) THEN

x_ignore := 'Y';

x_default_price_list_id := 12345;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

END IGNORE_ITEMLINE_FOR_PRICING;

END QP_CUSTOM_IGNORE;

9
Example 4

User has designed to insert/update the attribute11 of Inventory items


descriptive flex field using the master items form. The value zero_price is
entered into attribute11 of all such items those need to be considered as zero
priced on a sales order line.
CREATE OR REPLACE PACKAGE BODY QP_CUSTOM_IGNORE AS
PROCEDURE IGNORE_ITEMLINE_FOR_PRICING(p_request_type_code IN
VARCHAR2

,x_ignore OUT VARCHAR2

,x_default_price_list_id OUT NUMBER

) IS

l_zp_attribute VARCHAR2(240);

BEGIN

IF p_request_type_code = 'ONT' THEN

SELECT attribute11 into l_zp_attribute

FROM mtl_system_items_b

WHERE inventory_item_id = OE_ORDER_PUB.G_LINE.inventory_item_id

AND organization_id = FND_PROFILE.VALUE('QP_ORGANIZATION_ID');

IF (l_zp_attribute = zero_price' ) THEN

x_ignore := 'Y';

x_default_price_list_id := 12345;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

END IGNORE_ITEMLINE_FOR_PRICING;
END QP_CUSTOM_IGNORE;

10
Example 5

User has designed to have a special item category (category_id = 55555) and
assign only those items that are to be considered as zero price items to that item
category.
CREATE OR REPLACE PACKAGE BODY QP_CUSTOM_IGNORE AS
PROCEDURE IGNORE_ITEMLINE_FOR_PRICING (

p_request_type_code IN VARCHAR2

,x_ignore OUT VARCHAR2

,x_default_price_list_id OUT NUMBER

) IS

l_zp VARCHAR2(1);

BEGIN

IF p_request_type_code = 'ONT' THEN

SELECT Y into l_zp FROM dual

WHERE EXISTS (SELECT 1 from mtl_item_categories

WHERE category_id = 55555

AND inventory_item_id =
OE_ORDER_PUB.G_LINE.inventory_item_id);

IF (l_zp = Y' ) THEN

x_ignore := 'Y';

x_default_price_list_id := 12345;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

END IGNORE_ITEMLINE_FOR_PRICING;
END QP_CUSTOM_IGNORE;

11
Example 6

Customer maintains a custom table X_ZERO_PRICE_ITEMS that explicitly


stores the items those need to be considered as zero priced items.
CREATE OR REPLACE PACKAGE BODY QP_CUSTOM_IGNORE AS
PROCEDURE IGNORE_ITEMLINE_FOR_PRICING (

p_request_type_code IN VARCHAR2

,x_ignore OUT VARCHAR2

,x_default_price_list_id OUT NUMBER )

IS

l_zp VARCHAR2(1) := N;

BEGIN

IF p_request_type_code = 'ONT' THEN

SELECT Y into l_zp FROM dual

WHERE EXISTS (SELECT 1 FROM x_zero_price_items

WHERE inventory_item_id =
OE_ORDER_PUB.G_LINE.inventory_item_id);

IF (l_zp = Y' ) THEN

x_ignore := 'Y';

x_default_price_list_id := 12345;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

ELSE

x_ignore := 'N';

x_default_price_list_id := 0;

END IF;

END IGNORE_ITEMLINE_FOR_PRICING;
END QP_CUSTOM_IGNORE;

12
More Implementation Notes

For further performance gain, we recommend to implement some caching


mechanism since the same item for same line can be repeatedly processed for
different pricing calls for various pricing events. This will help by not executing
the same query in the same session.

Patches delivering the QP_CUSTOM_IGNORE.ignore_itemline_for_pricing


functionality
Release 11.5.10 Please apply patch 8203943
Release 12.0 - Please apply patch 8266809:R12.QP.A

13
Ignore Pricing for Order Lines Custom Hook
April, 2009
Authors: Rajendra Badadare, Smitha Balaraman.
Co-Authors: Shankar Kattamanchi, Dharmender Gupta, Kelli Stone.
Copyright Oracle Corporation 2009
All Rights Reserved Printed in the U.S.A.

This document is provided for informational purposes


only and the information herein is subject to change
without notice. Please report any errors herein to
Oracle Corporation. Oracle Corporation does not
provide any warranties covering and specifically
disclaims any liability in connection with this document.

Oracle is a registered trademark and Enabling the


Information Age are trademarks
of Oracle Corporation.

Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.

Worldwide Inquiries:
415.506.7000
Fax 415.506.7200

Copyright Oracle Corporation 1995


All Rights Reserved

14

You might also like