F3111WritePartsListComparison

F3111 Write Parts List Comparison Cache

Minor Business Rule

Object Name: B3101210

Parent DLL: CMFGBASE

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This function will load Parts List Comparison data from F3111, F3112, and F30006 for the Parts  List 
Comparison application P31117.  It uses an internal cache to store the parts list comparison records 

for display in the grid in P31117. 



1.2Setup Notes and Prerequisites

The function must be called in Action Code 'L' first before subsequent records can be returned to the 
calling application. This will load the cache and return the first record in the cache.

To return subsequent records in the cache, Action Code must be set to 'R'.

When the application exits, an Action Code of 'T' must be sent in to terminate all cache resources.


1.3Special Logic

When Action Code is 'L' or 'R' and there are no more records that can be returned to the calling 
application, an Error Code of '1' will be returned.


2.Technical Specifications

2.4Processing 

/********** Setup Processing *********/

1.If Input Action Code <> 'L', 'R' or 'T'
2.Exit Function with Error Code '2' and Error Message '0001'

3.End If 

4.If Input Action Code = 'L'

5.Input Job Number = Random Number b/w 1 and 100

6.Initialize Cache Handle with 'PLComp' + Input Job Number

7.Counter = 0

8.While Initialize Was Successful and Action Code is 'L' And Counter < 100 then

9.Counter++

10.Input Job Number = Random Number b/w 1 and 100

11.Initialize Cache Handle with 'PLComp' + Input Job Number

12.End While

13.Set Up Cache Index and Initialize Cache with 'PLComp' + Input Job Number

14.Else

15.Initialize Cache Handle with 'PLComp' + Input Job Number

16.End If

17.***

18.If Cache Handle <> NULL

19.If Action Code = 'L'

20.Do Internal Function Load()

21.Do Internal Function ReturnRecord()

22.Else If Action Code = 'R'

23.Do Internal Function ReturnRecord()

24.Else If Action Code = 'T'

25.Call Cache Terminate.

26.End If

27.End If


Internal Function Load()

1.Open F3111 twice with 2 Request Handles.
2.Open F3112.

3.Open F30006.

4.SelectKeyed on F3111 with Input Order Number 1 with hRequest1(Order by DOCO, CPIT, CMCU)

5.SelectKeyed on F3111 with Input Order Number 2 with hRequest2(Order by DOCO, CPIT, CMCU)

6.Wk Order = 'B'

7.Wk Order1Failed = '0'

8.Wk Order2Failed = '0'

9.While Wk Order1Failed = '0' OR Wk Order2Failed = '0'

10.If Wk Order = 'B' Or '1'

11.Do Internal Function Load Order(&Wk Order1Failed, '1',    hRequest1, Part1, Input Order Qty 1)

12.End If

13.If Wk Order = 'B' Or '2'

14.Do Internal Function Load Order(&Wk Order2Failed, '2',    hRequest2, Part2, Input Order Qty 2)

15.End If

16.If Wk Order1Failed = '0' OR Wk Order2Failed = '0'

17.If Part1.WMCPIT = Part2.WMCPIT And Part1.WLMCU =    Part2.WLMCU And Part1.Qty = Part2.Qty And 

Part1.UOM =    Part2.UOM And Input Difference or All = 'D'

18.Wk Order = 'B'

19.Else

20.If Part1.WMCPIT = Part2.WMCPIT And Part1.WLMCU =       Part2.WLMCU And Part1.Qty <> Part2.Qty 

OR

21.Part1.WMCPIT = Part2.WMCPIT And Part1.WLMCU =    Part2.WLMCU And 

22.Part1.UOM <> Part2.UOM OR

23.Part1.WMCPIT = Part2.WMCPIT And Part1.WLMCU =    Part2.WLMCU And Input Difference or All = 'A'

24.Wk Order = 'B'

25.Do Internal Function Write Cache()

26.Else

27.If Part1.WMCPIT < Part2.WMCPIT OR

28.Part1.WMCPIT = Part2.WMCPIT And Part1.WLMCU <         Part2.WLMCU

29.Wk Order = '1'

30.Do Internal Function Write Cache()

31.Else

32.If Part1.WMCPIT > Part2.WMCPIT OR

33.Part1.WMCPIT = Part2.WMCPIT And Part1.WLMCU >    Part2.WLMCU

34.Wk Order = '2'

35.Do Internal Function Write Cache()

36.End If

37.End If

38.End If

39.End If

40.End If

41.End While

42.Close F3111 for each hRequest, Close F3112 and F30006.


Internal Function Load Order(*Wk Failed, cType, hRequestF3111, Part, OrderQty)

1.If *Wk Failed = '1' then
2. Exit Function

3.End If

4.Wk Done = '0'

5.Wk FetchF3111Failed = '0'

6.While Wk Done = '0'

7. Fetch F3111 using hRequestF3111.

8. If Failed

9. Part.WMCPIT = 99999999

10. Part.WLMCU = HiValue

11. Wk Done = '1'

12. Wk FetchF3111Failed = '1'

13. Else

14. Load F3111 columns to Part datastructure.

15. FetchKeyed to F3112 using WMDOCO And WMOPSQ

16. If Failed

17. Part.WLMCU = " "

18. End If

19. Wk Done = '1'

20. If Input Work Center <> " " And Part.WLMCU <> " "                         And Part.WLMCU 

