You are on page 1of 20

An Oracle White Paper

March 2015

LCM – QP Integration:
How to Generate Charges Using Charges
Hook, Get Custom Price, and Modifiers
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

Disclaimer

Oracle does not provide support for any sample code in this document. Any sample in this document is
intended for educational purposes only and may not be implementable.
It is the customer’s responsibility to carefully review, adapt, test, and maintain any code in the custom hooks.
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

LCM – QP Integration: How to Generate Charges Using Charges


Hook, Get Custom Price, and Modifiers

The major goal of this document is to explain how to use the existing tools to generate charges
during the Generate Charge actual included in the landed cost shipments creation cycle.

It is divided into the following sections:


1. How to use the LCM Charges Hook and Advanced Pricing Engine at the same time
2. How to use the QP Get Custom Price in an LCM implementation
3. How to create charges for specific item categories using QP Modifiers
4. Charges Calculation Example for an LCM Shipment

The calculation examples consider that the charges are generated from all of the following
mechanisms: The LCM charges hook, Get Custom Price (from Advanced Pricing engine), and
Modifiers (also from Advanced Pricing engine).

To solve the proposed business case to have the charge calculation from all mechanisms at
the same time, it is necessary have the LCM Charges Hook working in parallel with Advanced
Pricing Engine. This is achieved by setting the variable x_override_default_processing. When
this variable set to false, the Advanced Pricing engine is called after the LCM charges hook
completes.

If your scenario requires the use of LCM charges hook only, set the variable
x_override_default_processing to true, and LCM will not call the Advanced Pricing engine
during the charges generation process.

If your scenario requires the use of Advanced Pricing only, do not enable the LCM charges
hook.

1
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

1. How To Use The LCM Charges Hook And Advanced Pricing


Engine At The Same Time
The following guidelines apply to a hypothetical business case where a container fee should be
calculated at the header level of LCM shipments.
The container fee calculation formula is:
Container Fee Amount = Number of Containers * Container Fee Factor
The contained fee factor is a numeric constant defined for each container type, as follows:
Container Type Container Type Description Container Fee Factor

20DRY 20 feet dry container 2,000

20REF 20 feet refrigerated container 2,900

40DRY 40 feet dry container 3,000

40REF 40 feet refrigerated container 3,900

The container type is associated at shipment headers

Implementation Logic
The implementation steps are presented as follows:
1. Create a descriptive flexfield in the LCM Shipment Workbench – Shipment headers page to
store the container type information.
Define a value set for the container types:
Navigate to Inventory -> Setup -> Flexfields -> Validation -> Sets

Define the possible values for the value set C_SAMPLE_CONT_TYPE:


Navigate to Inventory -> Setup -> Flexfields -> Validation -> Values

2
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

2. Create a descriptive flexfield in the LCM Shipment Workbench – Shipment headers page to
store the number of containers for each shipment.
Define a value set for the container types:
Navigate to Inventory -> Setup -> Flexfields -> Validation -> Sets

3. Define the descriptive segments:


Navigate to Inventory -> Setup -> Flexfields -> Descriptive -> Segments and find for title Shipment
Headers from application Oracle Landed Cost Management. Don’t forget to freeze and compile the
descriptive flexfield.

3
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

Note: for additional information, please refer to Oracle E-Business Suite Flexfields Guide

4. Enable the flexfield for Create Shipment Headers and Update Shipment Headers OAF pages
by following the note EBS How to Enable Descriptive FLEXFIELDS in LCM
SHIPMENT HDR and LINE (Doc ID 972178.1)

4
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

5. Review the note HOW TO CUSTOMIZE CHARGES GENERATION IN LCM (Doc


ID 1218614.1) before proceeding to the next steps
6. Set the variable x_override_default_processing as false in the procedure Get_Charges from the
package INL_CUSTOM_PUB. When the x_override_default_processing is set to false, the
Advanced Pricing engine is called after the Get_Charges processing is completed.
create or replace
PACKAGE BODY INL_CUSTOM_PUB AS

