//Below code creates journal header
inventJournalTable.clear();
inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement);
inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName ));
inventJournalTable.insert();
//Below code creates journal lines
inventJournalTrans.clear();
inventJournalTrans.initFromInventJournalTable(inventJournalTable);
inventJournalTrans.TransDate = systemDateGet();
inventJournalTrans.ItemId = itemid;
inventJournalTrans.initFromInventTable(InventTable::find(itemid));
inventJournalTrans.Qty = qty;
inventDim.InventSiteId = 'AVON';
inventDim.InventLocationId = '0001000';
inventDim.wMSLocationId = 'A02';
inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
if(inventJournalTrans.Qty == 0)
{
numOfLines++;
inventJournalTrans.insert();
}
inventJournalTable.NumOfLines = numOfLines;
inventJournalTable.update();
info(strFmt("Stock Count Journal has been created with Journal Name: %1 and Journal ID: %2", inventJournalName, inventJournalTable.JournalId));
Above is x++ code to create the movement journal, my question is, how do i create same journal id with multiple lines? bcs when i run this code, it will output one 1 line with different journal id
btw, before this code snippet is importing and read record from excel, so when i import 4 rows of record, it will output only 1 line of journal line and all at different journal id? anyone kind to help?