DetermineTimeSeries

Determine Time Series

Minor Business Rule

Object Name: B3400330

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description
This function is to be used to determine the time series dates and quantities by date for the 
selected Item Number and Branch/Plant.  This business function will calculate the time series quantities, 

time series period dates, and pass those back in the form of a string.  The application using this 

function should provide the short item number, cost center, user defined code system code, user defined code 

record type, user defined code key, starting date, and units of measure for conversion.


1.1Purpose
The purpose of this business function is to calculate the time series amounts for a selected item and 
branch/plant.  The first call to this business function will pass a blank in the user defined code 

key.  This should signal to the business function that the dates for this system code and record type 

are being requested.  The second and all subsequent calls will pass a non-blank code to signal to the 

business function that the quantities should be returned.


If the input unit of measure parameters are not the same, the function will retrieve a conversion 

factor which will be applied to the retrieved quantities.  These quantities will also need to be 

converted to a string and placed in the parameter that matches the previously returned dates.  An error should 

be returned if no quantities exists for this user defined code key, item, and branch or if the 

function is unable to retrieve a conversion factor between the two units of measure.


When summarizing supply and demand records, the input Summary Flag parameter must be set to one.  The 

Initialize Quantity Fields parameter should be set to one to signal when the quantity acumulation 

array should be initialized to zero. The business function will continue to accumulate values until the 

initialization flag is reset to 0.


1.2Setup Notes and Prerequisites

The use of this business function is for both retrieval of dates and quantities.  All will be 
returned in string formats.

• By Item, Branch, and Start Date
• 52 possible quantity/date parameters
• Application will only call business function as needed
• Application must call business function FreePointerToDataStructure to free the memory allocated for 
the date array and quantity summary array


1.3Special Logic

This business function will need to allow for math numeric and date fields to be passed back to the 
application in string format.


2.Technical Specifications

Qty Summary Array = Qty Summary Array Ptr from data structure
If Summary Flag = '1'

If Qty Summary Array = NULL

Allocate memory for Qty Summary Array which will hold 52 MATH NUMERIC values

If memory allocation fails

Set Error Message ID = '4346'.  If Suppress Error Messages <> '1', SetGBRError 

withcode '4346'

Exit the function

EndIf

EndIf

If Initialize Quantity Fields = '0'

Initialize the Qty Summary Array to zeroes

EndIf

EndIf


If Initialize Quantity Fields = 0

Initialize all output quantity strings to ' '

Suppress Quantity = '1'

EndIf

Date Array = Date Array Ptr from data structure


Open the Time Series table (F3413)
If the open fails

Set Error Message ID = '3143'.  If Suppress Error Messages <> '1', SetGBRError with code '3143'

Exit the function

EndIf


If KY = ' '

If Date Array = NULL

Allocate memory for Date Array which will hold 52 sorted JDEDATE values

If memory allocation fails

Set Error Message ID = '4346'.  If Suppress Error Messages <> '1', SetGBRError 

with code '4346'

Exit the function

EndIf

EndIf


Date Count = 0

Wk Key = ' '

Call GetAllUDCValues with Type = '1' to open the F0005 table and retrieve the first Key value 

for the input System Code and Report Type

If successful 

Wk Key = DRKY

EndIf


While Wk Key <> ' '

While EOF F3413 not reached

Read the next Time Series record using the partial key Short Item (ITM), 

Branch (MCU), and Quantity Type (QT)

If record found and MRSTRT >= input Start Date and MRSTRT is not a member of 

Date Array

If (Date Count = 52 and MRSTRT > Date Array[0] and MRSTRT < Date Array[51]) 

or(Date Count < 52)

Insert MRSTRT into the proper index position in Date Array to maintain a 

sorted array

Date Count = min(52, Date Count + 1)

Else

If Date Count = 52 and MRSTRT > Date Array[51]

Exit the inner While loop

EndIf

EndIf

EndIf

EndWhile

Wk Key = ' '

Call GetAllUDCValues with Type = '2' to retrieve the next Key value for the input 

System Code and Report Type

If successful 

Wk Key = DRKY

EndIf

EndWhile


Call GetAllUDCValues with Type = '3' to close the F0005 table and release the request


If Date Count = 0

Set Error Message ID = '0001'. If Suppress Error Messages <> '1', SetGBRError  with 

code '0001'

Else

For each date stored in Date Array

Copy the Date Array date into the next output Transaction Quantity parameter

EndFor

EndIf

EndIf


