I created UDF_EXP_DATE in the IM_ItemCost file to go along with the serial number.
Below is a sample code to populate UDF_EXP_DATE in an existing cost layer.
I believe I am almost there but something is wrong and I can't find it. Please help!
Here is the code:
Dim RetVal AsInteger
Dim oScript As
New ProvideX.Script
Dim oSS As ProvideX.PvxDispatch
oScript =New ProvideX.Script
oScript.Init("\\server\Version4\MAS90\Home")
oSS = oScript.NewObject("SY_SESSION")
oSS.nSetUser("Ibelin", "123")
oSS.nSetCompany("ABC")
oSS.nSetModule("I/M")
oSS.nSetDate("I/M", "20130423")
Dim ic1 As ProvideX.PvxDispatchDim ic2 As ProvideX.PvxDispatch
oSS.nSetProgram(oSS.nLookuptask("CI_ItemCode_ui"))
ic1 = oScript.NewObject("CI_ItemCode_bus", oSS)
ic2 = oScript.NewObject("IM_ItemCost_bus", oSS)
RetVal = ic1.nSetKeyValue("ItemCode$", "ABC 0045")
RetVal = ic1.nSetKey()
RetVal = ic2.nSetKeyValue("ItemCode$", "ABC 0045") 'ItemNo
RetVal = ic2.nSetKeyValue("WarehouseCode$", "001") 'Warehouse
RetVal = ic2.nSetKeyValue("TierType$", "3") '3 for Lot Number
RetVal = ic2.nSetKeyValue("GroupSort$", "4444") 'Lot Number
RetVal = ic2.nSetKey()
RetVal = ic2.nSetValue("UDF_EXP_DATE$", "20131231") 'Try to Change udf value
RetVal = ic2.nWrite() 'Here retVal = 0
If RetVal = 0 Then
MessageBox.Show(sender.sLastErrorMsg) 'Error here is: Module B/M is not on File
end if