- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Inventory Transactio n Entry
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-09-2011 02:56 PM - last edited on 05-09-2011 04:05 PM
Using MAS 200 v4.4
I am trying to write a script that will create a new entry in IM Transaction Entry for an adjustment to an item's quantity. I have the following code snippet with all variables previously defined. After attempting to write the lines, the return value is zero and, of course, the code does not continue successfully from there. Are there any other field values to set?
retVal = oSS.nSetProgram(oSS.nLookupTask("IM_Transaction_ui "))
imTransEntry = oPVX.NewObject("IM_Transaction_bus", oSS)
retVal = imTransEntry.nSetValue("TransactionType$", "6")
NextEntryNo = ""
retVal = imTransEntry.nGetNextEntryNo(NextEntryNo)
retVal = imTransEntry.nSetKey(NextEntryNo)
retVal = imTransEntry.nSetValue("TransactionDate$", "20110509")
retVal = imTransEntry.nSetValue("DefaultFromWhseCode$", "000")
retVal = imTransEntry.nSetValue("Comment$", "test")
retVal = imTransEntry.oLines.nAddLine()
retVal = imTransEntry.oLines.nSetValue("ItemCode$", "6655")
retVal = imTransEntry.oLines.nSetValue("TransactionQty", 10)
retVal = imTransEntry.oLines.nWrite()
MsgBox("retVal = " & retVal)
retVal = imTransEntry.nWrite()
Re: Inventory Transactio n Entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-09-2011 06:55 PM
Well here is yet another "I answered my own question" reply. ![]()
I missed the WarehouseCode$ and also set the wrong key. Here is the corrected code. Hope someone else finds this useful.
Dim oPVX, oSS, imTransEntry As Object
Dim retVal As Integer
Dim NextEntryNo, TransactionType As String
oPVX = CreateObject("ProvideX.Script")
oPVX.Init("C:\Sage Software\MAS 200\Version4\MAS90\home")
oSS = oPVX.NewObject("SY_Session")
oSS.nSetUser("USERNAME", "PASSWORD")
oSS.nSetCompany("ABC")
oSS.nSetDate("I/M", "20110509")
oSS.nSetModule("I/M")
retVal = oSS.nSetProgram(oSS.nLookupTask("IM_Transaction_ui "))
imTransEntry = oPVX.NewObject("IM_Transaction_bus", oSS)
' TransactionType: Sale=1, Issue=2, Transfer=4, Adjustment=6, Receipt=8
TransactionType = "6"
retVal = imTransEntry.nSetValue("TransactionType$", TransactionType)
NextEntryNo = ""
retVal = imTransEntry.nGetNextEntryNo(NextEntryNo)
retVal = imTransEntry.nSetKey(TransactionType & NextEntryNo)
retVal = imTransEntry.nSetValue("TransactionDate$", "20110509")
retVal = imTransEntry.nSetValue("DefaultFromWhseCode$", "000")
retVal = imTransEntry.nSetValue("Comment$", "test comment")
retVal = imTransEntry.oLines.nAddLine()
retVal = imTransEntry.oLines.nSetValue("ItemCode$", "6655")
retVal = imTransEntry.oLines.nSetValue("WarehouseCode$", "000")
retVal = imTransEntry.oLines.nSetValue("TransactionQty", 10)
retVal = imTransEntry.oLines.nWrite()
retVal = imTransEntry.nWrite()
retVal = imTransEntry.DropObject()
retVal = oSS.DropObject()
Re: Inventory Transactio n Entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-13-2011 11:05 AM
What about Batch # ?
Re: Inventory Transactio n Entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-13-2011 12:19 PM
oTransEntry.nSelectNewBatch(nextNo, "N", "Transaction entry " + sysDate)
Re: Inventory Transactio n Entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-14-2011 11:37 AM
Thanks, we don't use batches but I'm sure someone may find that helpful.
BTW, I am using the following to update the Transaction Journal:
retVal = oSS.nSetProgram(oSS.nLookupTask("IM_TransactionReg ister_UI"))
imTransEntry = oPVX.NewObject("IM_TransactionRegister_UPD", oSS)
oSS.nTerminateUI()
retVal = imTransEntry.nUpdateInit()
retVal = imTransEntry.nUpdateMain()
retVal = imTransEntry.nUpdateCleanup()
This works for me without printing the reports.
Re: Inventory Transactio n Entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-23-2012 12:47 PM
Hi,
I need some help. I am trying to do an Inventory Transaction (Specifically Adjustment) and MAS200 keeps on displaying LINE NUMBER 1 HAS NOT BEEN DISTRIBUTED. The item is a FIFO item (NO LOT/SERIAL).
Heres my code:
'##########################################
'#### Create the IM Transaction Header ####
'##########################################
' TransactionType: Sale=1, Issue=2, Transfer=4, Adjustment=6, Receipt=8
retChk(oIMTrans.nSetValue("TransactionType$", "6"), oIMTrans)
retChk(oIMTrans.nGetNextEntryNo(s_NextOrderNo), oIMTrans)
retChk(oIMTrans.nSetKey("6"& s_NextOrderNo), oIMTrans)
retChk(oIMTrans.nSetValue("TransactionDate$", "20120119"), oIMTrans)
retChk(oIMTrans.nSetValue("DefaultFromWhseCode$", "001"), oIMTrans)
retChk(oIMTrans.nSetValue("Comment$", "test comment"), oIMTrans)
'##########################################
'#### Create the IM Transaction Detail ####
##########################################
ForEach entryDetail As OrderItem Inentry.Items
retChk(oIMTrans.oLines.nAddLine(), oIMTrans)
retChk(oIMTrans.oLines.nSetValue("ItemCode$", entryDetail.ItemNumber.ToString), oIMTrans.oLines)
retChk(oIMTrans.oLines.nSetValue("TransactionQty", entryDetail.Quantity), oIMTrans.oLines)
retChk(oIMTrans.oLines.nWrite(), oIMTrans.oLines)
oIMTrans.oLines.nMoveFirst()
retChk(oIMTrans.oLines.nGetValue("LineKey$", s_LineKey), oIMTrans.oLines)
retChk(oIMTrans.oLines.nGetValue("Valuation$", s_Valuation), oIMTrans.oLines)
' Write the distribution record' TransactionType+EntryNo+LineKey+FifoLifoDate+FifoL
oIMTrans.oLines.oDistribution.nSetKeyValue("TransactionType$", "6")
oIMTrans.oLines.oDistribution.nSetKeyValue("EntryNo$", s_NextOrderNo)
oIMTrans.oLines.oDistribution.nSetKeyValue("LineKey$", s_LineKey)
oIMTrans.oLines.oDistribution.nSetKeyValue("TierType$", "1")
oIMTrans.oLines.oDistribution.nSetKeyValue("FifoLifoDate$", "20120123")
oIMTrans.oLines.oDistribution.nSetKeyValue("FifoLifoReferenceNo$", "12345678")
oIMTrans.oLines.oDistribution.nSetKey()
retChk(oIMTrans.oLines.oDistribution.nSetValue("ItemCode$", entryDetail.ItemNumber.ToString), oIMTrans.oLines)
retChk(oIMTrans.oLines.oDistribution.nSetValue("WarehouseCode$", "001"), oIMTrans.oLines)
retChk(oIMTrans.oLines.oDistribution.nSetValue("TransactionQty", entryDetail.Quantity), oIMTrans.oLines)
retChk(oIMTrans.oLines.oDistribution.nWrite(), oIMTrans.oLines)
retChk(oIMTrans.oLines.oDistribution.nCommitRow(), oIMTrans.oLines)
Next
'###################################
'#### Write the object into MAS ####
'###################################
retChk(oIMTrans.nWrite(), oIMTrans)
Next
Can you please help me..
Best Regards
Re: Inventory Transactio n Entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-23-2012 01:12 PM
Hi pablotc,
For the Tier distribution layer there are some methods that might make your life a little easier.
Instead of using all those SetKeyValue() statements, there is a method called AddDistributionLine(arg). For lot/serial lines, the arg value is the Lot Number or Serial Number you want to add on that line. For LIFO/FIFO tiers it's a little different, it's the FifoLifoDate + Chr(138) + FifoLifoReference. A lot of the rest will be done for you. So try the following for the distribution level:
'Write the distribution record' TransactionType+EntryNo+LineKey+FifoLifoDate+FifoLifoReferenceNo+LotSerialNo oIMTrans.oLines.oDistribution.nAddDistributionLine("20120123" & Chr(138) & "12345678") ' Shouldn't need to set the ItemCode or the Warehouse retChk(oIMTrans.oLines.oDistribution.nSetValue("Tr ansactionQty", entryDetail.Quantity), oIMTrans.oLines) retChk(oIMTrans.oLines.oDistribution.nWrite(), oIMTrans.oLines)
You shouldn't need the CommitRow either. Keep in mind this same method can be used for lot/serial tiers as well.
retVal = oIMTrans.oLines.oDistribution.nAddDistributionLine
Hope this helps.
Elliott


