CacheProcessMRPWorkOrders

Cache, Process MRP Work Orders

Minor Business Rule

Object Name: B3401310

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This function will perform Get, Add, Update, Delete, Delete All, Get Next, Add/Update, and Terminate 
functions on the MRP Work Order Cache used in the MRP/MPS planning programs (P3482 and P3483).


The calling application is responsible for loading all appropriate key values to the data structure 

and identifying the number of keys to use in retrieval/update processes.


1.2 Setup Notes and Prerequisites

• Cache Action Code
• '1' Get - retrieve the cache element.
• '2' Add - add a cache element.
• '3' Update - update a cache element.
• '4' Delete - delete a cache element.
• '5' Delete All - delete all cache elements
• '6' Get Next - retrieve the next cache element
• '7' Add/Update - will add if element does not exist, will change if it does exist.
• '8' Terminate - terminate cache
• '9' Close cursor and free ptr.
• 'N' Get Nearest - Retrieve the cache element matching the input Item, Branch and Date.  If the 
element does not exist, retrieve the element with the date immediately before or after based on the 

input Comparison Flag.

• 'D' Debug Mode - Dumps the contents of the entire cache into a text file

• Number of Keys 
• If the number of keys is passed as a parameter, the business function uses this value to setup 
key values for a Get, Update, Delete, Get Next, and Add/Update.

• A zero may be passed to retrieve, update, or delete the first record.

• When action code GET is used, the function saves the cache cursor pointer if the fetch is successful 
and SequentialFetch = '1'.  This allows the calling application to use GET NEXT to fetch elements 

from the cache sequentially.  If GET NEXT is called until the end of the keyed cache dataset is found, 

the function automatically closes the open cursor.


1.3Special Logic

This function creates a unique cache for each MRP/MPS planning process.  The function appends the 
input Job Number string to the two character ID 'WO' to build the cache name used for the calling 

application.


2.Technical Specifications
Cache Layout:Cache includes all of the following fields; key fields are noted.

Data Item Data Structure DescriptionKey Field

ITMShort Item NumberY

MMCUBranchY

DRQJRequested DateY

DOCOOrder Number

DCTOOrder Type

SRSTStatus

STRTStart Date

UORGOpen Quantity

MATH01Work Order Quantity

TBMType Of Bill

EV01Expedite Flag



I.Perform setup functions 

A.Initialize cache to get handle.  Cache name = "WO" + input Job Number
B.If not successful, set error "032E", set Cache Error Code = '3', and return failure.

C.Set Cache Error Code = '0'

D.Set return code to success.


II.Processing Based on Mode.


A.If Cache Action Code is '1' - GET:
1.Open cursor.
2.Retrieve the first element on the cache matching the key values passed as input.  If the 

input Number of Keys is zero, fetch the first element in the cache.

3.Load the values from the retrieved element into the data structure to be passed back to 

the calling program.

4.If SequentialFetch is '1', return the cursor pointer to the calling application.  

Otherwise, close the cursor.

5.If get fails set Cache Error Code = '6'.


B.If Cache Action Code is '2' - ADD:
1.Insert a new cache element with values from data structure.
2.If add fails set error "032E", set Cache Error Code = '4', and return failure.


C.If Cache Action Code is '3' - UPDATE:
1.Update existing cache element with values from data structure.
2.If update fails set error "032E", set Cache Error Code = '4', and return failure.


D.If Cache Action Code is '4' - DELETE:
1.If the Number of Keys is not 0, delete all elements in the cache matching the key values 
passed as input.

2.If the number of keys is 0, delete the first cache element.

3.If delete fails, set Cache Error Code = '5'.


E.If Cache Action Code is '5' - DELETE ALL:

1.Delete all elements in the cache.
2.If delete fails, set Cache Error Code = '5'.


F.If Cache Action Code is '6' - GET NEXT:
1.Retrieve the next element in the cache matching the key values passed as input.  The 
cursor pointer must be provided by a previous "Get" action, i.e. Cache Action Code '1'.  If the 

Number of Keys is zero then fetch the next record without using any key.

2.Load the values from the retrieved element into the data structure to be passed back to 

the calling program.

3.If there are no more elements, close the cursor, remove the cursor pointer from the BsFn 

data structure, and set Cache Error Code = '1'.


G.If Cache Action Code is '7' - ADD/UPDATE:

1.Delete Record , if one exists,  that matches the full key from Input.
2.Insert a new cache element with values from data structure.

3.If add fails set error "032E", set Cache Error Code = '4', and return failure.


H.If Cache Action Code is '8' - END
1.Perform cleanup functions (Terminate cache).

I.If Cache Action Code is 'N' - GET NEAREST:
1.Open cursor.
2.Retrieve the first element in the cache matching the key values passed as input.  The 

input Number of Keys must be 3. (ITM, MCU, DRQJ)

3.If successful, load the values from the retrieved element into the data structure to be 

passed back to the calling program and return success.

4.If not successful, Reset cursor.

5.Using just the input Item and Branch as the key, search for the cache element with the 

desired date based on the input Direction Flag:

'B' = retrieve the cache element occurring just before the input Date
'A' = retrieve the cache element occurring just after the input Date

6.Load the values from the retrieved element into the data structure to be passed back to 
the calling program.  Close the cursor.

7.If get fails set Cache Error Code = '6'.


J.If Cache Action Code is '9' - CLOSE:
1.Retrieve cursor from ptr.
2.Close Cursor

3.Free Ptr

4.Set Cache Cursor Ptr = 0


K.If Cache Action Code is 'D' - DUMP:
1.Dump the contents of this cache into a text file


^

Data Structure

D3401310 - Cache, Process MRP Work Orders


