F4141EditLine

Cycle Count Entry

Minor Business Rule

Object Name: N4101050

Parent DLL: COPBASE

Location: Client/Server

Language: NER

Functional Description

Purpose

This Function edits new lines entered at Cycle Count Entry time and performs edits for existing 
lines.


Setup Notes and Prerequisites

None.

Special Logic

None.

Technical Specification

Processes in update mode if the UpAddMode parameter is 1 otherwise it processes in add mode.

Add Mode

An error is set if the mode is Add and the Branch Plant is blank.


The item description, short item number, unit of conversion,  primary UOM, bulk packed flag, and 

inventory cost level are retrieved from F4101.  If the bulk packed flag is B error 4065 is set.


The pointer to the F4102 record, lot process type, GL category, serial number, grade, potency, and 

quantities are retrieved.  


If Serial Number Requested equals 4 error 4178 is set.  If Serial Number Requested equals 5 error 

4773 is set. 


If the lot number is blank and the lot process type is 1, 2, 3, 5, 6, or 7 error 2745 is set.


The location is formatted into file format.


Verifies the lot when lot is not blank.


Retrieves the item cost level.


Retrieves the primary location, lot, and quantities when the cost level is 3.


Retrieves the unit cost for the item.


Converts the quantity entered from the unit of measure specified to the primary unit of measure.


Verifies that the cycle count number is valid.


Verifies that the lot is not a duplicate.


Update Mode

Converts the quantity entered into the primary unit of measure for the item.

Verifies Warehouse batch selection or forces user selection through the location Detail Selection 

Window (P4605).


Related Tables 

Table Table Description
 F4101Item Master

F4102Item Branch

F4100Location Master

F4108Lot Master

F41021Item Location

F41002Item Unit of Measure

F4141Cycle Count Detail

F4142Warehouse Count Transactions


Related Business Functions

Source NameFunction Name
F4101 Get Item Master RowX4101

F4101Get Item Master InformationB40001040

F4102 Get Item Branch RowB4100210

F4102 Get Grade, Potency and QuantitiesB4100310

F4100 Format LocationB4000310

F4108 Verify Lot Not DuplicateX41DUP

Get Item Cost

Memory, Free Ptr To Data StructureB4000460

F41021 Get Item Location RowXF41021

Get Item Cost InformationXF4105

F41002 Get Item UoM ConversionB4000520

Memory Serial Number Qty CheckB4100970

F4141 Verify And Get Cycle Count RecordB4100660

F4141 Verify Duplicate Lots In Cycle CountB4100660

Memory, Verify Lot not Duplicated in Memory ListB4100410

Verify Location Detail Selection - FunctionN4600090


Processing 


//Process add or update mode based on incoming parameter


If cEV01UpAddMode not equal to 1 

//Add Mode

If GC Branch is = Blank

Or GC Branch Plant = NULL

If FC Branch Plant = Null

OR FC Branch Plant = "*"

Set on Error 0003

Else

GC Branch Plant = FC Branch Plant

EndIf

EndIf

EndIF

//Get Item description, short item number and unit of conversion

Call X4101(F4101 GetItem Master Row)


If SV Error Status is not equal to Success

ErrorStatus = 1

EndIf

If ErrorStatus not equal 1

//Get Primary UOM, Bulk Packed Flag, Inventory Cost Level 
Call B4001040(F4101 Get Item Master Information)
//For the item that the user has entered, ensure that it is not a bulk time.
If BulkPackFlag is equal to "B"

Set On Error "4065"

ErrorStatus = 1

EndIf

If Error Status is not equal to one

//Gets the row pointer, Lot Process Type, Gl Category, and Serial Number Required.

Call B4100210(F4102 Get Item Branch Row)

If GENLNGItemBranchRecord is not equal to 
And GENLNGItem BranchRecord is equal to 

Call B4100310(F4102 Get Grade, Potency and Quantities)

Call B4000460(Memory, Free Ptr To Data Structure)

EndIf
//

//If  Serial Number Required = 5, 6 => Memo Lot 1 and 2 are Required

//Warning Only

If ErrorStatus not equal 1

If Serial Number Requested is equal to "4"

Or Serial Number Requested is equal to 5

Set Error "4773"

