GetSalesBasePrice

Get Sales Base Price

Major Business Rule

Object Name: B4200070

Parent DLL: CDIST

Location: Client/Server

Language: C

Functional Description

Purpose

This function will retrieve the Sales Base Price from the F4106 based on the mode value determined.  

(i.e.  Item and Customer, Item Group and Customer, Customer Only, Item and Customer Group, Item Group 

and Customer Group, Customer Group only, Item Only, Item Group Only , All Items and Customers).


Output paramaters:  UPRC  UnitPrice,  FUP Foreign Unit Price,  ACRD  Credit Price,  ACRD  Foreign 

Credit Price,  UOM4  UOM of Base Price, and ERRC  Error Code, ICID ItemCustomerKeyID, AN8 Address Number, 

ITM Short Item Number, and  CRCD Currency Code.


Setup Notes and Prerequisites


Special Logic




Technical Specification



2.2Related Tables 

Table Table Description

F4106Base Price



2.3Related Business Functions

Source NameFunction Name

B4200800LoadPriceKeyByPreference

B4200800F40073GetPricingPrefernce Hierarchy



2.4Processing 



Algorithm:


1) Fetch the Advanced Pricing flag (ADVP) from the system constants table (F4009)

If the 'Advance Revision Level flag-parm (EV01) is equal to '1' AND ADVP != 'Y'

    Add 1 to the value of AREV-parm
            end

    2)    

  Call  GetPricingPreferenceHierarchy   B4200800

         

PreferenceType<="51"

SoldToAddrNumber<=lpDS SoldToAddress

ShipToAddrNumber<=lpDS ShipToAddress

ArrayOfPrefModes=>wf  Sorted Array of Pref Modes

NumOfArrayElements=>wf   NumOfArrayElements

 
           return the SortedArrayOfPrefModes

   3)
        wf Counter = 0

        while a base price record is not found  (F4106) and nIndex <= NumOfArrayElements

        

























         If no price was found and the while loop has ended
Return error code "2394" in Error Message ID.
         end





Get Base Price Record (F4106)


Description:  This function will retrieve the base price record from F4106 based on the mode value 
passed.

                     i.e. the fetch key will depend upon the mode.


   1)  Using the parms returned from LoadPriceKeyByPreference
                  F4106Key 2  ITM                            <=   ShortItemNumber

                                      MCU                          < =  Branch Plant

                                      LOCN                        < =  Location                     

                                      LOTN                        <=   Lot Number

                                      AN8                           <=   Customer Number

                                      ICID                          <=   Item Customer Key ID


2)Load the Grade, Potency, Date and Uom into the F4106 key by:

Move zeros to From Potency search field on F4106 (BPFRMP).
If Price By Grade/Potency (PRPO - param) = '1'

Move From Potency (FRMP - param) to From Potency search field on F4106 (BPFRMP).
end
Move blanks to Lot Grade search field on F4106 (BPLOTG).

If Price By Grade/Potency (PRPO - param) = '2'

Move From Grade (FRGD - param) to Lot Grade search field on F4106 (BPLOTG).
end

Move Price Effective Date (PEFJ - param) to Date Expired search field on F4106 (BPEXDJ).

Move Transaction Unit of Measure (UOM - param) to Unit of Measure search field on F4106 

(BPUOM).




3)Select a record from the Base Price Table (F4106) using the base search keys for as long 
as the record falls within the following criteria:


a)The Price Effective Date (PEFJ) falls within the Effective (EFTJ) and Expiration 
(EXDJ) dates on the F4106 record .

b) If Price By Grade/Potency (PRPO - param) ='1', F4106 record must fall within the 

From and Thru potency range (FRMP & THRP - params)

c)If Price By Grade/Potency (PRPO - param) ='2', F4106 record must fall within the 

From and Thru Grade range (FRGD & THGD - params).

d)If currency is turned on (CRYR ne 'N'), then look for a record with the Foreign 

Currency Code (CRDC - param) and the Transaction Uom (UOM - param).  If a record is not found, look for a 

record with the same currency code and the Primary Uom (UOM1 - param).  If a record is still not 

found, look for a record with the Domestic Currency Code (CRCD - param) and the first uom (UOM - param).  

Finally, if a record is still not found, attempt again with the domestic currency and the other uom 

(UOM1 - param).


Performance consideration:  The number of searches in step "d" can be reduced if the foreign 
(CRDC) and domestic currency codes (CRCD) are identical as well as if UOM and UOM1 are identical.  Also, 

