ForecastCalculateMethod

Forecast Calculate Method

Major Business Rule

Object Name: B3400890

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This function will create the detail forecast records for the methods chosen in the processing 
options, based on the data calculated in the simulation business functions.


1.2Setup Notes and Prerequisites


1.3Special Logic


2.Technical Specifications

If MonthlyVsWeekly is not equal to '1'
Move 12 to BucketsInYr

Else

Move 52 to BucketsInYr

End


/*Load index of first forecast date in PointerToDates list*/

Look in the PointerToDates link list for the first date greater than or equal to BeginDate for 

the first date to start writing actuals from.  Save this index number in $Index


If ProgramID is equal to 'R34640'

/*Build the hierarchy array if the input pointer is zero*/

If PntrToHierarchy is equal to zero

Retrieve the Summary Constants record from F4091 using SummaryCode

Create an array, @H, containing 14 elements

If KFGLSM is equal to 'Y'

Move 'Y' to @H,1

End

If KFCOSM is equal to 'Y'

Move 'Y' to @H,2

End

If KFITSM is equal to 'Y'

Move 'Y' to @H,14

End

Move 11 to $I

If KFCSLV is not equal to blanks

Move KFCSLV to $I

Move 'C' to @H,($I + 2)

End


Do 40 times, once for each category code from F4091

If KFKCnn is not equal to 0

Move KFKCnn to $J

If $J is less than $I 

Move $J to @H,($J + 2)

Else

Move $J to @H,($J + 3)

End

End

End Do

End


/*Using the hierarchy array and the input key values, blank out the last key and save the 

new key*/

Will need a data structure, NewKey (NK$), to hold the following fields:
CO, KC01, KC02, KC03, KC04, KC05, KC06, KC07, KC08, KC09, KC10, AN8, ITM


Move the input keys into NK$

If NK$ITM is not equal to zero and @H,14 is equal to 'Y'
Move zero to NK$ITM

Else

Move 11 to $CSLV

Look for 'C' in the hierarchy array

If found

Move that index position to $CSLV

End


For $I = 13 down to 3

If @H,$I is not equal to blanks

If @H,$I is equal to 'C'

If NK$AN8 is not equal to zeros

Move zeros to NK$AN8

Exit the for loop

End

Else

Get the KCnn field in NK corresponding to $I

If NK$KCnn is not equal to blanks

Move blanks to NK$KCnn

Exit the for loop

End

End

End

End For


If a key hasn't been blanked out yet

If @H,2 is equal to 'Y'

Move blanks to NK$CO

End

End

End


If this is the last level in the hierarchy

Create a linked list to hold Item Number and Branch pairs from F34006.

Fetch all records from F34006 using the input SummaryCode, ActualType, and 

ChildKey

For each record retrieved

Add a record to the linked list just created saving the Item Number 

and Branch

End

End

End


*/ If called from the online simulation create a Link List to hold the calculated forecasts */


If ProgramID is equal to 'EP3461"
Create a DetailRecordList with the following fields

Date

Amount

Quantity

End


^

Data Structure

D3400890 - Forecast Calculate Method

Parameter NameData ItemData TypeReq/OptI/O/Both
cMethodEV01charNONENONE

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

idTypeArrayGENLNGIDNONENONE

General purpose ID variable.

mnNumberOfBucketsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

jdBeginDateDRQJJDEDATENONENONE

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

jdEndDateDRQJJDEDATENONENONE

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

idPointerToDatesGENLNGIDNONENONE

General purpose ID variable.

mnNumberOfPeriodsMATH04MATH_NUMERICNONENONE

Event point for Math Numeric.

mnLastBucketPositionMATH05MATH_NUMERICNONENONE

Event point for Math Numeric.

idPtrToActualValuesGENLNGIDNONENONE

General purpose ID variable.

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

szSecondItemNumberLITMcharNONENONE

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.

szThirdItemNumberAITMcharNONENONE

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.

cBypassForceBPFCcharNONENONE

A code that indicates whether to bypass the Forecast Forcing program (R34610). A Y indicates that the quantity and amount of a forecast 
should not be changed by an adjustment made to a forecast higher in the summary hierarchy. This flag is effective only when forecast forcing is 
done down the summary hierarchy.

szForecastTypeTYPFcharNONENONE

A user defined code (34/DF) that indicates one of the following:     o The forecasting method used to calculate the numbers displayed about 
the item     o The actual historical information about the item 

szActualTypeTYPFcharNONENONE

A user defined code (34/DF) that indicates one of the following:     o The forecasting method used to calculate the numbers displayed about 
the item     o The actual historical information about the item 

szProgramIDPIDcharNONENONE