Data Item Data Structure DescriptionI/ORequiredNotes

JOB            Job Number                        IY      Job Number as string for 

cache name

ITM            Short Item Number                  I/OY      key value

MMCU            Branch                        I/OY      key value

DRQJ            Requested Date                  I/OY      key value

DOCO            Order Number                  I/OY

DCTO            Order Type                        I/OY

SRST            Status                        I/OY

STRT            Start Date                        I/OY

UORG            Open Quantity                  I/OY      converted to primary UOM

MATH01      Work Order Quantity            I/OY      WAUORG

TBM            Type Of Bill                  I/OY

EV01            Expedite Flag                  I/OY      '1' - WO has already been 

expedited


EV02            Cache Action Code                  IY      '1' = Get cache element 

                                                                        '2' = Add element  

                                                                        '3' = Update element 

                                                                        '4' = Delete cache elements 

                                                                        '5' = Delete All cache 

elements 

                                                                        '6' = Get Next cache element 

                                                                        '7'  = Add/Update cache 

element 

                                                                        '8' = End cache (terminate 

cache) 

                                                                        '9' = Close Cursor and Free 

Ptr 

                                                                        'N' = Get Nearest 

                                                                        'D' = Dump cache into text 

file

EV01            Cache Error Code                  ON      '0' = Success Process 

                                                                        '1' = Reached End of 

Cache(mode 6)                                                                         

                                                                        '2' = Invalid Input Parameter 


                                                                        '3' = Failed to Create Cache 

                                                                        '4' = Failed to Add/Update 

Cache 

                                                                        '5' = Failed to Delete Cache 

                                                                        '6' = Fetch Failed(mode 1 or 

9)

EV01            Comparison Flag                  I      Only used for action code 

'9': 

                                                                        'B' = get cache element 

w/Date <= 

                                                                              input date 

                                                                        'A' = get cache element 

w/Date >= 

                                                                              input date

INT01            Number of Keys                      IY      Number of Keys to be used in 

the 

                                                                        cache process.

SUPPS            Suppress Error Message              IN      '0'= allow runtime error 

message 

                                                                             handling. 

                                                                        '1'= Suppress runtime error 

message 

                                                                             handling.

DTAI            Error Message Id                  ON      " " = Success 

                                                                        "032E" = Error Processing 

Cache

GENLNG         Cache Cursor Ptr                  I/ON

EV02            Sequential Fetch                  I/ON      If action is GET and this 

parm is 

                                                                        '1', function will pass back 

cursor 

                                                                        pointer for GET NEXT 

operation.

^

Parameter NameData ItemData TypeReq/OptI/O/Both
szJobNumberJOBcharNONENONE

Job Number

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.

jdDateDRQJJDEDATENONENONE

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

mnOrderNumberDOCOMATH_NUMERICNONENONE

A number that identifies an original document. This document can be a voucher, a sales order, an invoice, unapplied cash, a journal entry, 
and so on.

szOrderTypeDCTOcharNONENONE

A user defined code (00/DT) that identifies the type of document. This code also indicates the origin of the transaction. J.D. Edwards has 
reserved document type codes for vouchers, invoices, receipts, and time sheets, which create automatic offset entries during the post 
program. (These entries are not self-balancing when you originally enter them.) The following document types are defined by J.D. Edwards and 
should not be changed: P Accounts Payable documents   R Accounts Receivable documents   T Payroll documents   I Inventory documents  
O Purchase Order Processing documents   J General Accounting/Joint Interest Billing documents   S Sales Order Processing documents

szStatusSRSTcharNONENONE

A user defined code (00/SS) that describes the status of a work order, rate schedule, or engineering change order. Any status change from 
90 through 99  triggers the system to automatically update the completion date.

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.

mnOpenQuantityUORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

mnWorkOrderQuantityUORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

szTypeOfBillTBMcharNONENONE

A user defined code (40/TB) that designates the type of bill of material. You can define different types of bills of material for different uses. 
For example:    M     Standard manufacturing bill    RWK   Rework bill    SPR   Spare parts bill  The system enters bill type M in the work order 
header when you create a work order, unless you specify another bill type. The system reads the bill type code on the work order header to 
know which bill of material to use to create the work order parts list. MRP uses the bill type code to identify the bill of material to use when it 
attaches MRP messages. Batch bills of material must be type M for shop floor management, product costing, and MRP processing.

cExpediteFlagEV01charNONENONE

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

idCacheCursorPtrGENLNGIDNONENONE

General purpose ID variable.

cSequentialFetchEV02charNONENONE

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

cCacheActionCodeEV02charNONENONE

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

cCacheErrorCodeEV01charNONENONE

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

nNumberOfKeysINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

cSuppressErrorMessageSUPPScharNONENONE

A flag indicating whether or not runtime error messaging will occur when an error message is issued from a business function.        0 = allow 
runtime error message handling.        1 = suppress runtime error message handling.

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.

cComparisonFlagEV01charNONENONE

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

jdDateSaveDRQJJDEDATEOPTNONE

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

cDeferFlagEV01charOPTNONE

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

nIndexNumberINT02integerOPTNONE

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

jdDateRecommendedStartRSTJJDEDATEOPTNONE

The recommended start date for an order.

jdRecommendedDeliveryDateREDJJDEDATEOPTNONE

The date that the system produces when you respond to an MRP message that contains a recommended date.

jdDateRequestedSaveDRQJJDEDATEOPTNONE

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

jdOriginalEffectiveDateSavedOEDJJDEDATEOPTNONE

A purchase item's original effective date for a lot controlled item. MRP messages use this field to alert users to review the MRP time series 
and modify order time frames.

Related Functions

None

Related Tables

None