If Serial Number Requested is equal to "5"

Set Error "4773"

EndIf

ErrorStatus = 1

EndIf

EndIf

//If the lot Number is blank and Lot Process Type is 1,2,3,5,6 and 7

//Highlight the lot number and set on error 2745

If ErrorStatus not equal 1

If LayerCSourceLotProcessTy is equal to 

If Lot is equal to < Blank>

Or Lot is equal to 

Set Error 2745

ErrorStatus = 1

EndIf

EndIf

EndIF

If ErrorStatus is not equal to "1"

//Format Location

Call B4000310(F4100 Format Location)

If Error Status is not equal to Success
ErrorStatus = 1

EndIf

EndIf

If ErrorStatus is not equal to "1"

If GC Lot is not equal to 

//Verify Lot and returns an error if not valid

Call X41DUP(F4108 Verify Lot Not Duplicate)

If ErrorCode not equal to 
ErrorStatus =1

EndIf

EndIf

EndIf

If ErrorStatus not equal to one

//Retieves and the item cost record ptr and returns an error.

Get Item Cost

EndIf

If SV Error Status is not equal to success

ErrorStatus =1

EndIf

If ErrorStatus not equal to 1

If CostLevel is equal to "3"

// Retrieve Primary Location and Lot for Cost

Call XF41021(F41021 Get Item Location Row)

Call XF41021(F41021 Get Item Location Quantities)
Call B4000460(Memory, Free Ptr To Data Structure)
Call XF4105(Get Item Cost)
EndIf
EndIf

//Use the pointer to get the unit cost

If ErrorStatus is not equal to 1

If GENLNG General Purpose Pointer is not equal to 

And GENLNG General Purpose Pointer is not equal to 

Call XF4105(Get Item Cost Information)

Call B4000460(Memory, Free Ptr To Data Structure)
EndIf
EndIf

//Since the unit cost for the Item Location Lot was not found in the F4105 get the

//Primary Location and lot for Item, and use this to get the unit cost for 

//Item in the F4105.  If this retrieval of unit cost using the primary location and lot

//results in an error, suppress it and take the unit cost as zero.

//Convert the quantity entered from  unit of measure specified to primary 

//unit of measure.

If ErrorStatus is not equal to 1

If Um is equal to 

Or Um is equal to 

UM = PrimUM

EndIf

EndIf

//Gets quantity to be converted to primary, and Quantity converted From to To

Call B4000520(F41002 Get Item UoM Conversion)

If SV ErrorStatus is not equal to Success
Error Status = 1

EndIf

If ErrorStatus is not equal to 1

If LotProcType is equal 

And Lot is not equal to 

And Lot is not equal to 

//Returns an Error code if not valid Serial number

Call B4100970(Memory, Serial Number Qty Check)

If SV ErrorStatus is not equal to Success
Set Error "4723"

ErrorStatus = 1

Else

CheckSerialQty = 1

EndIf

EndIf

EndIf

//Update the grid display with new UM and quantity

If Error Status not equal to "1"

BCGC CycleNumber = BCFC Cycle Count Number

//Checks if the Record is valid

Call B4100660(F4141 Verify And Get Cycle Count Record)

If ErrorCode(from BSFN) is equal to "1"
Set Error "2463"

ErrorStatus = 1

EndIf

EndIf

If ErrorStatus is not equal to "1"

Call XF41021(F41021 Get Item Location Row)

If SV Error Status is not equal to Success
Set Error "0678"

ErrorStatus = 1

EndIf

EndIf

If ErrorStatus is not equal to "1'"

Call XF4108(F4108 Verify Lot Not Duplicate)

If General Error Returned(from BSFN)
ErrorStatus = 1

EndIf

Endif

If ErrorStatus is not equal to 1

Call B4100660(F4141 Verify Duplicate Lots In Cycle Count)

If ErrorCode is equal to "1"
ErrorStatus = "1

EndIf

EndIf

If ErrorStatus is not equal to "1"

//B4100410 Pass it GCBC fields: It will verify if rec !exist in grid, //

//and add it to Linked List

If BCGC LineNumber is equal to 

BCFC LineId = BCFCLineId +1

BCGC LineNumber = BCFCLineId

EndIf

Call B4100410(Memory, Verify Lot not Duplicated in Memory List)

