Você está na página 1de 20

An Oracle White Paper

January 2018

Order Total Discounts for R11


Disclaimer
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon in
making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
Order Total Discounts for R11
Functional Description of the Use Case – Apply percent based discounts at Order
Header leveraging the discount rules created from Pricing Administration for All Items. The
selected discount rule at Order Header using the Headers Extensible Flex Fields will be applied to
all the Lines.

Customers who wish to implement this functionality in Release 11 need to perform the following
steps
Customizations Steps

1. Pricing Setup Changes


2. Define EFF’s for Order Header
3. Service Mappings changes
4. Algorithm Primer
5. Algorithm Changes
6. Upgrade Considerations
7. Test the changes
8. FAQ & Known Issues

1. Pricing Setup Changes

a. Create a new Price Element with the name ‘Running Price’, Code as
‘RUNNING_PRICE’ of type Price using Fusion Setup Manager -> Manage Price
Elements and Activate the element.

b. Based on the requirement to apply Tier/Simple rule on the discount total, create a
Pricing Basis with Basis type Tier/Adjustment using Fusion Setup Manager ->
Manage Pricing Bases and set the Price element as the element created in the
previous step. Ensure that the charge criteria for Tier Basis includes all the charges
on which the discount rule is based on.

c. For the terms to be shown in the EFF List of Values for Order Header, Create a
Discount List and Add a discount rule for Item Level as ‘All Items’ and create a
simple/tier/attribute discount rule and ensure that the Tier/Adjustment basis is
set with the basis created in the previous step. Also ensure that this discount list is
not added to any Strategy, else this discount will be picked up without the EFF
setup at the Order header and will result in Invalid basis error.

d. Ensure that the Price Type, Charge Type and Charge SubType is selected according
to the requirement of the discounts. Eg: If you want the discounts to be applied
on all One Time Charges, set the Price Type, Charge Type and Charge SubType as
‘One Time’, ‘All’ and ‘All’ respectively.

3
2. Define EFF’s for Order Header
Define EFFs as shown below

a. Login as Pricing User.

b. Navigate to ‘Setup and Maintenance’.

c. Search for Task ‘Manage Extensible Flexfields’ Functional Setup Manager (FSM) task

d. Search for Extensible Flexfield with Name ‘Header Information’ and click on Edit

e. Click on ‘Manage Contexts’ in the Edit Extensible Flexfield page.

f. Click on ‘+’ button in Manage Contexts page.

g. Add the following details in the Create Context page.

Display Name Pricing Header Information


Code Pricing Header Information
API name PricingHeaderInformation
Enabled Yes
Behavior Single Row

4
h. Under Context Usages, Add a new row and set Name as Additional Header Information
and View Privileges and Edit Privileges as None.

i. Click on Save. Add a new row under Context Sensitive Segments and add the
following details for ‘Create Segment’ and click on ‘Create Value Set’
Name Discount Rule
Code DiscountRule
API Name discountRule
Enabled Yes
Data Type Number
Table Column ATTRIBUTE_NUMBER1

j. Under ‘Create Value Set’, enter the following details.

Value Set Code Pricing Terms


Module Application Flexfields
Validation Type Table
Value Data Type Number
FROM Clause QP_PRICING_TERMS_VL

5
Value Column Name PRICING_TERM_ID
Description Column Name NAME
ID Column Name PRICING_TERM_ID
WHERE Clause PARENT_ENTITY_TYPE_CODE='DISCOUNT_LINE' AND
PARENT_ENTITY_KEY_COLUMN1 IN (SELECT
qp_discount_list_items.DISCOUNT_LIST_ITEM_ID from
qp_discount_list_items where
qp_discount_list_items.ITEM_LEVEL_CODE='ALL_ITEMS')

k. Click on ‘Save and Close’ for the Value Set.

l. Click on ‘Save and Close’ for the Segment after validating the Value Set information

6
m. Click ‘Save and Close’ on the Edit Context page and ‘Done’ on the Manage
Contexts page.

n. In the Edit Extensible Flexfield: Header Information page, Under Category


‘Additional Header Information’ -> Details -> Pages, Add a new page.

o. Add the details as following and click OK on the popup.

p. Under the Category: Details -> Associated Contexts, Click on Select and Add.

7
q. Search and add the newly created Context ‘Pricing Header Information’.