(...)

PROCEDURE Get_Charges(
p_ship_header_rec IN inl_ship_headers%ROWTYPE,
p_ship_ln_group_tbl IN inl_charge_pvt.ship_ln_group_tbl_tp,
p_ship_ln_tbl_tp IN inl_charge_pvt.ship_ln_tbl_tp,
x_charge_ln_tbl OUT NOCOPY inl_charge_pvt.charge_ln_tbl,
x_override_default_processing OUT NOCOPY BOOLEAN,
x_return_status OUT NOCOPY VARCHAR2
) IS
BEGIN
x_override_default_processing := FALSE;

INL_CUSTOM_SAMPLE.Get_Charges(
p_ship_header_rec => p_ship_header_rec,
p_ship_ln_group_tbl => p_ship_ln_group_tbl,
p_ship_ln_tbl => p_ship_ln_tbl_tp,
x_charge_ln_tbl => x_charge_ln_tbl,
x_return_status => x_return_status);

RETURN;
END Get_Charges;

(...)
7. Customize the procedure INL_CUSTOM_PUB.Get_Charges and apply the desired calculation
logic.
In the following example, it was created a new package INL_CUSTOM_SAMPLE that
contains the procedure Get_Charges.
The code will get the container type and number of containers from the shipment headers
descriptive flexfileds; and then, the container factor is derived from the container type.

create or replace
PACKAGE BODY INL_CUSTOM_SAMPLE AS

PROCEDURE Get_Charges(
p_ship_header_rec IN inl_ship_headers%ROWTYPE,
p_ship_ln_group_tbl IN inl_charge_pvt.ship_ln_group_tbl_tp,
p_ship_ln_tbl IN inl_charge_pvt.ship_ln_tbl_tp,
x_charge_ln_tbl OUT NOCOPY inl_charge_pvt.charge_ln_tbl,
x_return_status OUT NOCOPY VARCHAR2)
IS
i number;
l_debug_info varchar2(3000);
charge_ln inl_charge_pvt.charge_ln_rec;

l_container_fee NUMBER := 0;
l_container_type VARCHAR2(20);

BEGIN

-- The container type is defined in the attribute1 from ship headers


-- The number of containers is stored in the attribute2 from ship headers

IF p_ship_header_rec.attribute1 = '20DRY'
THEN l_container_fee := 2000 * nvl(p_ship_header_rec.attribute2,0);
ELSIF p_ship_header_rec.attribute1 = '40DRY'

5
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

THEN l_container_fee := 3000 * nvl(p_ship_header_rec.attribute2,0);


ELSIF p_ship_header_rec.attribute1 = '20REF'
THEN l_container_fee := 2900 * nvl(p_ship_header_rec.attribute2,0);
ELSIF p_ship_header_rec.attribute1 = '40REF'
THEN l_container_fee := 3900 * nvl(p_ship_header_rec.attribute2,0);
END IF;

IF l_container_fee > 0 THEN


x_charge_ln_tbl(1).charge_line_type_id := 5062; --Charge line type id for "Container Fee" from
view INL_CHARGE_LINE_TYPES_VL
x_charge_ln_tbl(1).landed_cost_flag := 'Y';
x_charge_ln_tbl(1).update_allowed := 'Y';
x_charge_ln_tbl(1).source_code := 'CHG_HOOK';
x_charge_ln_tbl(1).charge_amt := l_container_fee;
x_charge_ln_tbl(1).currency_code := 'USD';
-- Association attributes
x_charge_ln_tbl(1).to_parent_table_name := 'INL_SHIP_HEADERS';
x_charge_ln_tbl(1).to_parent_table_id := p_ship_header_rec.ship_header_id;
END IF;

(...)

END Get_Charges;

END INL_CUSTOM_SAMPLE;

This finishes the steps to generate the charge line “container fee” by using the LCM Charges Hook. An
example of the calculating results is presented in a dedicated section. Please notice the container fee
charge was generated by the LCM Charges Hook.