The number that identifies the batch or interactive program (batch or interactive object). For example, the number of the Sales Order Entry 
interactive program is P4210, and the number of the Print Invoices batch process report is R42565. The program ID is a variable length value. 
It is assigned according to a structured syntax in the form TSSXXX, where: T The first character of the number is alphabetic and identifies the 
type, such as P for Program, R for Report, and so on. For example, the value P in the number P4210 indicates that the object is a 
program. SS The second and third characters of the number are numeric and identify the system code. For example, the value 42 in the number P4210 
indicates that this program belongs to system 42, which is the Sales Order Processing system. XXX The remaining characters of the numer are 
numeric and identify a unique program or report. For example, the value 10 in the number P4210 indicates that this is the Sales Order Entry 
program.

szSummaryCodeKVERcharNONENONE

A user defined code (40/KY) that indicates the type of summary forecast.

szCompanyCOcharNONENONE

A code that identifies a specific organization, fund, or other reporting entity. The company code must already exist in the Company 
Constants table (F0010) and must identify a reporting entity that has a complete balance sheet. At this level, you can have intercompany 
transactions. Note: You can use company 00000 for default values such as dates and automatic accounting instructions. You cannot use company 00000 
for transaction entries.

szCatCode1KV01charNONENONE

The first key postion of the forecasting hierarchy.  The value in this field relates to the first level chosen in the forecasting constants.

szCatCode2KV02charNONENONE

The second key postion of the forecasting hierarchy.  The value in this field relates to the second level chosen in the forecasting constants.

szCatCode3KV03charNONENONE

The third key postion of the forecasting hierarchy.  The value in this field relates to the third level chosen in the forecasting constants.

szCatCode4KV04charNONENONE

The forth key postion of the forecasting hierarchy.  The value in this field relates to the fourth level chosen in the forecasting constants.

szCatCode5KV05charNONENONE

The fifth key postion of the forecasting hierarchy.  The value in this field relates to the fifth level chosen in the forecasting constants.

szCatCode6KV06charNONENONE

The sixth key postion of the forecasting hierarchy.  The value in this field relates to the sixth level chosen in the forecasting constants.

szCatCode7KV07charNONENONE

The seventh key postion of the forecasting hierarchy.  The value in this field relates to the seventh level chosen in the forecasting constants.

szCatCode8KV08charNONENONE

The eighth key postion of the forecasting hierarchy.  The value in this field relates to the eighth level chosen in the forecasting constants.

szCatCode9KV09charNONENONE

The ninth key postion of the forecasting hierarchy.  The value in this field relates to the ninth level chosen in the forecasting constants.

szCatCode10KV10charNONENONE

The tenth key postion of the forecasting hierarchy.  The value in this field relates to the tenth level chosen in the forecasting constants.

mnAddressNumberAN8MATH_NUMERICNONENONE

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

cMonthlyVsWeeklyEV01charNONENONE

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

cForecastAmountsEV01charNONENONE

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

idSummaryLinkListGENLNGIDNONENONE

General purpose ID variable.

mnPercentOverLastYearMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnCalcPercentNoMonthsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnMoveAvgNoMonthsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnLinearApproxNoMonthsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnLSRNoMonthsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnNumberMonthsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnFlexiblePercentMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnNumberWeightedPeriodsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight1PeriodPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight2PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight3PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight4PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight5PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight6PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight7PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight8PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight9PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight10PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight11PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnWeight12PeriodsPriorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnLinearSmoothingNoMonthsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnExponSmoothingNoMonthsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnMethod11AlphaFactorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

cSeasonalityEV01charNONENONE

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

mnMethod12AlphaFactorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

mnMethod12BetaFactorMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

idPtrToHierarchyGENLNGIDNONENONE

General purpose ID variable.

mnChildKeySFKEMATH_NUMERICNONENONE

Summary Forecast Key

szBranchMCUcharNONENONE

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.

mn2ndDegreeApproxNoMonthsMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

idPtrToExpoForecastGENLNGIDNONENONE

General purpose ID variable.

idDetailRecordsGENLNGIDNONENONE

General purpose ID variable.

cDatePatternEV01charNONENONE

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

mnMonthsBestFitMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

cMeanAbsoluteDeviationEV01charNONENONE

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

cWriteNegativeValuesEV06charNONENONE

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

szTypeTransactionTYTNcharOPTNONE

The qualifier used to identify a specific type of transaction.

Related Functions

B0000175 Get Next Transaction Number
B3400690 Forecast Retrieve Calculations
B3400775 Update Detail Forecast Records
B3400810 Forecast Calculate Dates
B3400820 F3460 Generate Actual Numbers
B3400880 Forecast Exponential Smoothing
B3400980 Forecast Release Actuals
B3401010 Forecast Calculate Best Fit
B3401050 Forecast Accumulate Actuals
B4001040 Get Item Master Description UOM
B9800100 Get Audit Information
B9800420 Get Data Dictionary Definition
N4700060 EDI Batch Number, Get Next Number

Related Tables

F3002 Bill of Material Master File
F3400 Forecast Summary File
F34006 Forecast Summary Work File
F3460 Forecast File
F3460Z1 Forecast Unedited Transactions
F4091 Category Code Key Position File