InsertItemMasterRow

Insert Item Master Row

Major Business Rule

Object Name: B4100290

Parent DLL: COPBASE

Location: Client/Server

Language: C

Functional Description

Purpose

This function adds or changes records in the Item Master Table (F4101).  


Setup Notes and Prerequisites

The Second Item Number (LITM) and Description (DSC1) are required parameters, as well as the Action 

Code.  


Action Code:

Add = 'A' or '1'

Change= 'C' or '2'


Special Logic:

None


Technical Specification


This function adds or changes records in the item Master Table (F4101) based on the key passed in.  

If in Add mode and the Short Item Number is zero or null, the business function F4101 Get Item Number 

From Next Number is called to retrieve the next number.  If the Short Item Number passed in is not 

zero, it is validated against the Item Master table to ensure it is unique.  


The business function Assign Item Master Defaults (X4101DEF) is called to assign default data 

dictionary values for the addition of a record.  


If the unit of meausure is blank, 'EA' is used.


For a Change action code, if the field in the data structure contains an '*', the database value will 

not change.  If the value is something other than '*', the database record will be updated with the 

new value.


Related Tables 

Table Table Description

F4101Item Master



Related Business Functions

Source NameFunction Name

X4101DEFAssignItemMasterDefaults

ITMMSTRF4101GetItemNumberFromNextNumber

B0100009CompressCharacterString



Processing 


If ActionCode is not equal to '1', 'A', '2', or 'C'

Set error code to 0001

End


If ActionCode is not equal to '1' or 'A'

If the ShortItemNumber is zero or null in the data structure then 

Use the business function F4101GetItemNumberFromNextNumber.  
else
If the ShortItemNumber is NOT zero then
Test for the existance of the short item in the Item Master table (F4101)
If the short item exists then set error code 0001

End


Clear the columns of the row about to be written

Call AssignItemMasterDefaults to assign default values to the columns contained in the 

AssignItemMasterDefaults data structure


Test whether UOM1 is blank.  If still blank assign 'EA' to UOM1


Test each of the fields : UOM2, UOM3, UOM4, UOM6, UOM8, UOM9  for blanks and assign UOM1 

to them if blank.


If the  LITM and AITM are blank, then set error code "0159"  and exit.


Call CompressCharacterString (B0100009) with SRTX going in , returning the ALN field to be 

updated 

Pass in the LanguageType passed in.


End


If ActionCode = '2' or 'C'


If the ShortItemNumber is NOT zero then
Test for the existance of the short item in the Item Master table (F4101)

If the short item does not exist then set error code 0001 and exit.


Assign blanks to the data structure items that contain a '*'.  This should only be done for the 

items stated in the data structure definition.  If any of those items are blank, then the 

current value in the F4101 record should not change.


Perform data dictionary edits for the fields being updated.  If the value is not an allowed 

value set error code "0025".  If the data item is validated against a UDC table and the value does 

not exist set error code "0027".  Do not retrieve the defaults if a value is not sent in.


End


If any errors are found assign a '1' to ErrorsFound.  Otherwise send back a blank.


Update PID, USER, JOBN, UPMJ, TDAY


If ActionCode is equal to '1' or 'A'

Insert the row into the F4101 table.

End


If ActionCode is equal to '2' or 'C'

Update F4101 row in table.

End



Data Structure

D4100290 - Insert Item Master Row

Parameters:
Data Item Data Structure DescriptionI/ORequired
ITMShortItemNumberINo

LITMSecondItemNumberIY

AITMThirdItemNumberIY

DSC1ItemDescription1IY

DSC2ItemDescription2IY

UOM1PrimaryUnitOfMeasureI

STKTStockingTypeI

LNTYLineTypeI

GLPTGLClassCodeI

EV01SuppressErrorMessagesI

DTAIErrorMessageIDO

PIDProgram IdI

ACTNAction CodeIY

SRP1Sales Catalog SectionI

SRP2Sub SectionI

SRP3Sales Category Code 3I

SRP4Sales Category Code 4I

SRP5Sales Category Code 5I

PRP1Commodity ClassI

PRP2Sub ClassI

PRP3Vendor Rebate CodeI

PRP4Master Panning FamilyI

PRP5Purchasing Category Code 5I

BUYRBuyer NumberI

LTLVLeadtime LevelI

ANPLPlanner NumberI

OPCOrder Policy CodeI

ITCIssue Type CodeI

EV01Error FoundOY

Ev02LanguageTypeIY


^

Parameter NameData ItemData TypeReq/OptI/O/Both
mnShortItemNumberITMMATH_NUMERICNONENONE

If Zero/Null then the Next Numbers routine is used to assign a next item number.
^