r. Click ‘Save’. Under Pages -> Associated Context Details, Click ‘Select and Add’ and
add the newly added context.

s. Click on ‘Save and Close’.

t. Deploy the flex field.

u. Download the flexfield archive.

8
3. Service Mappings Changes
a. Open the zip file downloaded as part of the previous step, move to
'oracle\apps\scm\doo\processOrder\flex\headerContextsB\view\', open the View Object
Definition with the name 'HeaderEffBPricing__Header__InformationprivateVO.xml'.

b. Open Fusion Pricing -> Manage Service Mappings, Edit 'Sales' Service Mapping

c. In the Entities Tab, create a new entity as below:

Entity Description
PricingHdrEff_Custom Entity to save Order Header EFF values

d. Under PricingHdrEff_Custom Details, add 2 attributes as below:

Attribute Type Primary Key


HeaderId_Custom Long Checked
PricingTerm_Custom Long Unchecked

9
e. Under 'Services' tab, select the Service 'PriceSalesTransaction'. Under 'PriceSalesTransaction:
Details', in the 'Entities' tab, add a new row and associate the entity to pass the EFF value(s) to
pricing as below:

Entity Read Write


PricingHdrEff_Custom Checked Unchecked

f. Under PricingHdrEff_Custom: Entities', add the 2 attributes as below:

Attribute Read Write


HeaderId_Custom Checked Unchecked
PricingTerm_Custom Checked Unchecked

1
g. Under 'Sources' tab, select the Source 'OrderHeader'. Under 'OrderHeader: Details', in the
'Entity Mappings' tab, create a new entity mapping to the EFF VO attributes as below. This
step ensures that the EFF values are read from the EFF VO and passed to Pricing when the
order is priced using Price Order action or saving of the order.

Column Name Value


Entity PricingHdrEff_Custom
Type View Object
View Object HeaderEffBPricing__Header__InformationprivateVO
Query Type Unique Identifier
Query Attribute HeaderId Note: The View Object name should match the View Object
Definition Name in the Flex Field Archive mentioned in Step A
above without the '.xml'

h. In the same region above, under PricingHdrEff _Custom: Details', add attributes as below:
Attribute View Object Attribute
HeaderId_Custom HeaderId
PricingTerm_Custom Eg. pricingTerm

Note: The View Object Attribute name should


match the <ViewAttribute Name="pricingTerm" tag in
the
Flex Field Archive mentioned in Step A above

1
4. Algorithm Primer
Here is a reference to the algorithm primer. We recommend reading this is as a pre-
requisite before starting algorithm customizations.

5. Algorithm Changes
a. Import the Custom algorithm which applies discounts to all the lines that are part
of the Order Header based on the EFF setup on the Order Header.

b. Download the zip file CreateOrderTotalDiscountCustom.zip included below to


your local computer drive. In Fusion Pricing -> Manage Algorithms, Actions ->
Import, choose the attached zip. This will create a version 1 of algorithm 'Create
Order Total Discount Custom'. Edit the version 1 of the imported algorithm and
add suitable description to indicate the intent of the custom algorithm.

CreateOrderTotalDiscountCustom.zip

c. The algorithm uses the Entity Name and Attributes as PricingHdrEff_Custom ,


HeaderId_Custom and PricingTerm_Custom respectively as mentioned in the
document above. If the name of the custom entity and attributes are different
from the ones mentioned above, Modify the conditions and datasets to map to
the correct entity and attribute names in Algorithm steps 1, 2 and 3.

1
d. The algorithm also uses the Price Element Code as ‘RUNNING_PRICE’ – the
element created as part of the previous setup. If the element was created with a
different code, ensure that Assignment Value under Step 5 -> Input Variables ->
PriceElement is changed to represent the elements code.

1
e. After making all the changes, Save the algorithm, re-open ‘Manage Algorithms’
page, select the Algorithm ‘Create Order Total Discount Custom’ , Click Actions ->
Publish.

f. In Fusion Pricing -> Manage Algorithms, search for algorithm 'Price Sales
Transactions', click on the most current version used in FOM Pricing, click Actions
-> Create Version, say this creates Version 2. Click Actions -> Edit, Edit the
description to add to the existing one a brief note on the functionality being
achieved via the customization and the name of the person who can be contacted
in case of issues eg. 'This version calls the sub algorithm which applies discount
rules populated on the Order Header Information EFF. Author: Jdoe.'

