PreferenceAllocations

Preference Allocations

Major Business Rule

Object Name: B4002300

Parent DLL: CDIST

Location: Client/Server

Language: C

.Functional Description

1.1Purpose

The purpose of this business function will be to determine the allocation preference information and 
to maintain the allocation work file F40UI17.  The preference retrieval information is contained in 

files F40070, F40071, F40072, and F40073 (Preference Hierarchy).  The preference details are held in 

F40307.


1.2Setup Notes and Prerequisites


None



2.Technical Specifications


2.2Related Tables 

Table Table Description
F40070Preference Master

F40071Customer Preference Groups

F40072Item Preference Groups

F40073Preference Hierarchy

F40307Allocation Preferences

F40UI17Allocation Error Work File

F42UI11SO Detail Work File


2.3Related Business Functions

Source NameFunction Name
B4000520Get Item UOM Conversion Factors

B4100210Get Item Master Description UOM

B4001040Check Item Branch



2.4Processing

Initialization Function:

Retrieve the following processing option values for R40400 using the Version ID (VERS) value.
cPaymentTerms

cUnitOfMeasure

cRevenueCostCenter

cEndUse

cGradeAndPotency

cDeliveryDate

cAllocation

cLineOfBusiness

cPriceCode1

cPriceCode2

cPriceCode3



// Set up variables from parameters.


set Difference-wf = Original Quantity (UORG-parm)  (Ship Quantity (SOQS-parm) + Backorder Quantity 

(SOBK-parm))


If MODE-parm = '3' or if MODE-parm = '2' and Difference-wf <> 0

Get the sold to customer group by calling Get/Update Customer/Item Group (B4002140) 
Processing Mode<='I'
Preference Type<='07'

Customer Number<=AN8-parm

Item Numbernot used

Customer Group=>Sold To Group-wf

Item Groupnot used

Suppress Error<=' '

Error Code


Get the ship to customer group by calling Get/Update Customer/Item Group (B4002140) 

Processing Mode<='I'

Preference Type<='07'

Customer Number<=SHAN-parm

Item Numbernot used

Customer Group=>Ship To Group-wf

Item Groupnot used

Suppress Error<=' '

Error Code


Get the parent customer group by calling Get/Update Customer/Item Group (B4002140) 
Processing Mode<='I'

Preference Type<='07'

Customer Number<=PA8-parm

Item Numbernot used

Customer Group=>Parent Group-wf

Item Groupnot used

Suppress Error<=' '

Error Code


Get the item group by calling Get/Update Customer/Item Group (B4002140) 

Processing Mode<='I'

Preference Type<='07'

Customer Numbernot used

Item Number<=ITM-parm

Customer Group

Item Group=>Item Group-wf

Suppress Error<=' '

Error Code


Get the Preference Master by calling Get Preference Master (B4002090) 
Preference Type<='07'

Enable Effective Dates=>Effective Dates-wf

Enable Effective Quantities=>Effective Quantities-wf

Preference Classnot used

Sequence Numbernot used



Read F40073 (Preference Hierarchy) for Preference Type 07.
Load the following values to an array:


• Preference hierarchy (1-21)
• Key List Value (corresponds to hierarchy):
1=Ship to customer & Item number
2=Ship to customer & Item group

3=Ship to customer

4=Ship to group & Item number

5=Ship to group & Item group

6=Ship to group

7=Sold to customer & Item number

8=Sold to customer & Item group

9=Sold to customer

10=Sold to group & Item number

11=Sold to group & Item group

12=Sold to group

13=Parent customer & Item number

14=Parent customer & Item group

15=Parent customer

16=Parent group & Item number

17=Parent group & Item group

18=Parent group

19=Item number

20=Item group

21=All

This array should by sorted by hierarchy.
endif



End of Initialization Function

Main portion of Business Function:


// If updating allocation table, do the update and exit routine


If MODE-parm = '2' 

Get F40UI17 record using CTID-parm, JOBS-parm, and XLIN-parm
Get Preference Profile row (F40307) using key values from F40UI17

set Order Quantity (UORG-parm) = Ship Quantity (SOQS-parm) + Backorder Quantity (SOBK-parm)

If Sales Order UOM is not equal to Preference Override UOM.

Call the UoM Conversion Routine with the To UOM = Preference Override UOM and with From UOM = 
Sales Order UOM.

