MRPWriteTimeSeriesData

MRP, Write Time Series Data

Major Business Rule

Object Name: B3400590

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description
This business function will get read the MRP Regular Item Cache (using B34001290) and Write Time 
Series Records to the Time Series Table (F3413). It will also calculate the ATP/CATP data and optionally 

write those records to F3413 table. 


1.1Purpose
This function is used to wirte the Time Series Data for an Item after Planning the Item for the MRP 
Planning program P3482. The function will return error codes necessary. This function is also shared by 

R3483 for Multi-Plant MRP Processing.


1.2Setup Notes and Prerequisites
The Manufacturing Data from the Item Balance table must be obtained and all other data must be loaded 
in the Regular Item Cache and Bucketless Date Cache. The JOBS and CTID must be obtained using 

B3100710 and B9800180 before calling this function. Please note that this is the output after planning and 

care must be taken while making changes in the code. 


1.3 Special Logic

2.Technical Specifications

      Allocate Space for Arrays
Open Table

Load @BD Array Elements with Date Branch

If Input WriteTSForCoby <> '1'

Load Quantity  Array Elements from Cache and UI
Else

Load Quantity Array Elements from F34UI005.

End If


Calculate Time Series Data

Write Time Series Data


The following actions have to be performed by the Business Function.

1.Open Tables

Open F34UI005 and F3413 Tables.
If unable to Open the tables

Exit with an Error Code of '1'.

      Endif


2. Allocate Space for the Arrays

Allocate Memory Space for the following Arrays/Structure
@BD[$$PN] - Bucket Date Array

DSPED[$$PN] - Structure Containing the following Elements

DSBAU- Beginning Available Unadjusted 

DSBA - Qty Beginning Available

DSLEX - Lot Expired Qty

DSIR  - Qty In Rec Routing

DSFCSU - Forecast Qty Unadjusted

DSFCST - Forecast Qty Adjusted

DSSOU - Sales Order Qty Unadjusted

DSSO - Sales Order Qty Adjusted

DSPOU - Purch Order Qty  Unadjusted

DSPO - Purch Order Qty Adjusted

DSWOU - Work Order Qty Unadjusted

DSWO - Work Order Qty Adjusted

DSRSU - Rate Schedule Qty Unadjusted

DSRS - Rate Schedule Qty Adjusted

DSFWOU - Firm WO Parts List Qty Unadjusted

DSFWO - Firm WO Parts List Qty Adjusted

DSPWO - Planned WO Parts List Qty

DSID- Inter Plant Demand

DSPLO - Planned Order Qty

DSPRC - Planned Order Qty from Process

DSEAU- Ending Available Unadjusted

DSEA- Ending Available Adjusted

DSATPU- ATP Undajusted

DSATP- ATP Adjusted

DSCATPU- Cum ATP Undajusted

DSCATP- Cum ATP Adjusted

DSSHP- Shipped Qtys Adjusted


 3. Load @BD Array Elements 


 Call B3401270 in mode '1' to get first date record using Input Date Branch.
Wk Index ($B) = 1

While Cache Code Error = '0' And $B <= $$PN

If Bucket Flag = 'B' Or Forecast Consumption Flag <> ' '  then

@BD[$B] = Date from Date Record

$B++

End If

Call B3401270 in mode '6' to get next date record using Date Input Branch.

End While


4. Load Quantity  Array Elements from Cache and UI.