g. Create a sub-algorithm step after Step 28 ‘Apply Manual Adjustments for Pricing
Charges’ to invoke the ‘Create Order Total Discount Custom' algorithm created
above and pass the PriceRequest as input and output variables.

1
h. After making all the changes, Save the algorithm, re-open ‘Manage Algorithms’
page, select the latest version of the Algorithm ‘Price Sales Transaction’ , Click
Actions -> Publish.

6. Upgrade Considerations

a. In Release 13, the structure of the Price Sales Transaction algorithm has changed
and all the Price adjustments are applied from ‘Create Pricing Charges’ algorithm.
hence to ensure that these changes work with Release 13, remove the
customization done to ‘Price Sales Transaction’ as part of the above step.

b. Create a new version of ‘Calculate Pricing Charges’ and Create a sub-algorithm


step after ‘Apply Manual Adjustments for Pricing Charges’ step to invoke the
‘Create Order Total Discount Custom' algorithm created above and pass the
PriceRequest as input and output variables.

1
7. Test the changes

a. Test the Price Sales Transaction Version 2 thoroughly to make sure this works correctly
and applies MPAs and overrides the prices as expected and does not cause any
regressions when there are no price overrides.

b. Here is a test payload to test the Price Sales Transactions Algorithm. Make the necessary
changes noted in the payload. In the Test tab, create a test case with Test Case Name =
"Order Total Discount Test". Under the Test Input tab, select the row with Variable Name
'Price Request', edit the default Variable Value, select all the lines of the default payload
and paste the payload below. Click the 'Run' button. Now click the Test Output tab and
you will see that the discount with the specified PricingTermId is applied on the line.

Test Input Payload


<?xml version="1.0" encoding="UTF-8"?>
<PriceRequestInternal:PriceRequestInternalType
xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/"
xmlns:PriceRequestInternal="http://xmlns.oracle.com/apps/scm/pricing/priceExecutio
n/pricingProcesses/PriceRequestInternal" Change the attribute values for CustomerId xxx,
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SellingBusinessUnit xx1 and SellingLegalEntityId xx2 to a valid
xsi:type="PriceRequestInternal:PriceRequestInternalType">
customerId in your system
<PriceRequestInternal:Header>
Check the FAQ on how to retrieve the IDs for the values
<PriceRequestInternal:CustomerId>xxx</PriceRequestInternal:CustomerId>
shaded in RED in the payload
<PriceRequestInternal:HeaderId>101</PriceRequestInternal:HeaderId>

<PriceRequestInternal:CalculatePricingChargesFlag>true</PriceRequestInternal:Calcu
latePricingChargesFlag>
<PriceRequestInternal:CalculateShippingChargesFlag>false</PriceRequestInternal:Cal
culateShippingChargesFlag>
<PriceRequestInternal:CalculateTaxFlag>false</PriceRequestInternal:CalculateTaxFla
g>
<PriceRequestInternal:SellingBusinessUnitId>xx1</PriceRequestInternal:SellingBusin
essUnitId>

<PriceRequestInternal:SellingLegalEntityId>xx2</PriceRequestInternal:SellingLegalE
ntityId>

<PriceRequestInternal:TransactionTypeCode>ORA_SALES_ORDER</PriceRequestInternal:Tr
ansactionTypeCode>
</PriceRequestInternal:Header>
<PriceRequestInternal:PricingServiceParameter>

Change the ItemId yyy to a valid ItemId in your system


<PriceRequestInternal:PricingContext>SALES</PriceRequestInternal:PricingContext>
</PriceRequestInternal:PricingServiceParameter> Check the FAQ on how to retrieve the IDs for the values
<PriceRequestInternal:Line> shaded in RED in the payload
<PriceRequestInternal:HeaderId>101</PriceRequestInternal:HeaderId>

<PriceRequestInternal:InventoryItemId>yyy</PriceRequestInternal:InventoryItemId>

<PriceRequestInternal:InventoryOrganizationId>yy1</PriceRequestInternal:InventoryO
rganizationId>
<PriceRequestInternal:LineId>1001</PriceRequestInternal:LineId>

