Hello ..
i want to insert about 1000 lines in one journal , so i found the next code and it help me to insert one line
but i need to insert 1000 liens from another ax table
Original code is
static void CreateTransferJournal(Args _args) { InventJournalTable inventJournalTable; InventJournalTrans inventJournalTrans; InventJournalCheckPost inventJournalCheckPost; NumberSeq num; boolean _throwserror=true; boolean _showinforesult=true; InventDim frominventDim,ToinventDim; ; ttsbegin; inventJournalTable.clear(); num = new NumberSeq(); num = NumberSeq::newGetNum (InventParameters::numRefTransferId()); inventJournalTable.initFromInventJournalName(InventJournalName::find (InventParameters::find().TransferJournalNameId)); inventJournalTable.Description = “Inventory Transfer Journal”; inventJournalTable.SystemBlocked = true; inventJournalTable.insert(); inventJournalTrans.clear(); inventJournalTrans.initFromInventJournalTable(inventJournalTable); inventJournalTrans.ItemId = “xxxxxx”; frominventDim.InventLocationId=”xx”; frominventDim.inventSiteId =”xx”; ToinventDim.InventLocationId = “xxxx”; ToinventDim.InventSiteId = “xx”; ToinventDim = InventDim::findOrCreate(ToinventDim); frominventDim = InventDim::findOrCreate(frominventDim); inventJournalTrans.InventDimId = frominventDim.inventDimId; inventJournalTrans.initFromInventTable(InventTable::find(“1101″)); inventJournalTrans.Qty = 10; inventJournalTrans.ToInventDimId = ToinventDim.inventDimId; inventJournalTrans.TransDate = SystemDateget(); inventJournalTrans.insert(); inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost (JournalCheckpostType::Post,inventJournalTable); inventJournalCheckPost.parmThrowCheckFailed(_throwserror); inventJournalCheckPost.parmShowInfoResult(_showinforesult); inventJournalCheckPost.run(); inventJournalTable.SystemBlocked = false; inventJournalTable.update(); ttscommit; }
so now i edited the code and added while select from the other table
static void CopyOfCreateTransferJournal(Args _args) { aaaT aaa1; InventJournalTable inventJournalTable; InventJournalTrans inventJournalTrans; InventJournalCheckPost inventJournalCheckPost; NumberSeq num; boolean _throwserror = true; boolean _showinforesult = true; InventDim frominventDim,ToinventDim; ; inventJournalTable.clear(); num = new NumberSeq(); num = NumberSeq::newGetNum(InventParameters::numRefTransferId()); inventJournalTable.initFromInventJournalName(InventJournalName::find(InventParameters::find().TransferJournalNameId)); inventJournalTable.Description = 'Inventory Transfer Journal'; inventJournalTable.SystemBlocked = true; inventJournalTable.insert(); while select * from aaa1 { ttsbegin; inventJournalTrans.clear(); inventJournalTrans.initFromInventJournalTable(inventJournalTable); inventJournalTrans.ItemId = aaa1.ItemId; frominventDim.InventLocationId = aaa1.InventLocationIdFrom; frominventDim.inventSiteId = aaa1.InventSiteIdFrom; ToinventDim.InventLocationId = aaa1.InventLocationIdTO; ToinventDim.InventSiteId = aaa1.InventSiteIdTo; ToinventDim = InventDim::findOrCreate(ToinventDim); frominventDim = InventDim::findOrCreate(frominventDim); inventJournalTrans.InventDimId = frominventDim.inventDimId; inventJournalTrans.initFromInventTable(InventTable::find(aaa1.ItemId)); inventJournalTrans.Qty = aaa1.Qty; inventJournalTrans.ToInventDimId = ToinventDim.inventDimId; inventJournalTrans.TransDate = SystemDateget(); inventJournalTrans.insert(); //inventJournalTable.SystemBlocked = false; //select forUpdate inventJournalTable;// where inventJournalTable. //inventJournalTable.update(); //if(InventJournalCheckPost::newPostJournal(inventJournalTable).validate()) //InventJournalCheckPost::newPostJournal(inventJournalTable).run(); ttscommit; } }
Now there is an error after start the job
(Maximum number of decimals for the stockkeeping unit is 8)
thanks
*This post is locked for comments
Thanks the problem was in some data
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156