6
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

2. How To Use The QP Get Custom Price In An LCM


Implementation
The following guidelines apply to a hypothetical business case where a packaging fee should be
calculated for the shipment lines.
The packaging charge amount calculation formula is:
Packaging Amount = Packaging Factor * Constant

The following table defines the packaging factor definition is shown as follows:
Packaging Class Packaging Factor

1 1.00 * Line Quantity

2 1.25 * Line Quantity

3 1.50 * Line Quantity

Where the packaging class is associated to the inventory items.

Implementation Logic
1. Create a descriptive flexfield in the inventory items to store the packaging class information
for each item for a given organization. The packaging class is used by the code included in the
Get Custom Price function from QP_CUSTOM.
2. Define a value set for the container types:
Navigate to Inventory -> Setup -> Flexfields -> Validation -> Sets

7
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

3. Define the possible values for the value for the packaging class:
Navigate to Inventory -> Setup -> Flexfields -> Validation -> Values

4. Define the descriptive segment: Navigate to Inventory -> Setup -> Flexfields -> Descriptive ->
Segments and find for title Items from application Oracle Inventory.
Don’t forget to freeze and compile the descriptive flexfield.

8
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

 For additional information, please refer to Oracle E-Business Suite Flexfields Guide

5. Create a pricing formula that uses the custom price function.


Navigate to Purchasing -> Advanced Pricing -> Pricing Formulas -> Formulas Setup. Make sure to take
note of the price_formula_id using Tools -> Examine

9
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

6. Create a modifier that uses the formula previously created.


Navigate to Purchasing -> Advanced Pricing -> Modifiers -> Modifiers Setup.

10
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

7. Extend the package QP_CUSTOM and implement the calculation logic.


For additional information, refer the section Get Custom Price from Oracle Advanced
Pricing Implementation Guide.

create or replace
PACKAGE BODY QP_CUSTOM AS
/*Customizable Public Function*/
FUNCTION Get_Custom_Price (p_price_formula_id IN NUMBER,
p_list_price IN NUMBER,
p_price_effective_date IN DATE,
p_req_line_attrs_tbl IN QP_FORMULA_PRICE_CALC_PVT.REQ_LINE_ATTRS_TBL)
RETURN NUMBER IS

l_organization_id NUMBER := PO_ADVANCED_PRICE_PVT.G_LINE.to_organization_id;


l_inventory_item_id NUMBER;
l_pck_class VARCHAR2(1);
l_package_factor NUMBER;
l_quantity NUMBER;

BEGIN

IF p_price_formula_id = 28265 THEN


BEGIN

FOR i IN 1..p_req_line_attrs_tbl.count
LOOP
-- Assign Inventory Item ID
IF (p_req_line_attrs_tbl(i).attribute_type = 'PRODUCT') AND
(p_req_line_attrs_tbl(i).context = 'ITEM') AND
(p_req_line_attrs_tbl(i).attribute = 'PRICING_ATTRIBUTE1')
THEN
l_inventory_item_id := p_req_line_attrs_tbl(i).value;
END IF;

-- Assign Quantity
IF (p_req_line_attrs_tbl(i).attribute_type = 'PRICING') AND
(p_req_line_attrs_tbl(i).context = 'VOLUME') AND
(p_req_line_attrs_tbl(i).attribute = 'PRICING_ATTRIBUTE10')
THEN
l_quantity := p_req_line_attrs_tbl(i).value;
END IF;

11
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

END LOOP;

-- Get the packaging class from each item


SELECT msi.attribute20 INTO l_pck_class
FROM mtl_system_items msi
WHERE msi.inventory_item_id = l_inventory_item_id
AND msi.organization_id = l_organization_id;

-- Calculate the package factor that will be returned to the formula


