CreateSummaryForecasts

Create Summary Forecasts

Major Business Rule

Object Name: B3400790

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This function create the Summarized Forecast records (F3400) 

1.2Setup Notes and Prerequisites


1.3Special Logic


2.Technical Specifications

1.Create a LinkList with the following fields
2   4DS$KVR

5   6DS$TYF

7   11DS$CO

12  17DS$K01

18  23DS$K02

24  29DS$K03

30  35DS$K04

36  41DS$K05

42  47DS$K06

48  53DS$K07

54  59DS$K08

60  65DS$K09

66  71DS$K10

72  79DS$ITM

80  85DS$DRQ

86  93DS$AN8

94102DS$KEY

and make an array @DS equal postion 12 through 71 ( 10 buckets that are each 6 big)


2.Retrieve the Summary Constants Record (F4091) by chaining to the file with SummaryCode Store 

the record in an array (@KC, 40 positions each 3 big)


3.Place the SoldTo passed in into the sgan8



4.If SoldTo is not equal to zeros

And RetreiveCatCodes= 1

Retrieve the Address Book record (F0101) with SoldTo as the key

Else

Chain to the Cost Center Master file (F0006) with the Branch 

and get the address book number associated with that branch

(MCAN8)

If MCAN8 is not 0

Retrieve the Address Book record (F0101) with MCAN8

End


5.Store the 20 Category Codes from the Address Book record (abac01-20) in the first 20 poistions 

of @CC 

( @CC is 40 positions each 6 big)


Store the 20 Category Codes from the Item Branch record (ibsrp1-5 , ibprp1-9,0 and ibsrp6-9,0) 

after the address book codes in the same @CC array Load the key fields :


6.If the Customer Level (KFCSLV) from the summary constants record (F4091) is not equal to blanks


If SoldTo is equal to zeros 

Move -99999999 into SGAN8

Else

Move SoldTo into SGAN8

End

Convert KFCSLV to an integer and save in $$CSLV

Else

Move zeros to SGAN8

End


7.If Item Summary Y/N (KFITSM) is equal to Y

Move ShortItemNumber to SGITM

Else

Move zeros to SGITM

End


8.If Company Summary Y/N (KFCOSM)from F4091 is equal to Y

Chain to the Cost Center Master (F0006) with Branch

and move the company number off the record to SGCO

Else

Move zeros to SGCO

End


9.Move CompareDate to SGDRQJ

Move ForecastType to SGTYPF

Move SummaryCode to SGKVER


10.Load the Category Code pieces for the key from the array

Look up the values '01' - '10' in the constants array (@KC)

What ever position in the array you get a hit on for each of the values

go to that position in the category codes array (@CC)and if there is a

value there load it into the corresponding key field SGKV01-

SGKV10.  If there is not a value there move '*BLANK' to the

key field

Save how many hits there are (ie. if 01 through 04 are found count = 4)


11.Move the SG fields into their corresponding values in the Link List

Move zeros to $Key

Move '1' to first pass 34006 flag


12.Back the key values off the structures one at a time and write Summary records to F3400

If Item Summary Y/N (KFITSM)from F4091 is equal to Y
Move zeroes to DS$ITM

If Company is not equal to Y

And Count equals zero

And Customer Level equals zero

And Global is equal to Y

Move YYYYY to DS$CO

End

Link List Routine (see below)

Write and Update Summary Forecast Records (see below)

If Company is not equal to Y

And Count equals zero

And Customer Level equals zero

And Global is equal to Y

Move Blanks to DS$CO

End

Copy the key values from the DS to the SG fields

End


Move count to $C

Do $C

If $$CSLV > $C

Move zeroes to DS$AN8

Move zeroes to $$CSLV

Else

If $C equals 1

And $CSLV equals 0

And Company equals N

And Global equals Y

Move XXXXXX to DS,$C

Else

Move Blanks to DS,$C

End

Subtract 1 from $C

End

Move SGSFKY to $Key


Link List Routine (see below)

Write and Update Summary Forecast Records (see below)

If $C equals 1

And $CSLV equals 0

And Company equals N

And Global equals Y

Move Blanks to DS,$C

End

Copy the key values from the DS to the SG fields

End


If $$CSLV is greater than zero

Move zeroes to DS$AN8

If CompanySummary is not equal to Y

And Global = Y

Move  YYYYY   DS$CO

End

Link List Routine (see below)

Write and Update Summary Forecast Records (see below)

If CompanySummary is not equal to Y

And Global = Y

Move Blanks to DS$CO

End

Copy the key values from the DS to the SG fields

Move zeroes to $$CSLV

End


If Company Summary Y/N (KFCOSM)from F4091 is equal to Y

Move XXXXX to DS$CO

Link List Routine (see below)

Write and Update Summary Forecast Records (see below)

Move blanks to DS$CO

Copy the key values from the DS to the SG fields

End


If Global Summary Y/N (KFGLSM)from F4091 is equal to Y

Link List Routine (see below)

Write and Update Summary Forecast Records (see below)

End



13.LinkList Routine

If $key is equal to zeros

Save SGDRQJ

Chain to the Summary Forecast table (F3400) with the full key except the date

If a record is not found

assign a component summary key number from NextNumber X0010 

System Code 34

Index 01

Return NextNumber to $Key

Else

move SGSFKE to $Key

End

Replace SGDRQJ

End


Inquire over the index with the key minus one

If a record is not found 
assign a parent summary key number from a Call to NextNumber X0010

System Code 34
Index 01

Return NextNumber to DS$Key

Add record to the Link List

Else

Move $Key from link list item to DS$KEY

End

Move $Key to SGSFKE

Move DS$KEY to SGSFKY


If first pass 34006 flag equals '1'

SGKVERSJKVER

SGTYPRSJTYPF

ShortItemNumberSJITM

SGSFKESJSFKY

BranchSJMCU


Chain to the Forecast Summary Work file (F34006) with a full key

If a record is not found write one


Move a blank to first pass 34006 flag



Write and Update Summary Forecast Records

Chain to the Summary Forecast table (F3400) with the full key
If the record does not exist write it

Original QuantitySGUORG

Original AmountSGAEXP

Forecast QuantitySGFQT

ForecastAmountSGFAM

'N'SGBPFC

and audit info

Else

update record

BlanksSGRVIS

Add Original QuantitySGUORG

Add Original AmountSGAEXP

Add Forecast QuantitySGFQT

Add Forecast AmountSGFAM

and audit info

End




^

Data Structure

D3400790 - Create Summary Forecasts

Parameter NameData ItemData TypeReq/OptI/O/Both
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

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.

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 

mnOriginalQuantityUORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

mnOriginalAmountAEXPMATH_NUMERICNONENONE

The number of units multiplied by the unit price.

mnSoldToAN8MATH_NUMERICNONENONE

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

jdCompareDateDRQJJDEDATENONENONE

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

cRetrieveCatCodesEV02charNONENONE

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

szSummaryCodeKVERcharNONENONE

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

idLinkListPtrGENLNGIDNONENONE

General purpose ID variable.

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.

mnForecastAmountFAMMATH_NUMERICNONENONE

The current amount of the forecasted units for a planning period.

mnForecastQuantityFQTMATH_NUMERICNONENONE

The quantity of units forecasted for production during a planning period.

Related Functions

B9800100 Get Audit Information

Related Tables

F0006 Business Unit Master
F0101 Address Book Master
F3400 Forecast Summary File
F34006 Forecast Summary Work File
F4091 Category Code Key Position File
F4102 Item Branch File