Setting Up Default Rules

This chapter covers the following topics:

Overview of Default Rules

Default rules enable you to create and update quotes easily. Based on the setup, appropriate fields in the quote are automatically filled in. Oracle Quoting has predefined default rules that mirror the behavior of the application when default values are hard coded. However, you have the flexibility to disable the predefined rules and add your own.

You can enable default rules by setting the ASO: Enable Defaulting Rule profile to Yes. See Profile Options for Displaying Default Values for more details.

The following sections explain some terms that are part of the default rules setup.

Default Rules

Default rules automatically display values into fields in a quote (both header and line). You can define the rules and the sequence in which the display of values into fields must take place. You can also define the trigger and dependant fields.

You can set up default rules such that most of the mandatory and business rules-centric fields are taken care of. By doing so, you can focus on other aspects of the quote.

Entities

Entities represent specific flows in Oracle Quoting where default rules are used. The entities in Quoting are Quote Header, Quote Line, and Quote Opportunity.

Default Condition Templates

Default condition templates act like top-level filters based on which the corresponding default rules are executed. Entities are the conditions for the filters. Each entity has attributes. Default rules are applicable to these attributes within an entity.

For example, Payment Type and Customer are entities. The attributes for these entities are Credit card and Business World respectively. Always is a generic condition.

Attributes

Attributes are individual fields in the quote. Default rules are created for some of the quote attributes. The default rule indicates what the default value for the attribute should be and the source from where it should be derived. Based on the default condition, the corresponding default rule is chosen for the attribute.

Source Types

The source types provide default values for the quote attributes. The following are the predefined source types for Oracle Quoting.

Predefined Source Types for Quote Attributes Default Values
Source Type Meaning
Same Record Using 'Same Record' as a source type, you can provide a default value of an attribute from another attribute on the same entity record. For example-
  • The Customer Name and Account Number of the quote can be used as a source for providing the default values for billing Customer Name and Account Number.

  • The Expiration Date can be used as a source for providing the default value for the Pricing Date.

System Variable This system variable source option enables you to provide system variables or functions of system variables for a field by default. This may be used to provide default values for date fields where SYSDATE expression or functions on SYSDATE are used to provide default value for the current date or a function of the current date. For example, you can set up the quote expiration date to be SYSDATE+30.
Constant Value This source type enables you to specify a constant value instead of a field that contains a value. This will be useful if you want the default value to be the same value or to be used if none of the other sources for the default rule can provide a value.
Profile Option This enables you to use a profile option, either system or user-defined, as a default value source.
PL/SQL API This source type enables you to set up a complex default rule that cannot be defined with the other source types listed above. The logic to derive the default value is coded into a PL/SQL API. The API name is referenced within the default rule setup. See Predefined API Signature for PL/SQL for more information.
Related Record The related record can derive values from the corresponding field in the Quote Header.

Important: This source type is applicable only for line-level attributes.

Sequencing in Default Rules

Sequencing is the order in which the default rules are applied. Each attribute is associated with a value which determines its sequence.

Trigger and Dependent Attributes

A trigger attribute has one or more dependent attributes that must be displayed when the trigger attribute's value is changed. A dependent attribute must be cleared and displayed by default if the corresponding trigger attribute is changed. For example, a default rule can be defined to derive a value for the payment terms and price list attributes if the pricing agreement is changed. In this example, the pricing agreement is the trigger attribute and the payment terms and price list are dependent attributes.

In Oracle Quoting, you can enable dependencies through the Dependency Enabled flag. While setting up trigger and dependent attributes, it is important not to setup cyclical dependencies. Thus, if trigger attribute A has dependent attributes B, C, D and trigger attribute C has dependent attribute A, then there is a cyclical dependency for attribute A. This type of cyclic dependency should be avoided.

Predefined Mapping Between Trigger and Dependent Attributes

The tables below indicate the predefined mapping between the trigger and the dependent attributes. The current dependencies are enabled by setting the Dependency Enabled flag. You may disable a dependency between the trigger and dependent attributes by setting this flag to No.

