F3403UpdateBranchLevel

F3403, Update Branch Level

Minor Business Rule

Object Name: B3500100

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description
This function will update the branch levels for the lower level plants in the Branch Relationship 
table, given the branch level for the parent.


1.1Purpose
The purpose of this function is for P3403T to be able to automatically update the Branch Level field 
in F3403 when a new record/relationship is added.  This function emulates 'X34BRLV' on the AS400 

system.


1.2Setup Notes and Prerequisites


1.3Special Logic


2.Technical Specifications

Cache Datastructure for both caches are identical:
MMCU- Branch

BRLV- Level

Index caches by Branch.


1. Process Demand Branches according to the F3403 table:
2. Create 2 Caches: "3500100ALL" and "3500100UNP".

3. Open Table F3403

4. 

5. If Cache Creation Fails or Open Table fails 

6.  Exit Function with Error Code '3143'

7. End iF

8. 

9. cLoop = '1'

10. Add the Input MMCU and Input BRLV to the "3500100ALL" cache.

11. Add the Input CMCU and Input BRLV to the "3500100ALL" cache.

12. Wk CMCU = Input CMCU

13. While cLoop = '1'

14.  cLoop = '0'

15.  SelectKeyedPosition on F3403 using MPMMCU(=Wk CMCU)

16.  While cExit <> '1'

17.  FetchMatchingKey from F3403 using MPMMCU(=Input CMCU)

18.  If Fetch Failed

19.  Break

20.  End If

21.  Fetch from "3500100ALL" cache using MPCMCU as key.

22.  If Fetch Succeeded

23.  If Input BRLV >= Branch Level from Cache

24.  Branch Level from Cache = Input BRLV + 1

25.  Update the "3500100ALL" cache with current value of MMCU, and Branch 

Level.

26.  Fetch from "3500100UNP" cache using MPCMCU as key.

27.  If Fetch Succeeded then

28.  Branch Level from Cache = Input BRLV + 1

29.  Update the "3500100UNP" cache with current value of MMCU, and 

Branch Level.

30.  End If

31.  End If

32.  Else

33.  Branch Level Cache = Input BRLV + 1

34.  Branch Cache = MPCMCU.

35.  Add Record to "3500100ALL" Cache

36.  Add Record to "3500100UNP" Cache.

37.  End If

38.  If MPBRLV <= Input BRLV

39.  MPBRLV = Input BRLV + 1

40.  Update F3403

41.  Else

42.  cExit = '1'

43.  End If

44.  End While

45. 

46.  Fetch from "3500100UNP" Cache with 0 keys

47.  If Fetch Succeeded

48.  Wk CMCU = Cache Branch 

49.  Delete Record from "3500100UNP" Cache.

50.  cLoop = '1'

51.  End If

52. End While

53. 

54. Close table F3403.

55. Destroy both the caches if they were created.


^

Data Structure

D3500100 - F3403, Update Branch Level

Parameter NameData ItemData TypeReq/OptI/O/Both
szFromBranchMMCUcharNONENONE

A code that represents a high-level business unit. Use this code to refer to a branch or plant that might have departments or jobs, which 
represent lower-level business units, subordinate to it. For example:     o Branch/Plant (MMCU)     o Dept A (MCU)     o Dept B (MCU)     o Job 123 
(MCU) Business unit security is based on the higher-level business unit.

szToBranchCMCUcharNONENONE

A secondary or lower-level business unit. The system uses the value that you enter to indicate that a branch or plant contains several 
subordinate departments or jobs. For example, assume that the component branch is named MMCU. The structure of MMCU might be as follows:    
Branch/Plant - (MMCU)       Dept A - (MCU)       Dept B - (MCU)       Job 123 - (MCU)

mnBranchLevelBRLVMATH_NUMERICNONENONE

Determines the level at which a component branch should be processed in multi-plant processing. The lowest level branches (which are 
assigned a higher numerical value) are processed first, followed by the higher level branches (which are assigned a lower numerical 
value). NOTE: Assign branch levels carefully so that the planning system generates all demand before allocating supply.

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.

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

Related Functions

None

Related Tables

F3403 Branch Relationships Master File