<> Input Work Center

21. Wk Done = '0'

22. End If

23. If Input Dispatch Group <> " "

24. FetchKeyed from F30006 using Part.WLMCU

25. If Successful And Input Dispatch Group <>                IWMCUW then

26. Wk Done = '0'

27. End If

28. End If

29. End If

30.End While

31.If OrderQty <> 0 And Wk FetchF3111Failed = '0'

32. Part.Qty = Part.Qty / OrderQty

33.End If


Internal Function Write Cache(Part 1, Part 2, OrderFlag)

1.If Part1.WMCOBY = 'C' Or Part1.WMCOBY = 'B' Or Part1.WMCOBY = 'I' Or Part1.WMCPIT = 0 OR
2.Part2.WMCOBY = 'C' Or Part2.WMCOBY = 'B' Or Part2.WMCOBY = 'I' Or Part2.WMCPIT = 0

3. Exit Function

4.End If

5.If OrderFlag <> '2'

6. Cache.MCU = Part1.WLMCU

7. Cache.UITM = Primary Item Number of Part1.WMCPIT

8. Cache.DSC1 = Description 1 of Item Part1.WMCPIT

9.Else

10. Cache.MCU = Part2.WLMCU

11. Cache.UITM = Primary Item Number of Part2.WMCPIT

12. Cache.DSC1 = Description 1 of Item Part2.WMCPIT

13.End If

14.If OrderFlag <> '2'

15. Cache.UORG = Part1.Qty

16. Cache.UM = Part1.UOM

17.End If

18.If OrderFlag <> '1'

19. Cache.TRQT = Part2.Qty

20. Cache.UOM = Part2.UOM

21.End If

22.Add Record to Cache.


Internal Function ReturnRecord()

1.If Action Code = 'L' then
2. Open Cursor on Cache

3. If Failed

4. Return Error Code = '1'

5. Else

6. Store Cursor in Input hCursor

7. End If

8.End If

9.If Input hCursor <> 0

10. Retrieve Wk hCursor from Input hCursor

11. Cache Fetch

12. If Successful

13. Copy Cache Data to Output Parameters

14. Else

15. Return Error Code = '1'

16. Close cursor

17. Free Input hCursor Pointer

18. Input hCursor = 0

19. End If

20.Else

21. Return Error Code = '2'

22.End If


^

Data Structure

D3101210 - F3111 Write Parts List Comparison Cache

Parameter NameData ItemData TypeReq/OptI/O/Both
cActionCodeACTNcharNONENONE

A code that specifies the action that is performed. Valid values are: A Add C Change

nJobNumberIntegerINT01integerNONENONE

Number of Days in Future to Query for Responses Due. 

idCursorPtrGENLNGIDNONENONE

General purpose ID variable.

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

mnOrderQty1UORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

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

mnOrderQty2UORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

szWorkCenterMCUcharNONENONE

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.

szDispatchGroupMCUWcharNONENONE

A category code used to group work centers within an overall business unit. For example, you can use this code to group similar machines 
operating out of several work centers that report to one business unit.

cAllDifferencesDIFFcharNONENONE

Display All records or those that have Differences.

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.

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.

szWorkCenterOutputMCUcharNONENONE

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.

szPartDescriptionDSC1charNONENONE

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

mnQtyPerItem1UORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

mnQtyPerItem2UORGMATH_NUMERICNONENONE

The quantity of units affected by this transaction.

szUMItem1UMcharNONENONE

A user defined code (00/UM) that identifies the unit of measurement for an amount or quantity. For example, it can represent a barrel, box, 
cubic meter, liter, hour, and so on.

szUMItem2UMcharNONENONE

A user defined code (00/UM) that identifies the unit of measurement for an amount or quantity. For example, it can represent a barrel, box, 
cubic meter, liter, hour, and so on.

cUseCacheEV01charNONENONE

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

szPartNumberLongLITMcharNONENONE

A number that identifies the item. The system provides three separate item numbers plus an extensive cross-reference capability to 
alternative item numbers. The three types of item numbers are: Item Number (short) An 8-digit, computer-assigned item number. 2nd Item Number A 
25-digit, user defined, alphanumeric item number. 3rd Item Number  Another 25-digit, user defined, alphanumeric item number. In addition to 
these three basic item numbers, the system provides an extensive cross-reference search capability. You can define numerous 
cross-references to alternative part numbers. For example, you can define substitute item numbers, replacements, bar codes, customer numbers, or 
supplier numbers.

szPartNumberThirdAITMcharNONENONE

The system provides three separate item numbers plus an extensive cross-reference capability to alternate item numbers. These item 
numbers are as follows: 1.  Item Number (short) - An 8-digit, computer-assigned item number. 2.  2nd Item Number - The 25-digit, free-form, user 
defined alphanumeric item number. 3.  3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item number.  In addition to 
these three basic item numbers, an extensive cross-reference search capability has been provided (see XRT). Numerous cross references to 
alternate part numbers can be user defined, such as substitute item numbers, replacements, bar codes, customer numbers, or supplier 
numbers.

mnPartNumberShortITMMATH_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

szComputerIDCTIDcharNONENONE

Related Functions

None

Related Tables

F30006 Work Center Master File
F30UI008 Bill of Material Comparison Work File
F3111 Work Order Parts List
F3112 Work Order Routing