MRPWritePurchaseOrderQtyToCache

MRP, Write Purchase Order Qty To Cache

Major Business Rule

Object Name: B3400420

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description
This business function will get read the Purchase Order table (F4311) and Load the Open Quantity 

Calculated in the Item Qty Cache in the Primary Unit of Measure. It will also cache the Purchase Order 

records that were selected for use and store the PO quantities in the Primary UOM.


1.1Purpose

This function is used to obtain data from the F4311 table for the MRP Planning Program P3482. The 

function will return error codes necessary. 


1.2Setup Notes and Prerequisites

It is assumed at the time this function is called, the PO Cache has no residual data on the same Item 

and Branch. Otherwise duplicate POs will be in the cache.


1.3Special Logic

None


2.Technical Specifications

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

1.Open Tables and Initialize Data

Open F4311, F34004 and F3411 tables

If Error in Opening the Tables, Exit the function with an Error code = '1'

If Input Receipt Routing flag = '1'

Open F43092

If Error in Opening F43092

Input Rec Rtg Flag = ' '.

Endif

Endif

Output PO flag = '0'.


2. Load the Purchase Order Data in the Cache and cache the PO record if not already cached.

If Input Consolidation Method = '1' then

Wk PO Branch = Input Date Branch

Wk Cache Branch = Input Date Branch

Else

Wk PO Branch = Input Branch

Wk Cache Branch = Input Branch

End IF

Switch (Input Number of Past Due Periods $PDUE)

Case 0

If Forecast Consumption Flag($$FCP) = '1'

Wk From Date = Input Forecast Beginning Date($$FBDT)

Else

Wk From Date = Input Begin Date ($$BEG)

End If

Select Records from F4311 Using PDITM=Input Item, PDMCU=Input Branch and 
Wk From Date <= PDPDDJ <= Input Last Date

Case 1
If Forecast Consumption Flag($$FCP) = '1'

Select Records from F4311 Using PDITM=Input Item, PDMCU=Input 
Branch and Input Forecast Beginning Date($$FBDT) <= PDPDDJ <= Input Last Date

Else

Select Records from F4311 Using PDITM=Input Item, PDMCU=Input 
Branch and PDPDDJ <= Input Last Date

End If

Case 2

Select Records from F4311 Using PDITM=Input Item, PDMCU=Input 
Branch and PDPDDJ <= Input Last Date

End Switch

Wk Exit Flag = '0'


While Wk Exit flag <> '1'
Fetch the F4311 Record.

If Fetch Failed

Break

Endif

If PDPDDJ = 0

Continue

Endif

Call B3401300 in 'GET' mode to fetch record from Inclusion Rules cache, using PDDCTO, PDLNTY, 
PDNXTR.

If Cache Code Error <> '0' (Not Found)

Continue

Endif

Wk Quantity = PDUOPN

If Wk Quantity > 0 and PDUOM <> Input UOM1 Or PDUOM <> PDUOM3 Or Input 

SVOT1Y = 'Y'

Convert Wk Quantity from PDUOM to Input UOM1 using B4000520

Endif

Wk Rec Rtg Qty = 0

If  Rec Rout Code PDRTGC = 'Y' and Input Rec Rtg flag = '1'

Wk Index = 1

While Wk Index <= 5

Wk UPIB = Blanks

Case Wk Index = 1

Wk UPIB = 'PREQ'

Case Wk Index = 2 and Input Trans flag <> '1'

Wk UPIB = 'QTTR'

Case Wk Index = 3 and Input Inspect flag <> '1'

Wk UPIB = 'QTIN'

Case Wk Index = 4 and Input Other1 flag <> '1'

Wk UPIB = 'QTO1'

Case Wk Index = 5 and Input Other2 flag <> '1'

Wk UPIB = 'QTO2'

End Case

If Wk UPIB <> Blanks

While Wk Exit flag 1 <> '1'

Read the F43092 rows using PDRTGC, Wk UPIB, PDDOCO, 

PDDCTO, PDKCOO,PDSFXO, PDLNID as keys

If not found

Break

Endif

Wk Quantity 1 = PXQTYO

If PXUOM <> Input UOM1 Or Input Potency Control 

Flag(SVOT1Y) ='Y'

