MarginCheckProcessing

Margin Check Processing

Major Business Rule

Object Name: B4200290

Parent DLL: CDIST

Location: Client/Server

Language: C

Functional Description

Purpose

The purpose of this business function is to perform Sales Order margin Check Processing.  The 
business function will perform line or order level checking based on the parameter htat is passed to it.  The 

function will retrieve the Hold Order Constants F42008 by Hold Code and Branch Plant, compre the 

upper and lower limits based on amount or percent code and write a record to Hold Order File F4209 if the 

order should be placed on hold.  The function returns a code to identify if hte order has been placed 

on hold or not.


Setup Notes and Prerequisites

The price and the cost columns must be passed in primary uom.


Special Logic
If Hold Code Constans F42008 is not found, return to calling application without setting any error 

condition.




Technical Specification



2.2Related Tables 

Table Table Description
F42008Hold Code Constants.

F4209Held Order Details.




2.3Related Business Functions

Source NameFunction Name
B4001100.CWrite Hold Code (F4209).

B4001110.CGet Hold Code Information (F42008).





2.4Processing  

• Fetch Hold Code Constants by Hold Code HCOD and Branch/Plant MCU. Use business function 
• B4001110 Get Hold Code Information.
• If record not found return to calling application with Order is on Hold EV01 equal to '0'.
• If record found get:  Limit Type HCLTYP, Responsible Person HCRPER, Lower Limit HCLLC and Upper 
Limit HCULC. 

• Calculate net amount  by subtracting cost from price.
• Net Amount = UPRC - UNCS
•  If Limit Type HCLTYP (from F42008) is equal to '%', calculate margin percent by dividing net amount 
by price. Multiply the result by 100. 

• Margin % = Net Amount UPRC * 100
• If Net Amount or Margin % is less than Lower Limit HCLLC (from F42008) or greater than Upper Limit 
HCULC (from F42008):

• Set Order is on Hold 0/1 EV01 to '1'.
• Write Held Order Row in F4209 using B4001100 Write Hold Code.
• Pass the following data items to B4300080: 
• MCU - Branch/Plant
• HCOD - Hold Code
• AN8 - Customer Number
• TRDJ - Transaction / Order Date
• DRQJ - Requested Date
• PDDJ - Promised Date
• SFXO - Order Suffix 
• DCTO - Order Type
• DOCO - Order Number
• KCOO - Order Key Company
• LNID - Order Line Number
• CTYP - Hold Code Type 
• RPER - Responsible Person (from HCRPER - F42008)
• ITM - Short Item Number
• LITM - Long Item Number
• AITM - Third Item Number



^

Data Structure

D4200290 - Margin Check Processing

Special Input Expected
CTYP Hold Code TypeHold Code Type: L=Line; O=Order.

HCODHold CodeHold Code.

AN8Customer NumberCustomer Number.

MCUBranch/PlantBranch / Plant.

DOCOOrder NumberOrder Number.

DCTOOrder TypeOrder Type.

KCOOOrder Key CompanyOrder Key Company.

SFXOOrder SuffixOrder Suffix - Always 000.

LNIDOrder Line NumberOrder Line Number for Hold Code Type 'L'.

TRDJTransaction/Order DateTransaction / Order Date.

DRQJRequested DateRequested Date.

PDDJPromised DatePromised Date.

ITMShort Item NumberShort Item Number for Hold Code Type 'L'.

LITMLong Item NumberLong Item Number for Hold Code Type 'L'.

AITMThird Item Number3rd Item Number for Hold Code Type 'L'.

UNCSCost - Primary UMUnit Cost or Extended Cost in Primary Unit of Measure.

UPRCPrice - Primary UMUnit Price or Extended Cost in Primary Unit of Measure.


Special Output Returned

EV01Order is on Hold 0/1A returned flag that identifies if the order has been put on hold -1 or 

0 if it passed the margin check.


^

Parameter NameData ItemData TypeReq/OptI/O/Both
szHoldCodeTypeCTYPcharNONENONE

A code that determines whether the hold code applies to an individual line within an order (L) or the order as a whole (O). For credit holds, 
the hold code applies to the whole order. For margin holds, you can apply the hold code to a line or the whole order.

szHoldCodeHCODcharNONENONE

A user defined code (42/HC) that identifies why an order was placed on hold (for example, credit, budget, or margin standards were 
exceeded).

mnCustomerNumberAN8MATH_NUMERICNONENONE

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

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.

mnOrderNumberDOCOMATH_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

szOrderKeyCompanyKCOOcharNONENONE

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.

szOrderSuffixSFXOcharNONENONE

In the A/R and A/P systems, a code that corresponds to the pay item. In the Sales Order and Procurement systems, this code identifies 
multiple transactions for an original order. For purchase orders, the code is always 000. For sales orders with multiple partial receipts against an 
order, the first receiver used to record receipt has a suffix of 000, the next has a suffix of 001, the next 002, and so on.

mnOrderLineNumberLNIDMATH_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.

jdTransactionDateTRDJJDEDATENONENONE

The date that an order was entered into the system. This date determines which effective level the system uses for inventory pricing.

jdRequestedDateDRQJJDEDATENONENONE

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

jdPromisedDelDatePDDJJDEDATENONENONE

The promised shipment date for either a sales order or purchase order. The Supply and Demand Programs use this date to calculate 
Available to Promise information. This value can be automatically calculated during sales order entry. This date represents the day that the item 
can be shipped from the warehouse.

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

sz2ndItemNumberLITMcharNONENONE

A number that identifies the item. The system provides three separate item numbers plus an extensive cross-reference capability to 
alternative item numbers. The three types of item numbers are: Item Number (short) An 8-digit, computer-assigned item number. 2nd Item Number A 
25-digit, user defined, alphanumeric item number. 3rd Item Number  Another 25-digit, user defined, alphanumeric item number. In addition to 
these three basic item numbers, the system provides an extensive cross-reference search capability. You can define numerous 
cross-references to alternative part numbers. For example, you can define substitute item numbers, replacements, bar codes, customer numbers, or 
supplier numbers.

sz3rdItemNumberAITMcharNONENONE

The system provides three separate item numbers plus an extensive cross-reference capability to alternate item numbers. These item 
numbers are as follows: 1.  Item Number (short) - An 8-digit, computer-assigned item number. 2.  2nd Item Number - The 25-digit, free-form, user 
defined alphanumeric item number. 3.  3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item number.  In addition to 
these three basic item numbers, an extensive cross-reference search capability has been provided (see XRT). Numerous cross references to 
alternate part numbers can be user defined, such as substitute item numbers, replacements, bar codes, customer numbers, or supplier 
numbers.

mnCostInPrimaryUOMUNCSMATH_NUMERICNONENONE

The amount per unit, derived by dividing the total cost by the unit quantity.

mnPriceInPrimaryUOMUPRCMATH_NUMERICNONENONE

The list or base price to be charged for one unit of this item. In sales order entry, all prices must be set up in the Item Base Price File table 
(F4106).

cOrderOnHoldFlagEV01charNONENONE

Special Output Returned
EV01ab Order is on Hold 0/1


A returned flag that identifies if the order has been put on hold -1 or 0 if it passed the margin 

check.ab 


^

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).

cSuppressErrorMsgEV01charNONENONE

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

szErrorMsgIDDTAIcharNONENONE

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.

cSuppressWriteToTableEV01charOPTNONE

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

Related Functions

B4001100 Write Hold Code
B4001110 Get Hold Code Information

Related Tables

F42008 Order Hold Constants
F4209 Held Orders