If KY <> ' ' and Date Array <> NULL

Wk Conversion Factor = 1

If Primary UOM <> Selected UOM

Call B4000520 to get the conversion factor from Primary UOM to Selected UOM

If the retrieval was successful

Wk Conversion Factor = retrieved conversion factor

Else

Set Error Message ID = '0269' ('Unit of Measure Conversion Unsuccessful')

EndIf

EndIf

While EOF not reached

Read the next Time Series record using the partial key ITM, MCU, KY

If a record was found

If MRSTRT is a member of the array Date Array

MRTRQT = MRTRQT * Wk Conversion Factor

If Summary Flag = '1'

Set Wk Quantity = the Summary Quantity in Qty Summary Array 

corresponding to MRSTRT

MRTRQT = MRTRQT + Wk Quantity

Save MRTRQT back into Qty Summary Array

EndIf

Convert MRTRQT to a string (Wk Quantity String)

Set the output Transaction Quantity parameter corresponding to MRSTRT = 

Wk Quantity String

Suppress Quantity = '0'

Else

If MRSTRT >= Start Date

Exit the While loop

EndIf

EndIf

EndIf

EndWhile

EndIf



^

Data Structure

D3400330 - Determine Time Series


Data Item Data Structure DescriptionI/ORequiredNotes


ITM            Short Item                         IYes

MCU            Cost Center                        IYes

SY            System Code                        IYes

RT            Record Type                        IYes

KY            Key (Quantity Type)            INo

UOM1            Primary Unit of Measure            IYes

UOM            Selected Unit of Measure      IYes

STRT            Start Date                        INo

EV01            Suppress Error Messages            IYes      1 = Suppress run time error 

message                                                                                                 

                                                handling 0 = Allow run time error                     

                                                    message handling

DTAI            Error Message ID                  ONo

GENLNG      Pointer to Date Array            I/OYes

GENLNG      Pointer to Quantity Summary ArrayI/OYes

EV02            Suppress Quantity                  OYes      1 = All quantity values are 

blank 0 =                                                                         Non-blank quantity 

found

QT01E1      Quantity Time Series 01            ONo      String

QT02E1      Quantity Time Series 02         ONo      String

QT03E1      Quantity Time Series 03            ONo       String

QT04E1      Quantity Time Series 04            ONo      String

QT05E1      Quantity Time Series 05            ONo      String

QT06E1      Quantity Time Series 06            ONo      String

QT07E1      Quantity Time Series 07            ONo      String

QT08E1      Quantity Time Series 08            ONo      String

...

QT52E1      Quantity Time Series 52        ONo      String

EV03            Initialize Quantity Fields      IYes      1=Do not initialize quantity 

values                                                                         0=Initialize quantity 

values to zero

EV04            Summary Flag                  IYes      1=Summarize quantity values 

0=Do not                                                                                                

                                                                         summarize quantity values


^

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

szCostCenterMCUcharNONENONE

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.

szSystemCodeSYcharNONENONE

A user defined code (98/SY) that identifies a system. Valid values include: 01 Address Book 03B Accounts Receivable 04 Accounts 
Payable 09 General Accounting 11 Multicurrency

szRecordTypeRTcharNONENONE

A code that identifies the table that contains user defined codes. The table is also referred to as a UDC type.

szKeyQuantityTypeKYcharNONENONE

A list of valid codes for a specific user defined code list.

jdStartDateSTRTJDEDATENONENONE

The start date for the order. You can enter this date manually, or have the system calculate it using a backscheduling routine. The routine 
starts with the required date and offsets the total leadtime to calculate the appropriate start date.

cSuppressErrorMessagesEV01charNONENONE

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

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.

cSuppressQuantityEV02charNONENONE

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

idDateArrayGENLNGIDNONENONE

General purpose ID variable.

szSelectedUnitOfMeasureUOMcharNONENONE

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

szPrimaryUnitOfMeasureUOM1charNONENONE

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

szQuantityTimeSeries01QT01E1charNONENONE

Time Series Quantity column 01.

szQuantityTimeSeries02QT02E1charNONENONE

Time Series Quantity column 02

szQuantityTimeSeries03QT03E1charNONENONE

Time Series Quantity column 03

szQuantityTimeSeries04QT04E1charNONENONE

Time Series Quantity column 04

szQuantityTimeSeries05QT05E1charNONENONE

Time Series Quantity column 05

szQuantityTimeSeries06QT06E1charNONENONE

Time Series Quantity column 06