Convert Wk Quantity 1 from PXUOM to Input 

UOM1 using B4000520

Endif

Wk Rec Rtg Qty = Wk Rec Rtg Qty + Wk Quantity 1

EndWhile

Endif

Add 1 to Wk Index

EndWhile

Endif

If PDUNCD from F4311 <> 'Y' then

Cache the PO record in the Purchase Order Cache.
Call B3401320 in 'ADD' mode to cache the PO record using PDDOCO, PDDCTO, PDKCOO, PDSFXO, 

PDLNID, MCU=Wk PO Branch, PDAN8, PDTRDJ, PDPDDJ, PDITM, PDRORN, PDRCTO, PDRKCO, PDRLLN, EV01 Flag = 

' ' and Wk Quantity.

End If


If Wk Quantity > 0  then

Cache the PO Qty in the Item Qty Cache
Call B3401290 in 'GET' mode to fetch Item Qty cache record using Wk Cache Branch, 

PDPDDJ and 'POU'.

If Cache Code Error = '0' (Record Found)
Add Wk Quantity to Quantity from Cache record, and 

Call B3401290 in 'UPDATE' mode to update the cache record.

Else

Call B341290 in 'ADD' mode to add a new cache record with Wk Cache 
Branch,PDPDDJ, 'POU' and with Wk Quantity

End If
End If


If Wk Rec Rtg Quantity > 0 then 

Cache the IR Qty in the Item Qty Cache
Call B3401290 in 'GET' mode to fetch Item Qty cache record using Wk Cache Branch, 
PDPDDJ, and 'IR'.

If Cache Code Error = '0' (Record Found)
Add Wk Rec Rtg Quantity to Quantity from Cache record, and

Call B3401290 in 'UPDATE' mode to update the cache record.

Else

Call B3401290 in 'ADD' mode to add a new cache record with Wk Cache 
Branch, PDPDDJ, 'IR' and Wk Rec Rtg Quantity.

End If
End If

Call B3401270 in mode '9' to get the nearest date from the bucketless date cache which is <= 
PDPDDJ and with Input Date Branch. 

If that bucketless date is found then store it in Wk Bucketless Date.

If PDUNCD = 'Y' and PDPDDJ Wk Bucketless Date < $$MSGD and $@F = '1' and Wk 
Quantity > 0

Write F3411 with MMMSGT('F'), MMUKID(Input UKID),MMDOCO(PDDOCO), 

MMDCTO(PDDCTO), MMLNID(PDLNID), MMKCOO(PDKCOO), MMTRQT(Wk Qty), MMVEND(PDAN8), 

MMSTRT(PDTRDJ), MMDSC1(Inp DSC1), MMITM(Inp Item), MMMCU(Wk Cache Branch), MMDRQJ(Wk Bucketless 

Date), MMHCLD('A').

Input UKID = Input UKID + 1

Output $$MRPD = '2'

Endif

If PDPDDJ Wk Bucketless Date < $$RGNJ and PDPDDJ Wk Bucketless Date < $$MSGD and 
$@T = '1' and Wk Quantity > 0

Write F3411 with MMMSGT('T'), MMUKID(Input UKID),MMDOCO(PDDOCO), 

MMDCTO(PDDCTO), MMLNID(PDLNID), MMKCOO(PDKCOO), MMTRQT(Wk Qty), MMVEND(PDAN8), 

MMSTRT(PDTRDJ), MMDSC1(Inp DSC2), MMITM(Inp Item), MMMCU(Wk Cache Branch), MMDRQJ(Wk Bucketless 

Date) MMHCLD('A').

Input UKID = Input UKID + 1

Output $$MRPD = '2'

Endif

Output PO flag = '1'.

EndWhile

  

Close all Tables

Close all Tables

Exit the function with Error Code = 0




Data Structure

D3400420 - MRP, Write Purchase Order Qty To Cache

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.

jdBeginDateEFFFJDEDATENONENONE

A date that indicates one of the following:     o When a component part goes into effect on a bill of material     o When a routing step goes into 
effect as a sequence on the routing for an item     o When a rate schedule is in effect The default is the current system date. You can enter 
future effective dates so that the system plans for upcoming changes. Items that are no longer effective in the future can still be recorded and 
recognized in Product Costing, Shop Floor Management, and Capacity Requirements Planning. The Material Requirements Planning system 
determines valid components by effectivity dates, not by the bill of material revision level. Some forms display data based on the effectivity 
dates you enter.