if currency is off (CRYR='N'), then all foreign currency code related searches can be ignored.


4)When a record is found, load the following output parameters to be passed back to ER:

UOM4 UnitofMeasureBasePrice=BPUOM

              ICID ItemCustomerKeyID=BPICID

              CRCD CurrencyCode=BPCRCD

              ITM ShortItemNumber=BPITM

              AN8 AddressNumber=BPAN8



7)If a price is found using the foreign currency code, the price is a foreign price and it 
needs to be converted back to domestic.  


FUP=BPUPRC

FCRD=BPACRD


if CRYR = 'Y'

UPRC=FUP * CRR

ACRD=FCRD * CRR

else

UPRC=FUP / CRR

ACRD=FCRD / CRR


If a price is found using the domestic currency code, the price is a domestic price and it 
needs to be converted to foreign.  


UPRC=BPUPRC

ACRD=BPACRD


if CRYR = 'Y'

FUP=UPRC / CRR

FCRD=ACRD / CRR

else

FUP=UPRC * CRR

FCRD=ACRD * CRR


7) When a record is found

If the Advanced Pricing flag is not 'Y' (ADVP!='Y')

    Delete the current price from the work file (F40UI74)

end


Convert the price found to Pricing Unit of Measure.

               Write a record to the F40UI74 work file


AWCTID = lpds Computer ID

AWJOBS = lpds Job Number

AWXLIN = lpds Line Number F40UI70


AWOSEQ = 0

AWITM     

AWAN8

AWICID

AWCRCD

AWUOM

AWUPRC

AWFUP

AWPROV = 1 

AWAREV = AREV-parm


   


Data Structure

D4200070 - GetSalesBasePrice

Special Input Expected
CRCDBaseCurrencyCode If CRYR = N (Domestic)

UOMTransactionUOMEither UOM or UOM1 has to be passed in

UOM1PrimaryUOMEither UOM or UOM1 has to be passed in

PLEVPriceLevel

PRPOPriceByGradeOrPotencyIf = 1  - Searches using FromPotency (FRMP)

If = 2  - Searches using FromGrade (FRGD)

CRYRCurrencyConversionY, N, OR Z

CRRConversionFactorThis is the Currency Conversion Factor

PRGRItemPricingGroupIf Blank will use the PRGR from the F4102 RecordPtr

Else will use the one passed in 

CPGPCustomerPricingGroupIf Blank will fetch the CPGR from F0301

given the AN8 field saved given the Mode

Else will use the one passed in

AREVAdjustment Revision LevelNumber indicating how many times the price has been changed.

EV02Advance Revision LevelIf equal to '1', advance the AREV by a factor of 1. (i.e. Add 1 to AREV) 

UOM4Pricing Unit of MeasureUOM to place in the History Table F4074

CONVConvFactorTran_to_PricConversion factor between Transaction Unit of Measure (UOM) and Pricing Unit of Measure (UOM4)

CONVConvFactorPrim_to_PricConversion factor between Primary Unit of Measure (UOM1) and Pricing Unit of Measure (UOM4)



Special Output Returned

MCUBranch PlantIf PLEV > 1 this will be returned

LOCNLocation If PLEV > 2 this will be returned

UOM4BasePriceUOMThis is the uom that was retrieved from F4106





^

Parameter NameData ItemData TypeReq/OptI/O/Both
mnSoldToAddressAN8MATH_NUMERICNONENONE

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

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

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.

szLocationLOCNcharNONENONE

The storage location from which goods will be moved.

szLotNumberLOTNcharNONENONE

A number that identifies a lot or a serial number. A lot is a group of items with similar characteristics.

jdPriceEffectiveDatePEFJJDEDATENONENONE

The system uses the Price Effective Date to determine the base price and all advanced price adjustments.  The value loaded in this date 
is stored in the System Constants File (F4009).

szBaseCurrencyCodeCRCDcharNONENONE

A code that identifies the currency of a transaction. 

szTransactionUOMUOMcharNONENONE

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

szPrimaryUOMUOM1charNONENONE

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

cPriceLevelPLEVcharNONENONE

A code that indicates whether the system maintains standard sales prices for an item, different sales prices for each branch/plant, or 
different sales prices for each location and lot within a branch/plant. The system maintains sales prices in the Base Price file (F4106). Valid codes 
are:    1   Item level    2   Item/Branch level    3   Item/Branch/Location level 

cPriceByGradeOrPotencyPRPOcharNONENONE