szSecondItemNumberLITMcharNONENONE

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.

szThirdItemNumberAITMcharNONENONE

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.

szItemDescription1DSC1charNONENONE

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

szItemDescription2DSC2charNONENONE

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

szPrimaryUnitOfMeasureUOM1charNONENONE

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

cStockingTypeSTKTcharNONENONE

A user defined code (41/I) that indicates how you stock an item, for example, as finished goods or as raw materials. The following stocking 
types are hard-coded and you should not change them:    0   Phantom item    B Bulk floor stock    C Configured item    E Emergency/corrective 
maintenance    F Feature    K Kit parent item    N Nonstock  The first character of Description 2 in the user defined code table indicates if the item 
is purchased (P) or manufactured (M).

szLineTypeLNTYcharNONENONE

A code that controls how the system processes lines on a transaction. It controls the systems with which the transaction interfaces, such as 
General Ledger, Job Cost, Accounts Payable, Accounts Receivable, and Inventory Management. It also specifies the conditions under 
which a line prints on reports, and it is included in calculations. Codes include the following: S Stock item   J Job cost   N Nonstock item   F Freight  
T Text information   M Miscellaneous charges and credits   W Work order

szGLClassCodeGLPTcharNONENONE

A user defined code (41/9) that identifies the G/L offset that system uses when it searches for the account to which it posts the transaction. If 
you do not want to specify a class code, you can enter **** (four asterisks) in this field. You can use automatic accounting instructions (AAIs) to 
predefine classes of automatic offset accounts for the Inventory Management, Procurement, and Sales Order Management systems. You 
might assign G/L class codes as follows:    IN20   Direct Ship Orders    IN60   Transfer Orders    IN80   Stock Sales  The system can generate 
accounting entries based upon a single transaction. For example, a single sale of a stock item can trigger the generation of accounting entries 
similar to the following:         Sales-Stock (Debit) xxxxx.xx     A/R Stock Sales (Credit) xxxxx.xx     Posting Category: IN80             Stock Inventory 
(Debit) xxxxx.xx     Stock COGS (Credit) xxxxx.xx The system uses the class code and the document type to find the AAI.

cSuppressErrorMessagesEV01charNONENONE

1- No GBR Error message set in  BFab 

^

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.

cLevelPurchasingPricePPLVcharNONENONE

A code that indicates where to retrieve the purchase price for an item when you enter a purchase order. Valid codes are:    1   Use the 
supplier/item price from the Purchase Price table (F41061).    2   Use the supplier/item/branch price from the Purchase Price table (F41061).    3   Use 
the inventory cost from the Inventory Cost table (F4105). This cost is based on the inventory cost level and the purchasing cost method you 
specify for the item. The first two codes are applicable only if you set up supplier costs in the Procurement system. If you do not set up 
supplier costs, the system uses the inventory cost as the default for the purchase order.

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.

cActionCodeACTNcharNONENONE

'A' or '1' - Add
'C' or '2' - Change

^

szSalesCatalogSectionSRP1charNONENONE

'*' will default to blanks
^

szSubSectionSRP2charNONENONE

'*' will default to blanks
^

szSalesCategoryCode3SRP3charNONENONE

'*' will default to blanks
^

szSalesCategoryCode4SRP4charNONENONE

'*' will default to blanks
^

szSalesCategoryCode5SRP5charNONENONE

'*' will default to blanks
^

szCommodityClassPRP1charNONENONE

'*' will default to blanks
^

szCommoditySubClassPRP2charNONENONE

'*' will default to blanks
^

szVendorRebateCodePRP3charNONENONE

'*' will default to blanks
^

szMasterPlanningFamilyPRP4charNONENONE

'*' will default to blanks
^

szPurchasingrCategoryCode5PRP5charNONENONE

'*' will default to blanks
^

mnBuyerNumberBUYRMATH_NUMERICNONENONE

'*' will default to blanks
^

mnLeadtimeLevelLTLVMATH_NUMERICNONENONE

'*' will default to blanks
^

mnPlannerNumberANPLMATH_NUMERICNONENONE

'*' will default to blanks
^

cOrderPolicyCodeOPCcharNONENONE

'*' will default to blanks
^

cIssueTypeCodeITCcharNONENONE

'*' will default to blanks
^

cErrorCodeERRcharNONENONE

1' will be returned if any errors occurred.
^

cEv01LanguageTypeEV01charNONENONE

If a '1', it is a double byte language and the compress description is inserted differently.
^

Related Functions

B4000040 Misc. Item Master Validation Functions
B4000290 Compress And Left Justify String
B9800100 Get Audit Information
X4101DEF Assign Item Master Defaults

Related Tables

F4101 Item Master