Multiply the Order Quantity (UORG parm) by the ConversionFactorFrom_To_to.

Endif.

Add Order Quantity (UORG-parm) to Preference Quantity Sold (LAQSLD)

Update Preference table (F40307) 

If Difference-wf = 0

return to calling  function
else
set MODE-parm = '4'
set Order Quantity (UORG-parm) = Original Quantity (UORG-parm)

endif

Clear the F40UI17 work file records for the order using CTID-parm and JOBS-parm

else

If MODE-parm = '1'
Delete row from F40UI17 record using CTID-parm, JOBS-parm, XLIN-parm
endif
endif


// process Product Allocation Preference '07'

if MODE-parm <> '3' and cProductAllocation ='1'

Do function EditCycle

endif


Return to calling program


End of main portion of business function

EditCycle Function:
parameters :
preference type (numeric)


Main loop (21 times)

Retrieve the Hierarchy Order array.


Set Invalid Record Flag = ' '


// Load the key values for retrieval of the preference


select

hierarchy = '01'

Key Value AN8 = SHAN-parm

Key Value ITM = ITM-parm


hierarchy = '02'

Key Value AN8 = SHAN-parm

Key Value ITTP = Item Group-wf

If Key Value ITTP = ' '

Set Invalid Record Flag-wf = '1' (invalid key)

endif


hierarchy = '03'

Key Value AN8 =  SHAN-parm


hierarchy = '04'

Key Value CSTP = Ship To Group-wf

Key Value ITM = ITM-parm

If Key Value CSTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '05'

Key Value CSTP = Ship To Group-wf

Key Value ITTP = Item Group Array-wf

If Key Value CSTP = ' ' or Key Value ITTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '06'

Key Value CSTP = Ship To Group-wf

If Key Value CSTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '07'

Key Value AN8 = AN8-parm

Key Value ITM = ITM-parm


hierarchy = '08'

Key Value AN8 = AN8-parm

Key Value ITTP = Item Group-wf

If Key Value ITTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '09'

Key Value AN8 = AN8-parm


hierarchy = '10'

Key Value CSTP = Sold to Group-wf

Key Value ITM = ITM-parm

If Key Value CSTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '11'

Key Value CSTP = Sold to Group-wf

Key Value ITTP = Item Group Array-wf

If Key Value CSTP = ' ' or Key Value ITTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '12'

Key Value CSTP = Sold To Group-wf

If Key Value CSTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '13'

Key Value AN8 = PA8-parm

Key Value ITM = ITM-parm

If Key Value AN8 = 0

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '14'

Key Value AN8 = PA8-parm

Key Value ITTP = Item Group-wf

If Key Value ITTP = ' ' or Key Value AN8 = 0

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '15'

Key Value AN8 = PA8-parm

If Key Value AN8 = 0

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '16'

Key Value CSTP = Parent Group-wf

Key Value ITM = ITM-parm

If Key Value CSTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '17'

Key Value CSTP = Parent Group-wf

Key Value ITTP = Item Group-wf

If Key Value CSTP = ' ' or Key Value ITTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '18'

Key Value CSTP = Parent Group-wf

If Key Value CSTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '19'

Key Value ITM = ITM-parm


hierarchy = '20'

Key Value ITTP = Item Group-wf

If Key Value ITTP = ' '

Set Invalid Record Flag-wf = '1'
endif


hierarchy = '21'

no logic here.


end select


Set Key Value Expire Date-wf = Sales Order Request Date (DRQJ-parm)

Set Work Date-wf = Sales Order Request Date (DRQJ-parm)


Set Key Value Unit of Measure-wf = Sales Order Unit of Measure (UOM-parm)

Set Key Value Maximum Quantity-wf = Sales Order Order Quantity (UORG-parm)


select

Enable Effective Date (PFENED) = 'Y' and Enable Effective Quantity (PFENQT) = 'Y'

Set All Keys Flag-wf = '2'
Set Key List = Customer Number, Customer Group, Item Number, Item Group, Expiration Date, Unit of 

Measure and Maximum Quantity


Enable Effective Date (PFENED) = 'N' and Enable Effective Quantity (PFENQT) = 'N'

Set All Keys Flag-wf = '0'
Set Key List = Customer Number, Customer Group, Item Number and Item Group


Enable Effective Date (PFENED) = 'Y' and Enable Effective Quantity (PFENQT) = 'N'

Set All Keys Flag-wf = '1'