EndIf
//

//

Else

//

//

//Update Mode

//

//

//Convert qty from UOM entered to the Primary UOM for the given item.

If BCGC quantity is not equal to 

Call B400520(F41002 Get Item Uom Conversion)

Else
BCGC ConvertedQuantity = "0"

BCVA PrimaryQtyCounted = "0"

EndIf

// If Lot Processing Type = 5, 6, 7 or Lot Process Type = 4 and Lot Number is not Blank, 

//Validate the '1' qty integrity in the Cache

If BCGC Lot ProcType is equal to (4,5,6, 7)

And BCGCLot is not equal 

And BCGCLot is not equal 

Call B4100970(Memory,Serial Number Qty Check)

If SvErrorStatus is not equal to Success

Set Error "4723"

ErrorStatus = 1

Else

CherSerialQty = "1"

EndIf

EndIf

EndIf

//Verify Warehouse batch selection or force user selection through the location

//Detail Selection Window (P4605)

If ErrorStatus is not equal to one

BCVA TotalPrimaryQtyCnt = BCGC TotalQuantity + BCGC ConvertedQuantiy
Call N4600090(Verify Location Detail Selection  Function)

If BCVACheckSerialQty is equal to "1"
Call B4100410(Memory, Update Serial Number)

EndIf
EndIf

^

Data Structure

D4101050A - Cycle Count Entry(Edit Line)



^

Parameter NameData ItemData TypeReq/OptI/O/Both
szBranchPlantMCUcharNONENONE

From the row.  If blank, the header branch is  used.ab 

^

szFCBranchPlantMCUcharNONENONE

From the header.  Defaults into the row branch if it is left  blank.ab 

^

szItemNoUnknownFormatUITMcharNONENONE

Primary item  numberab 

^

cEV01UpAddModeEV01charNONENONE

'1' =  Updateab 

^

szDescriptionDESCcharNONENONE

Description of the  itemab 

^

mnIdentifierShortItemITMMATH_NUMERICNONENONE

Short item number  ab 

^

szTFLAStandardUOMConversionTFLAcharNONENONE

Used to calculate unit of measure conversions.  If blank, uses item specific conversions.  If a '1', bypasses item specific  conversions.ab 

^

szIdentifier2ndItemLITMcharNONENONE


^

szIdentifier3rdItemAITMcharNONENONE


^

szUOMPrimaryUOMUOMcharNONENONE

Primary unit of measure for  itemab 

^

cCLEVInventoryCostLevelCLEVcharNONENONE

Cost level of  itemab 

^

cSRCELayerCSourceLotProcessTySRCEcharNONENONE

Lot processing type for item (From  Item/Branch)ab 

^

szGLPTGlCategoryClassCodeGLPTcharNONENONE

G/L class code for item (From  Item/Branch)ab 

^

szLOTNLotLOTNcharNONENONE

Lot number  enteredab 

^

szLOCNE1LocationE1LOCNE1charNONENONE

Display  locationab 

^

szLOCNFileFormatLocationLOCNcharNONENONE

File format  locationab 

^

mnUNCSAmountUnitCostUNCSMATH_NUMERICNONENONE

Cost  enteredab 

^

szUOMUnitOfMeasureAsInputUOMcharNONENONE

Defaults to primary UOM if  blankab 

^

mnCNTConvertedQuantityCNTMATH_NUMERICNONENONE

Quantity converted to  primaryab 

^

cBUMCUomByBranchBUMCcharNONENONE

Flag indicating whether UOM conversions are branch  specificab 

^

mnTotalPriQtyCountedCNTMATH_NUMERICNONENONE

Total primary quantity counted for the  rowab 

^

mnQuantityInputTRQTMATH_NUMERICNONENONE

A value that represents the available quantity, which might consist of the on-hand balance minus commitments, reservations, and 
backorders. You enter this value in the Branch/Plant Constants program (P41001).

mnCYNOCycleCountNumberCYNOMATH_NUMERICNONENONE

Cycle count number for the  rowab 

^

cULOTAllowDuplicateLotsULOTcharNONENONE

Flag indicating whether duplicate lots are  allowedab 

^

mnLNIDGCLineNumberLNIDMATH_NUMERICNONENONE