Predefined Mapping Between Trigger and Dependent Attributes (Quote Header)
Trigger Attribute Dependent Attribute Predefined Value for Dependency Enabled (Yes or No)
Operating Unit Order Type
Price List
Primary Salesperson
Contract Template
Shipping Method
Yes
Yes
Yes
Yes
Yes
Order Type Price List
Shipping Priority
Shipping Method
FOB
Demand Class
Freight Terms
Yes
No
No
No
No
No
Pricing Agreement PO Number
Payment Terms
Billing Customer Name
Billing Customer Account
Freight Terms
Price List
No
Yes
No
No
No
Yes
Customer Name of quote Contact Name
Address
Phone
Billing Customer Name
Billing Account Number
Billing Contact Name
Billing Address
Shipping Customer Name
Shipping Account Number
Shipping Contact Name
Shipping Address
End Customer Name
End Customer Account Number
End Customer Contact Name
End Customer Address
Automatic Pricing
Automatic Tax
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
No
No
No
No
No
Customer Account of a quote Price List
FOB
Freight Terms
Requested Date Type
Yes
No
No
Yes
Billing Customer Account Price List
FOB
Freight Terms
Payment Terms
Primary Salesperson
Shipping Method
Order Type
No
No
No
No
No
No
No
Billing Address (Party Site) - If Billing Customer Account is specified Price List
FOB
Demand Class
Freight Terms
Payment Terms
Primary Salesperson
Shipping Method
Order Type
No
No
No
No
No
No
No
No
Ship To Customer Account Price List
FOB
Freight Terms
Payment Terms
Primary Salesperson
Shipping Method
Order Type
No
No
No
No
No
No
No
Ship To Address (Party Site) - If Ship To Customer Account is specified) Price List
FOB
Demand Class
Freight Terms
Payment Terms
Primary Salesperson
Shipping Method
Order Type
No
No
No
No
No
No
No
No
Price List Payment Terms
Freight Terms
Shipping Method
No
No
No
Primary Salesperson Primary Salesgroup Yes
Predefined Mapping Between Trigger and Dependent Attributes (Quote Line)
Trigger Attribute Dependent Attribute Predefined Value for Dependency Enabled (Yes or No)
Line Type Price List
Shipment Priority
FOB
Demand Class
Freight Terms
Warehouse
No
No
No
No
No
No
Pricing Agreement PO Number
Payment Terms
Billing Customer Name
Billing Customer Account
Freight Terms
Price List
No
No
No
No
No
Yes
Billing Customer Account Price List
FOB
Freight Terms
Payment Terms
Shipping Method
No
No
No
No
No
Billing Address (Party Site) - If Billing Customer Account is specified) Price List
FOB
Demand Class
Freight Terms
Payment Terms
Shipping Method
No
No
No
No
No
No
Ship to Customer Account Price List
FOB
Freight Terms
Payment Terms
Shipping Method
No
No
No
No
No
Ship to Address (Party Site) - If Ship to Customer Account is specified) Price List
FOB
Demand Class
Freight Terms
Payment Terms
Shipping Method
No
No
No
No
No
No
Price List Payment Terms
Freight Terms
Shipping Method
No
No
No

If you change the predefined dependencies, you must run the Order Capture Dependency concurrent program. See Order Capture Dependency Generator concurrent program for more details.

User Scenarios for Default Rules

Here are some scenarios where default rules can be setup. You can also set up business rules that are specific to one or more operating units.

Notes about Default Rules

Some notes about default rules:

Creating Default Rules

Use the following pointers to create default rules.

Steps

  1. Log in to Oracle Quoting windows with the Quoting Sales Manager responsibility and select Defaulting Rules from the Setup functions.

  2. Query for Order Capture in the Application field.

  3. Choose from any of these entities: Quote Header, Quote Line, and Quote Oppty.

Refer the Order Management Implementation Manual for detailed steps on creating default rules.

Changing the Predefined Dependency in Default Rules

Some dependencies are predefined for default rules in the application. See Predefined Mapping Between Trigger and Dependent Attributes for more details Use this procedure to change the predefined dependency.