Set Key List = Customer Number, Customer Group, Item Number, Item Group and Expiration Date

end select


// Retrieve Preference Records


If Invalid Record Flag-wf <> '1'

Retrieve row from Preference table (F40307) with the appropriate key based on All Keys Flag-wf

//check effectivity dates and quantities.
If All Keys Flag-wf = '2' check for Work Date-wf >= Effective Date(LAEFTJ) and Work Date-wf <= 
Expiration Date (LAEXDJ) and Order Quantity (UORG-parm) >= Minimum Quantity (LAMNQ) and Order 

Quantity (UORG-parm <= Maximum Quantity (LAMXQ) and Unit of Measure (UOM-parm) = Unit of 

Measure (LAUOM)


// check Date only 
If All Keys Flag-wf = '1' check for Work Date-wf >= Effective Date (LAEFTJ) and Work Date-wf 
<= Expiration Date (LAEXDJ)


// check none
If All Keys Flag-wf = '0' do not check for dates or quantities


If a row is 

Data Structure

D4002300 - PreferenceAllocation

Parameter NameData ItemData TypeReq/OptI/O/Both
mnSalesOrderNumberDOCOMATH_NUMERICNONENONE

A number that identifies an original document. This document can be a voucher, a sales order, an invoice, unapplied cash, a journal entry, 
and so on.

szOrderTypeDCTOcharNONENONE

A user defined code (00/DT) that identifies the type of document. This code also indicates the origin of the transaction. J.D. Edwards has 
reserved document type codes for vouchers, invoices, receipts, and time sheets, which create automatic offset entries during the post 
program. (These entries are not self-balancing when you originally enter them.) The following document types are defined by J.D. Edwards and 
should not be changed: P Accounts Payable documents   R Accounts Receivable documents   T Payroll documents   I Inventory documents  
O Purchase Order Processing documents   J General Accounting/Joint Interest Billing documents   S Sales Order Processing documents

szOrderCompanyKCOOcharNONENONE

A number that, along with order number and order type, uniquely identifies an order document (such as a purchase order, a contract, a 
sales order, and so on). If you use the Next Numbers by Company/Fiscal Year facility, the Automatic Next Numbers program (X0010) uses the 
order company to retrieve the correct next number for that company. If two or more order documents have the same order number and order 
type, the order company lets you locate the desired document. If you use the regular Next Numbers facility, the order company is not used to 
assign a next number. In this case, you probably would not use the order company to locate the document.

mnLineNumberLNIDMATH_NUMERICNONENONE

A number that identifies multiple occurrences, such as line numbers on a purchase order or other document. Generally, the system assigns 
this number,but in some cases you can override it.

szComputerIDCTIDcharNONENONE

mnJobNumberJOBSMATH_NUMERICNONENONE

The job number (work station ID) which executed the particular job.

mnWorkFileLineNoXLINMATH_NUMERICNONENONE

Line number.

mnShortItemNumberITMMATH_NUMERICNONENONE

An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item 
numbers (see data item XRT) to accommodate substitute item numbers, replacements, bar codes, customer numbers, supplier numbers, and 
so forth. The item numbers are as follows:   o Item Number (short) - An eight-digit, computer-assigned item number     o 2nd Item Number - The 
25-digit, free-form, user defined alphanumeric item number     o 3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item 
number

mnAddressNumberAN8MATH_NUMERICNONENONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

mnShipToAddressNoSHANMATH_NUMERICNONENONE

The address number of the location to which you want to ship this order. The address book provides default values for customer address, 
including street, city, state, zip code, and country.

mnParentAddressNoPA8MATH_NUMERICNONENONE

The address book number of the parent company. The system uses this number to associate a particular address with a parent company 
or location. Any value that you enter in this field updates the Address Organizational Structure Master table (F0150) for the blank structure 
type. This address number must exist in the Address Book Master table (F0101) for validation purposes. Examples of address book records 
that would have a parent number include:   o  Subsidiaries with parent companies     o  Branches with a home office     o  Job sites with a general 
contractor 

jdDateRequestedDRQJJDEDATENONENONE

The date that an item is scheduled to arrive or that an action is scheduled for completion.

mnOrderQuantityUORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

mnShipQuantitySOQSMATH_NUMERICNONENONE

The number of units committed for shipment in Sales Order Entry, using either the entered or the primary unit of measure defined for this 
item. In the Manufacturing system and Work Order Time Entry, this field can indicate completed or scrapped quantities. The quantity type is 
determined by the type code entered.

mnBackorderQuantitySOBKMATH_NUMERICNONENONE

The number of units backordered in Sales Order Management or in Work Order Processing, using either the entered or the primary unit of 
measure defined for this item.

szUnitOfMeasureUOMcharNONENONE

A user defined code (00/UM) that indicates the quantity in which to express an inventory item, for example, CS (case) or BX (box).

szBranchPlantMCUcharNONENONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

szHeaderBranchPlantEMCUcharNONENONE

A business unit is an accounting entity required for management reporting. It can be a profit center, department, warehouse location, job, 
project, work center, branch/plant, and so forth. This business unit is from the business unit entered on the header of a sales/purchase order for 
reporting purposes. This data is always right justified on entry (for example, CO123 would appear as _______CO123).  A security mechanism 
has been provided to inhibit users from entering or locating business units outside the scope of their authority.

mnOriginalQuantityUORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

cProcessingModeMODEcharNONENONE

The processing mode used in Purchase Order Consolidator to signify when specific orders are being processed.

szVersionIDVERScharNONENONE

A user-defined set of specifications that control how applications and reports run. You use versions to group and save a set of user-defined 
processing option values and data selection and sequencing options. Interactive versions are associated with applications (usually as a 
menu selection). Batch versions are associated with batch jobs or reports. To run a batch process, you must choose a version.

cPrefProductAllocSO10charNONENONE

Flag to indicate the sales order detail line was allocated through the product allocation preference.

cPrefMethodOfAllocALOCcharNONENONE

A code that specifies how the system creates allocation journal entries or updates. Valid values are: B      Balance Method. Create journal 
entries based on the balance of an account or the balance of a range of accounts. Balances are maintained in the Account Balances table 
(F0902). See the note below about annual budgets. T Transaction Method. Create journal entries on a one-for-one basis for each posted 
transaction in the Account Ledger table (F0911) for the account range specified. U Update Method. Update the account balance for non-AA ledger 
types and do not create any journal entries. NOTE:  For annual budgets, you must use B (Balance Method). Journal entries will not be created.

szCustomerGroupCS07charNONENONE

A user defined code (40/07) that identifies a group to which you can assign customers for the Product Allocations preference. Assign 
customers to a group when the customers share similar characteristics. A customer group allows you to define preferences quickly and 
easily. Enter the code that identifies the customer group for which you want to define a preference. You can define the preference for this group alone or 
for a combination of customer group and item or item group.

szItemGroupIT07charNONENONE

User defined code (system 40, type 57) identifying a group to which you can assign items for the Product Allocations preference. Do this 
when you have a group of similar items and you want to group them together to define preferences quickly and easily. Enter the code that 
identifies the item group for which you want to define a preference. You can define the preference for this group alone or for a combination of item 
group and customer or customer group. If you leave both the Item Number and Item Group fields blank, the system applies the preference to all 
items

cErrorCodeERRCcharNONENONE

This error code indicates if any errors occurred during the creation of the Trip Document Detail (F4914) records by the Delivery Document 
Set Server program (XT4914).

szErrorMessageIDDTAIcharNONENONE

A code that identifies and defines a unit of information. It is an alphanumeric code up to 8 characters long that does not allow blanks or 
special characters such as %, &, or +. You create new data items using system codes 55-59. You cannot change the alias.

cSuppressErrorMessageEV01charNONENONE

An option that specifies the type of processing for an event.

szAllocationUOMUOM1charNONENONE

A user defined code (00/UM) that identifies the unit of measure that the system uses to express the quantity of an item, for example, EA 
(each) or KG (kilogram).

cCMUseWorkFilesEV22charOPTNONE

An option that specifies the type of processing for an event.

Related Functions

B4000520 Get Item UoM Conversion Factor
B4001040 Get Item Master Description UOM
B4002060 Preference Get Values For Sales Order
B4002140 F40071/F40072 Get/Update Cust/Item Group
B4100210 Check Item Branch

Related Tables

F40070 Preference Master File
F40071 Customer Preference Groups
F40072 Item Preference Groups
F40073 Preference Hierarchy File
F40307 Preference Profile - Product Allocations
F40339 Preference Profile - Product Allocations (Branch)
F40UI17 Allocation Work File
F42UI11 SO Detail Cache File (MBF)