A user defined code (41/05) that groups several items that contain the same requirements for the Stock Valuation system. Valuation 
methods are set up by item or pool. The items assigned to the pool use the pool's designated valuation methods for extracting and valuing the 
inventory. Enter a valid user defined code (41/05) if you want this item to be valued within a pool rather than as an individual item.

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

mnForeignUnitPriceFUPMATH_NUMERICNONENONE

The foreign price per unit.

cCurrencyConversionCRYRcharNONENONE

A code that specifies whether to use multi-currency accounting, and the method of multi-currency accounting to use: Codes are:    N Do not 
use multi-currency accounting. Use if you enter transactions in only one currency for all companies. The multi-currency fields will not appear 
on forms. The system supplies a value of N if you do not enter a value.    Y Activate multi-currency accounting and use multipliers to convert 
currency. The system multiplies the foreign amount by the exchange rate to calculate the domestic amount.    Z Activate multi-currency 
accounting and use divisors to convert currency. The system divides the foreign amount by the exchange rate to calculate the domestic amount.

mnConversionFactorCRRMATH_NUMERICNONENONE

A number (exchange rate) that a foreign currency amount is multiplied by to calculate a domestic currency amount.  The number in this field 
can have a maximum of seven decimal positions. If more are entered, the system adjusts to the nearest seven decimal positions. 

mnFromPotencyFRMPMATH_NUMERICNONENONE

A number that indicates the minimum potency or percentage of active ingredients acceptable for an item. The system displays a warning 
message if you try to purchase or issue items that do not meet the minimum acceptable potency. The system does not allow you to sell items 
that do not meet the minimum acceptable potency.

mnThruPotencyTHRPMATH_NUMERICNONENONE

A number that indicates the maximum potency or percentage of active ingredients that is acceptable for an item. The system displays a 
warning message if you try to purchase or issue items that have a potency that exceeds the maximum potency acceptable. The system does 
not allow you to sell items that have a potency that exceeds the maximum potency acceptable.

szFromGradeFRGDcharNONENONE

A user defined code (40/LG) that indicates the minimum grade that is acceptable for an item. The system displays a warning message if 
you try to purchase or issue items with grades that do not meet the minimum grade acceptable. The system does not allow you to sell items 
with grades that do not meet the minimum acceptable level.

szThruGradeTHGDcharNONENONE

A user defined code (40/LG) that indicates the maximum grade that is acceptable for an item. The system displays a warning message if 
you try to purchase or issue items with grades that exceed the maximum grade acceptable. The system does not allow you to sell items with 
grades that exceed the maximum grade acceptable.

mnCreditPriceACRDMATH_NUMERICNONENONE

Use this field to enter credit orders in the Sales Order Management system. To enter a credit order, use a line type for which the Reverse 
Sign Flag (RSGN) is set to Y in the Line Type Master table (F40205). The system stores all credit prices in the Base Price table (F4106).

szUOMOfBasePriceUOM4charNONENONE

Special Input Expected
UOM4ab Pricing Unit of  Measureab    UOM to place in the History Table  F4074ab 



^

szItemPricingGroupPRGRcharNONENONE

A user defined code (system 40/type PI) that identifies an inventory price group for an item. Inventory price groups have unique pricing 
structures that direct the system to incorporate discounts or markups on items on sales and purchase orders. The discounts or markups are 
based on the quantity, dollar amount, or weight of the item ordered. When you assign a price group to an item, the item takes on the same pricing 
structure defined for the inventory price group. You must assign an inventory price group to the supplier or customer, as well as to the item, for 
the system to interactively calculate discounts and markups on sales orders and purchase orders.

szCustomerPricingGroupCPGPcharNONENONE

A user defined code (40/PC) that identifies a customer group. You can group customers with similar characteristics, such as comparable 
pricing.

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

cCheckPriceAndAvailabilityERRCcharNONENONE

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

idF4102FilePtrGENLNGIDNONENONE

General purpose ID variable.

szCustomerCurrencyCodeCRDCcharNONENONE

A code that identifies the domestic (base) currency of the company on a transaction. 

mnForeignCreditPriceACRDMATH_NUMERICNONENONE

Use this field to enter credit orders in the Sales Order Management system. To enter a credit order, use a line type for which the Reverse 
Sign Flag (RSGN) is set to Y in the Line Type Master table (F40205). The system stores all credit prices in the Base Price table (F4106).

mnAddressNumberAN8MATH_NUMERICNONENONE

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

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