szDisplayUnitOfMeasureUOM1charNONENONE

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

cTransitFlagEV01charNONENONE

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

cInspectFlagEV02charNONENONE

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

cOther1FlagEV03charNONENONE

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. 

cOther2FlagEV04charNONENONE

PeopleSoft event point processing flag 04.

jdMessageDateDATE01JDEDATENONENONE

Event point for JDE Date.

jdRegenerationDateDATE02JDEDATENONENONE

Event point for JDE Date.

cFrozenOrderMsgFlagEV09charNONENONE

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

cPastDueOrderMsgFlagEV10charNONENONE

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

mnF3411UniqueKeyIDUKIDMATH_NUMERICNONENONE

This field is a unique number used to identify a record in a file.

cSuppressErrorMessagesEV07charNONENONE

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

cReceiptRoutingFlagEV08charNONENONE

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

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.

cPurchaseOrderFlagEV09charNONENONE

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

cMRPMessageFlagMRPDcharNONENONE

This code may be used as an additional field to select Item information to print on reports.  Once values are loaded into this field, The 
DREAM Writer may be set up to select these values. Valid values are:    blank Items NOT processed by the generation.    1       Items processed by 
the generation WITHOUT outstanding messages.    2       Items processed by the generation WITH outstanding messages.

szFrozenOrderDescDSC1charNONENONE

Brief information about an item; a remark or an explanation.

szPastDueOrderDescDSC2charNONENONE

A second, 30-character description, remark, or explanation.

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.

szStandardUOMConversionTFLAcharNONENONE

Allows you to bypass the item-specific unit of measure and use the standard unit of measure. Valid values are:    blank Use the item-specific 
unit of measure    1       Bypass the item-specific unit of measure and use the standard unit of measure

mnStandardPotencySTDPMATH_NUMERICNONENONE

The percentage of active ingredients normally found in an item.

cPotencyControlOT1YcharNONENONE

A code that indicates whether you control the item by potency.

szJobNumberJOBcharNONENONE

Job Number

jdLastDateEFFTJDEDATENONENONE

A date that indicates one of the following:     o When a component part is no longer in effect on a bill of material     o When a routing step is no 
longer in effect as a sequence on the routing for an item     o When a rate schedule is no longer active The default is December 31 of the 
default year defined in the Data Dictionary for Century Change Year. You can enter future effective dates so that the system plans for upcoming 
changes. Items that are no longer effective in the future can still be recorded and recognized in Product Costing, Shop Floor Management, 
and Capacity Requirements Planning. The Material Requirements Planning system determines valid components by effectivity dates, not by 
the bill of material revision level. Some forms display data based on the effectivity dates you enter.

jdForecastBeginningDateDATE04JDEDATENONENONE

Event point for JDE Date.

cForecastConsumptionFlagEV03charNONENONE

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. 

nNumberPastDuePeriodsINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

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.

cConsolidationMethodEV01charNONENONE

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

mnUniqueKeyIDOffsetMATH01MATH_NUMERICOPTNONE

- - - Good Performance Low Value. 

cSupplyDemandExistsEV01charOPTNONE

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

mnPurchasingEffectiveDaysPEFDMATH_NUMERICOPTNONE

The number of days after a purchased item isreceived that a lot becomes available. The system uses this number when calculating and 
displaying the effective date field in the Purchase Orders program (P4310) and the PO Receipts program (P4312).

cProjectPlanningEV01charOPTNONE

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

cProjectSpecificItemEV01charOPTNONE

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

mnSequenceNumberSEQNMATH_NUMERICOPTNONE

A number used to organize the table into a logical group for online viewing and reporting.

Related Functions

B3401270 Cache, Process MRP Bucketless Dates
B3401290 Cache, Process MRP Item Quantities
B3401300 Cache, Process MRP Inclusion Rules
B4000520 Get Item UoM Conversion Factor
B9800100 Get Audit Information

Related Tables

F3411 MPS/MRP/DRP Message File
F43092 Purchase Order Receipt Routing File
F4311 Purchase Order Detail File