Row line number.  Incremented by 1 if left  blank.ab 

^

mnLNIDFCLineNumber_2LNIDMATH_NUMERICNONENONE

Last line number used.  Increments as rows are  added.ab 

^

mnJOBSJobnumberAJOBSMATH_NUMERICNONENONE

Used in WMS(Warehouse Management System)   processing.ab 

^

szCTIDComputerIDCTIDcharNONENONE

Used in WMS  processing.ab 

^

mnMATH01WMSLineNumberMATH01MATH_NUMERICNONENONE

Used in WMS  processing.ab 

^

mnCYNOFCCycleCountNumber_2CYNOMATH_NUMERICOPTNONE

The cycle count number at the header level.  If the row level is left blank, will default into the row cycle count  number.ab 

^

idGENLNGDupLotCacheGENLNGIDNONENONE

Used in validating if duplicate lots have been entered for this series of transactions being  processed.ab 

^

cMismatchQtyFlagEV02charNONENONE

Used in WMS to see if the location detail quantities add up to the  total.ab 

^

cInitalProcessesEV02charNONENONE

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

cErrorsExistEV01charNONENONE

Used in batch inbound  processingab 

^

szTransactionActionTNACcharNONENONE

Used in batch inbound  processingab 

^

szProgramIdPIDcharNONENONE

Used in batch inbound  processingab 

^

szDescriptionLine1DSC1charNONENONE

Used in batch inbound  processingab 

^

szSalesReportingCode1SRP1charOPTNONE

One of ten category codes for sales coding purposes. These codes can represent such classifications as color, material content, or use.

szSalesReportingCode2SRP2charOPTNONE

One of ten category codes for sales coding purposes. These codes can represent such classifications as color, material content, or 
use. This field represents one of ten property type categories available for sales purposes.

szSalesReportingCode3SRP3charOPTNONE

One of ten category codes for sales coding purposes. These codes can represent such classifications as color, material content, or use.

szSalesReportingCode4SRP4charOPTNONE

One of ten category codes to be used for sales coding purposes. These codes can represent such classifications as color, material 
content, or use.

szSalesReportingCode5SRP5charOPTNONE

One of ten category codes to be used for sales coding purposes.  These codes can represent such classifications as color, material 
content, or use.

mnSecondaryQtyAsInput_SQORSQORMATH_NUMERICOPTNONE

If the secondary unit of measure option in Inventory Constants is selected,this field will display on data entry screens.

szSecondaryUoMAsInput_UOM2UOM2charOPTNONE

A user defined code (00/UM) that indicates an alternate unit of measure for the item.

mnSecondaryQtyConverted_SQORSQORMATH_NUMERICOPTNONE

If the secondary unit of measure option in Inventory Constants is selected,this field will display on data entry screens.

szSecondaryUnitOfMeasure_UOM2UOM2charOPTNONE

A user defined code (00/UM) that indicates an alternate unit of measure for the item.

Related Functions

None

Related Tables

None
F4141EndDoc

F4141EndDoc

Cycle Count Entry

Minor Business Rule

Object Name: N4101050

Parent DLL: COPBASE

Location: Client/Server

Language: NER

Functional Description
Purpose

To Update Related tables to Cycle Count Entry.

Setup Notes and Prerequisites

None


Special Logic

None

Technical Specifications

Retrieves the cost for the item being processed, multiplies it by the quantity on hand for the location and writes a record to the Cycle Count Transaction 

Table (F4141).


Related Tables 

Table Table Description
F4140Cycle Count Header

F4142Warehouse Count

F4141Cycle Count Detail


Related Business Functions

Source NameFunction Name
F4140UpdateCycleCountHeaderStatusB4100650

F4142 Update/Write To Warehouse Count From CacheN4600100

F4141 Write Cycle Count DetailB4100660

WMS Cache Update ChangedN4600110

F4142 Clear/Delete Warehouse Count TransactionN4600100 


Processing 

//Update the cycle count header status to '30' if not '30', '50', '60' or '99'
Call B4100650(F4140 Update Cycle Count Header Status)

//Update/Add to database
Call B4100660(F4141 Write Cycle Count Detail) 

