Hello
I'm trying to create transfer orders, like desrcibed in this post:
My problem is, that I have products with product variants and I can't get those working - for simple products the import already works
I don't know how to configure it correctly, I always get the error "Inventory dimension Configuration is a product dimension and must consequently be specified."
Here is my code:
// Properties
HcmWorker workerTable; HcmEmployment employmentTable; WEAHcmEmploymentWenatexDetail employmentDetailTable; InventTransferTable inventTransferTable; InventTransferLine inventTransferLine; NumberSequenceReference numberSequenceReference; NumberSeq numberSeq; WTXImportAgentInventTransferPosition positionTable; LogisticsLocation logisticsLocation; LogisticsPostalAddress logisticsPostalAddress; InventTable inventTable; InventDimCombination inventDimCombinationTable; InventDim inventDimTable; // Code while select validTimeState(currentDateTime, currentDateTime) workerTable join employmentTable where employmentTable.Worker == workerTable.RecId join employmentDetailTable where employmentDetailTable.Employment == employmentTable.RecId && workerTable.PersonnelNumber == baseTable.PersonnelNumber { if(employmentDetailTable && employmentDetailTable.InventLocationId) { break; } } if(!employmentDetailTable) { throw error("No storage found"); } inventTransferTable.clear(); inventTransferTable.initValue(); numberSequenceReference = InventParameters::numRefTransferId(); numberSeq = numberSeq::newGetNumFromCode(numberSequenceReference.numberSequenceTable().NumberSequence); inventTransferTable.TransferId = numberSeq.num(); inventTransferTable.InventLocationIdFrom = baseTable.InventLocationIdFrom; inventTransferTable.modifiedField(fieldNum(InventTransferTable, InventLocationIdFrom)); inventTransferTable.InventLocationIdTo = employmentDetailTable.InventLocationId; inventTransferTable.WEAToWMSLocationId = employmentDetailTable.WMSLocationId; inventTransferTable.modifiedField(fieldNum(InventTransferTable, InventLocationIdTo)); inventTransferTable.WEAInventTransferType = WEAInventTransferType::SalesAgent; inventTransferTable.TransferStatus = InventTransferStatus::Created; inventTransferTable.WEAHcmWorkerRecId = workerTable.RecId; logisticsPostalAddress = DirParty::primaryPostalAddress(workerTable.Person); logisticsLocation = LogisticsLocation::find(logisticsPostalAddress.Location); if (logisticsLocation.RecId) { inventTransferTable.ToAddressName = logisticsLocation.Description; inventTransferTable.ToPostalAddress = LogisticsPostalAddress::addressRecIdFromLocationRecId(logisticsLocation.RecId); } inventTransferTable.insert(); while select positionTable where positionTable.TransferBaseRecId == baseTable.RecId { productIdTable.clear(); select productIdTable where productIdTable.LokiProductId == positionTable.ProductId; if(!productIdTable) { throw error(strFmt("No mapping for product [%1] found!", positionTable.ProductId)); } inventTransferLine.clear(); if(productIdTable.configId) { // InventDim inventDimTable.clear(); inventDimTable.configId = productIdTable.configId; inventDimTable.InventLocationId = employmentDetailTable.InventLocationId; inventDimTable.InventSiteId = employmentDetailTable.InventSiteId; inventDimTable = InventDim::findOrCreate(inventDimTable); inventTransferLine.InventDimId = inventDimTable.inventDimId; // WEAToInventDim inventDimTable.clear(); inventDimTable.configId = productIdTable.configId; inventDimTable.InventLocationId = baseTable.InventLocationIdFrom; inventDimTable.InventSiteId = baseTable.InventSiteIdFrom; inventDimTable = InventDim::findOrCreate(inventDimTable); inventTransferLine.WEAToInventDimId = inventDimTable.inventDimId; } inventTransferLine.ItemId = productIdTable.ItemId; inventTransferLine.initFromInventTable(InventTable::find(productIdTable.ItemId)); inventTransferLine.initFromInventTransferTable(inventTransferTable, NoYes::Yes); inventTransferLine.QtyTransfer = positionTable.Quantity; inventTransferLine.QtyShipNow = 0; inventTransferLine.QtyReceiveNow = 0; inventTransferLine.QtyRemainShip = positionTable.Quantity; inventTransferLine.QtyRemainReceive = positionTable.Quantity; inventTransferLine.UnitId = positionTable.Unit; inventTransferLine.insert(); }
Hope one can help me?!
Best regards
Jürgen Starkl
*This post is locked for comments
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,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156