szCurrencyCodeCRCDcharNONENONE

A code that identifies the currency of a transaction. 

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.

szComputerIDCTIDcharNONENONE

mnLineNumberF40UI74XLINMATH_NUMERICNONENONE

Line number.

mnJobNumberJOBSMATH_NUMERICNONENONE

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

mnAdjustmentRevLevelAREVMATH_NUMERICNONENONE

This field maintains the current revision level of Advanced Pricing adjustments awarded within a sales order. Adjustments associated with 
a revision level below the current level are considered obsolete.

cAdvanceRevLevelEV02charNONENONE

Special Input Expected
EV02ab Advance Revision Level

ab 

Significant Data Values

If equal to '1', advance the AREV by a factor of 1. (i.e. Add 1 to AREV) 


^

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

szKeyCompanyKCOOcharNONENONE

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.

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.

szPricingUnitOfMeasureUOM4charNONENONE

A user defined code (00/UM) that indicates the unit of measure in which you usually price the item.

mnTranToPricingConvFctrCONVMATH_NUMERICNONENONE

The factor that the system uses to convert one unit of measure to another unit of measure.

mnPrimToPricingConvFctrCONVMATH_NUMERICNONENONE

The factor that the system uses to convert one unit of measure to another unit of measure.

cSuppressF40UI74WriteEV03charNONENONE

A radio button that specifies the level at which trace/track result is to be displayed.  Select the Detail to display all transactions except IB, IX, 
and IZ types.  Or, select Derivative Lots Only to display only those transactions that may have created new derivative lot. 

mnTriangulationRateFromTRR1MATH_NUMERICOPTNONE

The triangulation currency rate used to convert the From currency code to the Triangulation currency code.

mnTriangulationRateToTRR2MATH_NUMERICOPTNONE

The triangulation currency rate that used to convert from the Triangulation currency code to the To currency code.

cCurrencyConversionMethodCRCMcharOPTNONE

A value that specifies which method to use when converting from one currency to another. Valid values are:  Y  Multiplier method. The 
system multiplies the foreign amount by the multiplier exchange rate to calculate the domestic amount. Z Divisor method. The system divides the 
foreign amount by the divisor exchange rate to calculate the domestic amount.

mnParentAddressNoPA8MATH_NUMERICOPTNONE

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 

cReverseSignYNRSGNcharOPTNONE

A code that indicates whether the system reverses the sign of the quantity in the line. This code is used to allow easy entry of credit 
memos. In World software, valid values are:    Y Reverse the sign of the quantity.    N Do not reverse the sign of the quantity. This is the default. In 
OneWorld, a checkmark indicates that the system reverses the sign of the quantity in the line.

mnOriginalQtySOQSMATH_NUMERICOPTNONE

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.

mnProcessIDPEIDMATH_NUMERICOPTNONE

A code that identifies the Inter-Process Communication ID.

mnTransactionIDTCIDMATH_NUMERICOPTNONE

mnItemGroupKeyIDIGIDMATH_NUMERICOPTNONE

A number that identifies an item group or an order detail pricing group. Each pricing group is comprised of either item category codes (for 
an item group) or sales order detail field values (for an order detail group). For every unique combination of values in the pricing group, the 
system assigns a number (key ID) to identify the group. The system retrieves this number from the Next Numbers program (P0002) for the 
system code 40 and the line number 5.

mnCustomerGroupKeyIDCGIDMATH_NUMERICOPTNONE

A number that identifies a customer pricing group. Each pricing group comprises customer category codes. For every unique combination 
of values in the pricing group, the system assigns a number (key ID) to identify the group. This number is retrieved from the Next Numbers 
program (P0002) using system code 45, line number 2.

mnPriceHistoryAltKeyAKIDMATH_NUMERICOPTNONE

A value that specifies an alternate key in the Price Adjustment Ledger File table (F4074). 

szPriceHistoryAltKeySourceSRCFDcharOPTNONE

A user defined code that you enter to indicate the JD Edwards system,such as Service Warranty Management etc,that the price adjustment 
supports.

cUsePricingUOMForPreferencesEV01charOPTNONE

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

szSecondaryUOMUOM2charOPTNONE

A user defined code (00/UM) that indicates an alternate unit of measure for the item.

cByPassAddnlSearchUOMEV01charOPTNONE

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

Related Functions

B4200800 F40073 Get Pricing Preference Hierarchy

Related Tables

F4102 Item Branch File
F4106 Item Base Price File