Steps

  1. Log in to the Linux or UNIX server with appropriate permissions.

  2. Make a copy of the asodepmp.sql file located in the $ASO_TOP/patch/115/sql/ folder.

  3. Open the file (copy) and search for the line that has the trigger attribute name followed by the dependent attribute name on the following line.

  4. Change the value of the Enabled_Flag from N to Y.

    This example enables the dependency between Order Type (trigger attribute) and Shipment Priority code (dependent attribute).

    l_Dep_Rec(l_count).Trigger_Attribute_Name := 'Q_ORDER_TYPE_ID';
     l_Dep_Rec(l_count).Dependent_Attribute_Name := 'Q_SHIPMENT_PRIORITY_CODE';
     l_Dep_Rec(l_count).Enabled_Flag := 'Y';
    
  5. Save your changes and run the script asodepmp.sql with the apps user responsibility.

  6. Log in to Oracle Windows with the Quoting Sales Manager responsibility.

  7. Run the Order Capture Dependency Generator and Defaulting Generator concurrent programs. See Concurrent Programs in Default Rules for more details.

Concurrent Programs in Default Rules

There are two concurrent programs that affect the functioning of default rules in Oracle Quoting. If you add a rule and change the dependency, it is recommended that the concurrent programs run in the following sequence:

Defaulting Generator Concurrent Program

To generate default rules for the first time or update existing default rules or conditions that are default, you must submit the Defaulting Generator concurrent program. New or modified rules and conditions are not effective until the program is successfully run.

Note: Predefined default rules can be disabled, but not modified. If you wish to modify a predefined default rule, disable the predefined default rule condition, and then create a copy of the predefined default rule and include your changes in the copied default rule.

The concurrent program must be submitted if you perform either of the following:

Notes

Order Capture Dependency Generator Concurrent Program

This concurrent program updates the dependencies between Quoting Attributes. If you modify attribute dependencies, they are not effective until this concurrent program is successfully executed. The concurrent program must be executed if you perform any of the following:

If you modify the dependency between two Quote Header level attributes, run this concurrent program for the Quote Header. If you modify the dependency between two Quote Line level attributes, run this concurrent program for the Quote Line.

Notes

Predefined API Signature for the PL/SQL Source Type

You can create a custom API for the PL/SQL API source type. Here is the signature of the predefined PL/SQL API:

<API Name>
( p_database_object_name in VARCHAR2,
  p_attribute_code              in  VARCHAR2 )
return <datatype>
where the <datatype> can be NUMBER or VARCHAR2.

The table below describes Quoting entities, their associated entity code, and the database object that is called when the entity is processed within a Quoting transaction.

Processing Entities in a Quoting Transaction
Entity Entity Code Database Object
Quote Header QUOTE_HEADER ASO_AK_QUOTE_HEADER_V
Quote Line QUOTE_LINE ASO_AK_QUOTE_LINE_V
Quote Oppty QUOTE_OPPTY ASO_AK_QUOTE_OPPTY_V

Here is the sample code to display the default value of the Currency Code from the Quote Price List in a standalone quote or from the Price List in the Create Quote from Opportunity page:

FUNCTION Get_Currency_from_pricelist(
             P_Database_Object_Name    IN   VARCHAR2,
             P_Attribute_Code          IN   VARCHAR2
             ) RETURN VARCHAR2 
is
     Cursor C_currency_code(q_price_list_id Number) is
     SELECT currency_code
     FROM qp_price_lists_v
     WHERE price_list_id = q_price_list_id;
     l_price_list_id     Number;
     l_currency_code     C_currency_code%rowtype;
Begin
  -- Getting the default global record based on the Database object name

     IF p_database_object_name = 'ASO_AK_QUOTE_HEADER_V' THEN
          l_price_list_id := ASO_QUOTE_HEADER_DEF_HDLR.g_record.q_price_list_id;
     ELSIF p_database_object_name = 'ASO_AK_QUOTE_OPPTY_V' THEN
          l_price_list_id := ASO_QUOTE_OPPTY_DEF_HDLR.g_record.o_price_list_id;
     END IF;

     -- Getting the Currency Code based on the Price List

     open C_currency_code(l_price_list_id);
     fetch C_currency_code into l_currency_code;
     close C_Currency_code;

     -- Returning the Currency Code

     RETURN l_currency_code.currency_code;
EXCEPTION
     -- Exception Handling
     WHEN NO_DATA_FOUND THEN
          RETURN NULL;
    WHEN OTHERS THEN
     IF OE_MSG_PUB.Check_Msg_Level (OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
     THEN
         OE_MSG_PUB.Add_Exc_Msg
         (     G_PKG_NAME         ,
             ' Get_Currency_from_pricelist '
         );
     END IF;
     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
End Get_Currency_from_pricelist