Call N4600110(WMS Cache Update Changed)
Call N4600100(F4142 Clear Delete Warehouse Count Transaction


^

Data Structure

D4101050B - CycleCountEntry(End Doc)

Parameters:
Data Item Data Structure DescriptionI/ORequired

CYNOCYNOCycleCountNumberIY

CYCSCYCSCycleStatusIY

ITMITMIdentifierShortItemIY

MCUMCUBranchPlantIY

LOCNLOCNLocationIY

LOTNLotNumberI/OY

CLEVCLEVCostLevelI/OY

LITMIdentifier2ndItemI/0N

AITMIdentifier3rdItemIN

SRP1SRP1SalesCode1IN

SRP2SRP2SalesCode2IN

SRP3SRP3SalesCode3IN

SRP4SRP4SalesCode4IN

SRP5SRP5SalesCode5IN

EV01EV01UpdateQtyFlag

PIDPIDProgramIdIY

CNTBCNTBCountedByIY

CNTJCNTJDateCountedIY

CCCDCCCDCycleCountNumberIY

TACTTACTTotalPriQtyCountedIY

EV01EV01VoidGetItemCostIY

UNCSUNCSUnitCostIY

CYNOCYNOCycleCountNumberIY

TGGTGGTagNumberIY

JOBSJOBSJobNumberIY

CTIDCTIDComputerIDIY

Math01MATH01WMSLineNumberIY

EV04ChangeFlagI/OY

TACTTACTTotalPrimAmtCountedIY

CNTCNTConvertedQuantityIY

GLPTGLPTGlCategoryIY

EDUSEDI User IdIN

EDBTEDI Batch numberIN

EDTNEDI Transaction numberIN

EDLNEDI Line numberIN

TNACAction CodeIN


^

Parameter NameData ItemData TypeReq/OptI/O/Both
mnCYNOCycleCountNumberCYNOMATH_NUMERICNONENONE

Used in the Update Cycle Count Header  Statusab 

^

szCYCSCycleStatusCYCScharNONENONE

Used in the Update Cycle Count Header  Statusab 

^

mnITMIdentifierShortItemITMMATH_NUMERICNONENONE

Used in Write Cycle Count  Detailab 

^

szMCUBranchPlantMCUcharNONENONE

Used in Write Cycle Count  Detailab 

^

szLOCNLocationLOCNcharNONENONE

Used in Write Cycle Count  Detailab 

^

szLULotNumberLUcharNONENONE

Used in Write Cycle Count  Detailab 

^

cCLEVCostLevelCLEVcharNONENONE

Used in Write Cycle Count  Detailab 

^

szIdentifier2ndItemLITMcharNONENONE

Used in Write Cycle Count  Detailab 

^

szIdentifier3rdItemAITMcharNONENONE

Used in Write Cycle Count  Detailab 

^

szSRP1SalesCode1SRP1charNONENONE

Used in Write Cycle Count  Detailab 

^

szSRP2SalesCode2SRP2charNONENONE

Used in Write Cycle Count  Detailab 

^

szSRP3SalesCode3SRP3charNONENONE

Used in Write Cycle Count  Detailab 

^

szSRP4SalesCode4SRP4charNONENONE

Used in Write Cycle Count  Detailab 

^

szSRP5SalesCode5SRP5charNONENONE

Used in Write Cycle Count  Detailab 

^

cEV01UpdateQtyFlag_2EV01charNONENONE

'1' = Update Total Amount only 
'2' = Update TotalQtyCounted only 

'3' = Update Both Qty's 

'4' = Update TotalQtyCounted and Total Amount  ab 


^

szPIDProgramIdPIDcharNONENONE

Used in Write Cycle Count  Detailab 

^

szCNTBCountedByCNTBcharNONENONE

Used in Write Cycle Count  Detailab 

^

jdCNTJDateCountedCNTJJDEDATENONENONE

Used in Write Cycle Count  Detailab 

^

cCCCDCycleCountCodeCCCDcharNONENONE

Used in Write Cycle Count  Detailab 

^

mnTACTTotalPriQtyCountedTACTMATH_NUMERICNONENONE

WMS Cache Update  Changedab 

^

cEV01VoidGetItemCostEV01charNONENONE

'1' = Do not get Unit Cost from Item Cost Table  (F4105)ab 

^

mnUNCSUnitCostUNCSMATH_NUMERICNONENONE

Used in Write Cycle Count  Detailab 

^

mnTGGTagNumberTGGMATH_NUMERICNONENONE

A number that the system assigns to the tag using the Print Tag program, based on the next available tag number.

mnJOBSJobnumberJOBSMATH_NUMERICNONENONE

WMS Cache Update  Changedab 

^

szCTIDComputerIDCTIDcharNONENONE

WMS Cache Update  Changedab 

^

mnMATH01WMSLineNumberMATH01MATH_NUMERICNONENONE

WMS Cache Update  Changedab 

^

cEV04ChangeFlagEV04charNONENONE

Used in WMS  processingab 

^

mnTACTTotalPrimAmtCountedTACTMATH_NUMERICNONENONE

The total quantity in primary units which has been counted for a specific cycle count category during a single count cycle.  This physical 
count will be compared with the total expected on hand for all items belonging to this cycle count category to produce a variance.

mnCNTConvertedQuantityCNTMATH_NUMERICNONENONE

Quantity converted to  primaryab 

^

szGLPTGlCategoryGLPTcharNONENONE

Used to Write Cycle Count  Detailab 

^

szEdiUserIdEDUScharNONENONE

Used in batch inbound  processingab 

^

szEdiBatchNumberEDBTcharNONENONE

Used in batch inbound  processingab 

^

szEdiTransactNumberEDTNcharNONENONE

Used in batch inbound  processingab 

^

mnEdiLineNumberEDLNMATH_NUMERICNONENONE

Used in batch inbound  processingab 

^

szTransactionActionTNACcharNONENONE

Used in batch inbound  processingab 

^

mnTotalSecondaryQtyCountedSQOHMATH_NUMERICOPTNONE

The number of units on hand in secondary units of measure.

Related Functions

None

Related Tables

None
F4141PostEndDoc

F4141PostEndDoc

Cycle Count Entry

Minor Business Rule

Object Name: N4101050

Parent DLL: COPBASE

Location: Client/Server

Language: NER

Functional Description
Purpose
This function destroys the cache used in processing duplicate lots and updates the F4142 for Warehouse Management processing.

Setup Notes and Prerequisites

None


Special Logic

None

Technical Specification

Destroys the cache using  B4100410(Memory, Verify Lot not Duplicated) which also checks to see if the lot number being entered already exists for 
another line in the transaction.  If so, an error will be issued. 


Updates F4142 for Warehouse Management using N4600100(F4142 Update/Write to Warehouse Count from Cache) which processes all records in the 

cache for this Cycle/Tag and updates/writes F4142 - Warehouse Count Transaction.


Related Tables 

Table Table Description
F4142Warehouse Count


Related Business Functions

Source NameFunction Name
Memory, Verify Lot not DuplicatedB4100410

F4142 Update/Write To Warehouse Count From CacheN4600100


Processing 

//Destroy cache
Call B4100410(Memory, Verify Lot not Duplicated)

//Update F4142 for WMS
Call N4600100(F4142 Update/Write to Warehouse Count from Cache)



^

Data Structure

D4101050C - Cycle Count Entry (Post End Doc)

Parameters:
Data Item Data Structure DescriptionI/ORequired

PIDProgram IY

CYNOCycle Count NumberIY

JOBSJob NumberIY

CTIDComputer IdIY

GENLNGDupLotPointerIY

ULOTAllow Duplicate LotsIY

EV02Initial ProcessesIY


^

Parameter NameData ItemData TypeReq/OptI/O/Both
szProgramIdPIDcharNONENONE

Used to update  tablesab 

^

mnCycleCountNumberCYNOMATH_NUMERICNONENONE

Used to  updateab 

^

mnJobnumberAJOBSMATH_NUMERICNONENONE

Used in updates for  WMSab 

^

szComputerIDCTIDcharNONENONE

Used in updates for  WMSab 

^

idGenLngLotNotDuplicatedGENLNGIDNONENONE

Used to clear the  cacheab 

^

cUniqueLotsULOTcharNONENONE

Used to clear the  cacheab 

^

cInitialProcessesEV02charNONENONE

Will be cleared at end of  processingab 

^

Related Functions

None

Related Tables

None