$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'BAU' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSBAU[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'BA' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSBA[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'LEX' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSLEX[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'IR' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSIR[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'FQU' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSFCSU[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'FQ' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSFSCT[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'SOU' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSSOU[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'SO' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSSO[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'POU' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSPOU[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'PO' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSPO[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'WOU' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSWOU[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'WO' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSWO[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'PQU' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSFWOU[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'PLU' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSFWOU[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'FPQ' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSFWO[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'FPL' (2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSFWO[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'PPQ'(2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSPWO[$B] += Quantity from Cache.

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'RSU'(2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSRSU [$B] += Quantity from Cache

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'RS'(2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSRS[$B] += Quantity from Cache

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'ID'(2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSID[$B] += Quantity from Cache

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'PLQ'(2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSPLO[$B] += Quantity from Cache

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While

$B = 1

Call B3401290 in mode '1', sequential fetch, with Input Job, Input Branch, and 'SHP'(2 keys)

While Cache Error Code = '0'

While Date from Cache > @BD[$B]

$B++

End While

DSSHP[$B] += Quantity from Cache

Call B3401290 in mode '6', sequential fetch, same 2 keys.

End While


/* Load Process qtys from F34UI005 if they exist */

$B = 1
While Exit <> '1'
Read Records from F34UI005 using Input JOBS, CTID, Branch and Item. Order by Index 1.

If Read Failed then 

Break
End If
While Date from F34UI005 > @BD[$B]

$B++

End While

If Quantity Type = 'PIR' then
DSIR[$B] += F5NQ01

End If

If Quantity Type = 'PWU' then

DSWOU[$B] += F5NQ01.

End If

If Quantity Type = 'PWO' then

DSWO[$B] += F5NQ01.

End If

If Quantity Type = 'PRU' then

DSRSU [$B] += F5NQ01.

End If

If Quantity Type = 'PRS' then

DSRS[$B] += F5NQ01.

End If

If Quantity Type = 'PPQ' then

DSPRC[$B] += F5NQ01.

End If

End While

5. Load Quantity  Array Elements from F34UI005.

$B = 1
While Exit <> '1'
Read Records from F34UI005 using Input JOBS, CTID, Branch and Item. Order by Index 1.

If Read Failed then 

Break
End If

While Date from F34UI005 > @BD[$B]

$B++

End While

If Quantity Type = 'BAU' then
DSBAU[$B] += F5NQ01

End If

If 

Data Structure

D3400590 - MRP, Write Time Series Data

Parameter NameData ItemData TypeReq/OptI/O/Both
mnJobnumberJOBSMATH_NUMERICNONENONE

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

szComputerIdCTIDcharNONENONE

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.

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

mnSafetyStocksSAFEMATH_NUMERICNONENONE

The quantity of stock kept on hand to cover high-side variations in demand.

szReportingCodeRTcharNONENONE

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

cSafetyStockFlagEV01charNONENONE

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

nNumBucketDatesINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

nFirstATPPeriodINT02integerNONENONE

Number of Days in the Past to Query for Quote Requests Received. 

nNoofPastDuePeriodsINT03integerNONENONE

Event point for Integer.

jdBeginningDateDATE01JDEDATENONENONE

Event point for JDE Date.

jdPlanningDateDATE02JDEDATENONENONE

Event point for JDE Date.

cBegAvailUnadjustedEV01charNONENONE

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

cBeginningAvailableEV02charNONENONE

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

cReceiptRoutingEV03charNONENONE

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. 

cPurchOrderUnadjustedEV04charNONENONE

PeopleSoft event point processing flag 04.

cPurchOrderAdjustedEV05charNONENONE

A flag that indicates whether automatic spell check is turned on.

cWorkOrderUnadjustedEV06charNONENONE

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

cWorkOrderAdjustedEV07charNONENONE

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

cRateScheduleUnadjustedEV08charNONENONE

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

cRateScheduleAdjustedEV09charNONENONE

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

cLotExpirationEV10charNONENONE

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

cForecastUnadjustedEV01charNONENONE

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

cForecastAdjustedEV02charNONENONE

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

cSalesOrderUnadjustedEV03charNONENONE

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. 

cSalesOrderAdjustedEV04charNONENONE

PeopleSoft event point processing flag 04.

cInterPlantDemandEV05charNONENONE

A flag that indicates whether automatic spell check is turned on.

cPartsListUnadjustedEV06charNONENONE

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

cFirmPartsListEV07charNONENONE

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

cPlanPartsListEV08charNONENONE

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

cEndingAvailUnadjustedEV09charNONENONE

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

cEndingAvailAdjustedEV10charNONENONE

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

cPlannedOrdersEV01charNONENONE

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

cATPUnadjustedEV02charNONENONE

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

cATPAdjustedEV02charNONENONE

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

cCATPUnadjustedEV03charNONENONE

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. 

cCATPAdjustedEV04charNONENONE

PeopleSoft event point processing flag 04.

cSuppressErrorMessageEV05charNONENONE

A flag that indicates whether automatic spell check is turned on.

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

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.

jdFirstBeginningDateDATE01JDEDATENONENONE

Event point for JDE Date.

cForecastConsumptionFlagEV02charNONENONE

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

cWriteTSForCoByEV01charNONENONE

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

szDateBranchMCUcharNONENONE

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.

szJobNumberAsStringJOBcharNONENONE

Job Number

cConsolidationMethodEV01charNONENONE

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

cShippedQtysEV01charNONENONE

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

cProcessPlanningFlagEV01charOPTNONE

sakai!
^

cFirmInterplantDemandEV01charOPTNONE

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

cTotalIndependentDemandUnadjEV01charOPTNONE

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

cTotalIndependentDemandAdjEV01charOPTNONE

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

cInterplantConsumesForecastEV01charOPTNONE

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

szProgramIdPIDcharOPTNONE

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.

cFirmInterplantDemandUnadjEV01charOPTNONE

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

cProjectPlanningEV01charOPTNONE

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

cProjectSpecificItemEV01charOPTNONE

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

Related Functions

B3401270 Cache, Process MRP Bucketless Dates
B3401290 Cache, Process MRP Item Quantities
B3500060 Cache, Process Multi Plants

Related Tables

F3413 MPS/MRP/DRP Summary File
F34UI005 MRP Orders/Requirements User Index-Process Item
F4102 Item Branch File