IF l_pck_class = '1' THEN l_package_factor := 1 * l_quantity;
ELSIF l_pck_class = '2' THEN l_package_factor := 1.25 * l_quantity;
ELSIF l_pck_class = '3' THEN l_package_factor := 1.5 * l_quantity;
END IF;

RETURN l_package_factor;

END;
END IF;

EXCEPTION
WHEN OTHERS THEN
RETURN null;

END get_custom_price;
END QP_CUSTOM;

This finishes the steps to generate the charge line “packaging” by using the QP Custom Price function.
An example of the calculating results is presented in a dedicated section. Please notice the packaging
charge was generated by the QP Custom Price function.

12
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

3. How To Create Charges For Specific Item Categories Using QP


Modifiers
The following guidelines apply to a hypothetical business case where a duty fee should be calculated
for the applicable item lines.
The duty fee rate is defined as a percentage applied to the item line price and it is defined at item
category level, as follows.
Category Duty Rate (%)

PRODUCTN.FINGOODS 20

EQUIPMENT.A/V 10

Implementation Logic
The following steps show how to create charges for specific item categories:
1. Create modifiers that use
• Product Attribute = Item Category
• Enter the Category in the field Product Attribute Value
• Enter Percent in the field Application Method
• Enter the Duty Rate in the field Value.
2. Navigate to Purchasing -> Advanced Pricing -> Modifiers -> Modifiers Setup

13
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

This finishes the steps to generate the charge line “duty” by using the modifier setup defining a specific
product attribute and product attribute value combination for which the duty charge should be
generated. An example of the calculating results is presented in a dedicated section.

14
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

4. Charges Calculation Example for an LCM Shipment


This section shows a landed cost shipment that contains charge lines that have been calculated using
the all the recommended steps described in this document.

1. A LC shipment is created as a consolidated shipment from two purchase orders placed from a
plant in US to two suppliers in China.
The container type and number of containers are defined in the shipment header descriptive
flexfields.

2. The Container Fee charge, which is created by the Charges Hook, is successfully generated
and associated to the shipment header.
The container fee is calculated as follows:
Container Type Number of Containers Formula Amount

20DRY 1 2,000 * 1 2,000

15
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

3. The following item information is used when calculating the packaging and duty fees.
Item Category Packaging Class

AS18947 PRODUCTN.FINGOODS 3

AS92689 PRODUCTN.FINGOODS 2

AS20000 EQUIPMENT.A/V 1

4. The packaging charges are generated using the Get Custom Price functionality for each one of
the item lines. Note the item lines may belong to different shipment line groups
The packaging charge amount is calculated as follows:
Item Packaging Class Quantity Formula Packaging Amount

AS18947 3 400 1.5 * 400 * 1 600.00

AS92689 2 500 1.25 * 500 * 1 625.00

AS20000 1 400 1 * 400 * 1 400.00

16
LCM – QP Integration: How to Generate Charges Using Charges Hook, Get Custom Price, and Modifiers

5. And the duty charge is successfully generated for each shipment line according to the item
category. The following table shows duty fee amount calculation:

Item Category Amount Formula Duty Fee Amount

AS18947 PRODUCTN.FINGOODS 400 * 900 360,000 * 20% 72,000.00

AS92689 PRODUCTN.FINGOODS 500 * 2,000 1,000,000 * 20% 200,000.00

AS20000 EQUIPMENT.A/V 400 * 300 120,000 * 10% 12,000.00

6. The final landed cost calculation can be observed using the “View Landed Costs” action from
LC shipments workbench:

17
How to Use QP Get Custom Price and Charges Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
LCM Charges Hook at the Same Time
This document is provided for information purposes only, and the contents hereof are subject to change without notice. This
March 2015
document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in
Author: LCM Team law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any
liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This
Oracle Corporation document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our
World Headquarters prior written permission.
500 Oracle Parkway
Redwood Shores, CA 94065 Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
U.S.A.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and
Worldwide Inquiries:
are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are
Phone: +1.650.506.7000
trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 0113
Fax: +1.650.506.7200

oracle.com

You might also like