szQuantityTimeSeries07QT07E1charNONENONE

Time Series Quantity column 07

szQuantityTimeSeries08QT08E1charNONENONE

Time Series Quantity column 08

szQuantityTimeSeries09QT09E1charNONENONE

Time Series Quantity column 09

szQuantityTimeSeries10QT10E1charNONENONE

Time Series Quantity column 10

szQuantityTimeSeries11QT11E1charNONENONE

Time Series Quantity column 11

szQuantityTimeSeries12QT12E1charNONENONE

Time Series Quantity column 12

szQuantityTimeSeries13QT13E1charNONENONE

Time Series Quantity column 13

szQuantityTimeSeries14QT14E1charNONENONE

Time Series Quantity column 14

szQuantityTimeSeries15QT15E1charNONENONE

Time Series Quantity column 15

szQuantityTimeSeries16QT16E1charNONENONE

Time Series Quantity column 16

szQuantityTimeSeries17QT17E1charNONENONE

Time Series Quantity column 17

szQuantityTimeSeries18QT18E1charNONENONE

Time Series Quantity column 18

szQuantityTimeSeries19QT19E1charNONENONE

Time Series Quantity column 19

szQuantityTimeSeries20QT20E1charNONENONE

Time Series Quantity column 20

szQuantityTimeSeries21QT21E1charNONENONE

Time Series Quantity column 21

szQuantityTimeSeries22QT22E1charNONENONE

Time Series Quantity column 22

szQuantityTimeSeries23QT23E1charNONENONE

Time Series Quantity column 23

szQuantityTimeSeries24QT24E1charNONENONE

Time Series Quantity column 24

szQuantityTimeSeries25QT25E1charNONENONE

Time Series Quantity column 25

szQuantityTimeSeries26QT26E1charNONENONE

Time Series Quantity column 26

szQuantityTimeSeries27QT27E1charNONENONE

Time Series Quantity column 27

szQuantityTimeSeries28QT28E1charNONENONE

Time Series Quantity column 28

szQuantityTimeSeries29QT29E1charNONENONE

Time Series Quantity column 29

szQuantityTimeSeries30QT30E1charNONENONE

Time Series Quantity column 30

szQuantityTimeSeries31QT31E1charNONENONE

Time Series Quantity column 31

szQuantityTimeSeries32QT32E1charNONENONE

Time Series Quantity column 32

szQuantityTimeSeries33QT33E1charNONENONE

Time Series Quantity column 33

szQuantityTimeSeries34QT34E1charNONENONE

Time Series Quantity column 34

szQuantityTimeSeries35QT35E1charNONENONE

Time Series Quantity column 35

szQuantityTimeSeries36QT36E1charNONENONE

Time Series Quantity column 36

szQuantityTimeSeries37QT37E1charNONENONE

Time Series Quantity column 37

szQuantityTimeSeries38QT38E1charNONENONE

Time Series Quantity column 38

szQuantityTimeSeries39QT39E1charNONENONE

Time Series Quantity column 39

szQuantityTimeSeries40QT40E1charNONENONE

Time Series Quantity column 40

szQuantityTimeSeries41QT41E1charNONENONE

Time Series Quantity column 41

szQuantityTimeSeries42QT42E1charNONENONE

Time Series Quantity column 42

szQuantityTimeSeries43QT43E1charNONENONE

Time Series Quantity column 43

szQuantityTimeSeries44QT44E1charNONENONE

Time Series Quantity column 44

szQuantityTimeSeries45QT45E1charNONENONE

Time Series Quantity column 45

szQuantityTimeSeries46QT46E1charNONENONE

Time Series Quantity column 46

szQuantityTimeSeries47QT47E1charNONENONE

Time Series Quantity column 47

szQuantityTimeSeries48QT48E1charNONENONE

Time Series Quantity column 48

szQuantityTimeSeries49QT49E1charNONENONE

Time Series Quantity column 49

szQuantityTimeSeries50QT50E1charNONENONE

Time Series Quantity column 50

szQuantityTimeSeries51QT51E1charNONENONE

Time Series Quantity column 51

szQuantityTimeSeries52QT52E1charNONENONE

Time Series Quantity column 52

cInitializeQuantityFieldsEV03charNONENONE

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. 

idQtySummaryArrayGENLNGIDNONENONE

General purpose ID variable.

cSummaryFlagEV04charNONENONE

PeopleSoft event point processing flag 04.

Related Functions

None

Related Tables

None