<PriceRequestInternal:LineCategoryCode>ORDER</PriceRequestInternal:LineCategoryCod
e>
<PriceRequestInternal:LineQuantity unitCode="yy2"
xmlns:tns="http://xmlns.oracle.com/adf/svc/errors/">2</PriceRequestInternal:LineQu
antity>

<PriceRequestInternal:LineQuantityUOMCode>yy2</PriceRequestInternal:LineQuantityUO
MCode>
Indicates the PricingTermId that needs to be applied on all the
lines.
<PriceRequestInternal:LineTypeCode>ORA_BUY</PriceRequestInternal:LineTypeCode>
</PriceRequestInternal:Line>
<PriceRequestInternal:PricingHdrEff_Custom>

1
<PriceRequestInternal:PricingTerm_Custom>300100110522449
</PriceRequestInternal:PricingTerm_Custom >

<PriceRequestInternal:HeaderId_Custom>101</PriceRequestInternal:HeaderId_Custom>
</PriceRequestInternal:PricingHdrEff_Custom>

<PriceRequestInternal:ChangeSummary logging="false" xmlns:sdo="commonj.sdo"/>


</PriceRequestInternal:PriceRequestInternalType>

8. FAQ & Known Issues

1 SQLs to derive the IDs in the Test Input Payload


Header Attributes
Header.CustomerId
Header.SellingBusinessUnitId
Header.SellingLegalEntityId
Create an order with the Customer and BU that you want to use for testing and note the Order# eg.
12345. Then use the query below replacing the $OrderNumber with the OrderNumber of the Order
you created.
select header_id, sold_to_party_id as CustomerId, org_id as SellingBusinessUnitId, legal_entity_id as
SellingLegalEntityId
from doo_headers_all where Order_Number = $OrderNumber;

Line Attributes
Line.InventoryItemId
Line.InventoryOrganizationId
Line.LineQuantity.UOMCode
Line.LineQuantityUOMCode
Create an order line on the above order with the item that you want to use for testing. Then use the
query below to derive the IDs for the attributes above. Remember to replace the header_id in the
query below with the header_id returned in the query above. Note that the UOMCode "Ea" appears
in 2 places as highlighted in RED in the payload and both need to be replaced with the value returned
from the query.
select inventory_item_id as InventoryItemId, inventory_organization_id as InventoryOrganizationId,
ordered_uom as LineQuantityUOMCode from doo_fulfill_lines_all where header_id = $header_id;

Header EFF Attributes


PricingTerm_Custom

This needs to be replaced with Pricing_term_id retrieved from the query below based on the discount
rule that needs to be applied.
select name,pricing_term_id from qp_pricing_terms_vl where
parent_entity_type_code='DISCOUNT_LINE' and
PARENT_ENTITY_KEY_COLUMN1 in (select qp_discount_list_items.DISCOUNT_LIST_ITEM_ID from
qp_discount_list_items where
qp_discount_list_items.ITEM_LEVEL_CODE='ALL_ITEMS');

1
2 Error below while testing the algorithm
Error: Unable to parse the variable[PriceRequest] using the service 
definition [Sales.PriceRequestInternal]. Please check the variable value or service schema

This error usually means that the XML in the test case input is not a valid XML.
Please use an XML editor and make sure the XML is a valid XML.

3 Error while publishing the algorithm:

Indication: This error occurs when there is a change made to the algorithm and when trying to publish
immediately after saving the changes.
Workaround: In the Manage Algorithms page, use the QBE as shown in the screen shot below, change
the search criteria eg. %Cust% and hit enter and perform the search and search again and then try
publishing. Once this error appears Actions->Deactivate, Actions->Activate and Actions -> Publish to
republish the algorithm.

4 Error(s) while testing algorithms in the Algorithm Tester

Indication: Error occurs when there are unsaved changes in the input payload and the user tries to
run the test case
Workaround: Save the changes before running the test case. Once the error appears, user needs to
Cancel the algorithm edit, go to the Manage Algorithm page, reopen the algorithm and re-run the test

1
case.

1
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and the
January 2018
contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other
Author: Priya Gopal
warranties or conditions, whether expressed orally or implied in 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
Oracle Corporation formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any
World Headquarters means, electronic or mechanical, for any purpose, without our 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. 0612
Fax: +1.650.506.7200

oracle.com

Você também pode gostar