jvolta 5/29/2018 5:12:24 AM

Errors setting order item lot/serials on kit components

I'm able to set sales order item fulfilled qty and lot/serials for lines but not for kit components.  
Seems like the only difference is the componentsequencnumber in the SalesComponentKey.  

salesdoc.Lines[j].Components[k].QuantityFulfilled.Value = salesdoc.Lines[j].Components[k].QuantityFulfilled.Value + CLine.DeltaQty;

Then for lots:

var lots = new List<SalesComponentLot>();
for (int i = 0; i < ShipItem.Distributions.Length; i++)
{
     SalesComponentLot lot = new SalesComponentLot();
     lot.LotNumber = ShipItem.Distributions[i].LotSerial;
     lot.Quantity = new Quantity { Value = ShipItem.Distributions[i].Quantity };
     lot.Bin = null;
     lot.Key = new SalesComponentLotKey();
     lot.Key.QuantityType = QuantityType.OnHand;
     lot.Key.SequenceNumber = (i + 1);
     lot.Key.SalesComponentKey = new SalesComponentKey();
     lot.Key.SalesComponentKey.ComponentSequenceNumber = salesdoc.Lines[j].Components[k].Key.ComponentSequenceNumber;
     lot.Key.SalesComponentKey.SalesLineKey = new SalesLineKey();
     lot.Key.SalesComponentKey.SalesLineKey.LineSequenceNumber = salesdoc.Lines[j].Components[k].Key.SalesLineKey.LineSequenceNumber;
     lot.Key.SalesComponentKey.SalesLineKey.SalesDocumentKey = new SalesDocumentKey();
     lot.Key.SalesComponentKey.SalesLineKey.SalesDocumentKey.Id = salesdoc.Lines[j].Components[k].Key.SalesLineKey.SalesDocumentKey.Id;               
     lots.Add(lot);
}
salesdoc.Lines[j].Components[k].Lots = lots.ToArray();

Full error from event viewer is

 

Action: Create Current User Name: V-TECH\Judy Input parameters: Exception type: Microsoft.Dynamics.GP.eConnect.eConnectException Exception message: Sql procedure error codes returned: Error Number = 115 Stored Procedure= taSopLineIvcInsert Error Description = Unable to insert the component record Node Identifier Parameters: taSopLineIvcInsert SOPNUMBE = TST0034 SOPTYPE = 2 LNITMSEQ = 16384 Error Number = 3462 Stored Procedure= taSopLineIvcInsertComponent Error Description = if AUTOALLOCATELOT = 1 or 2, the taSopLotAuto node must be called with a DOCID that fulfills or QTYFULFI > 0 Node Identifier Parameters: taSopLineIvcInsertComponent SOPNUMBE = TST0034 SOPTYPE = 2 ITEMNMBR = TEST03 LNITMSEQ = 16384 Related Error Code Parameters for Node : taSopLineIvcInsertComponent AUTOALLOCATELOT = 1 QTYFULFI = 1.00000

<taSopLineIvcInsert>
    <SOPTYPE>2</SOPTYPE>
    <SOPNUMBE>TST0034</SOPNUMBE>
    <CUSTNMBR>AARONFIT0001</CUSTNMBR>
    <DOCDATE>2017-04-12T00:00:00</DOCDATE>
    <LOCNCODE>WAREHOUSE</LOCNCODE>
    <ITEMNMBR>TEST03</ITEMNMBR>
    <AutoAssignBin>0</AutoAssignBin>
    <UNITPRCE>50.00000</UNITPRCE>
    <XTNDPRCE>50.00000</XTNDPRCE>
    <TOTALQTY>1.00000</TOTALQTY>
    <MRKDNPCT>0</MRKDNPCT>
    <PRCLEVEL>RETAIL</PRCLEVEL>
    <ITEMDESC>test03</ITEMDESC>
    <NONINVEN>0</NONINVEN>
    <LNITMSEQ>16384</LNITMSEQ>
    <DROPSHIP>0</DROPSHIP>
    <DOCID>TESTORD</DOCID>
    <SALSTERR>TERRITORY 1</SALSTERR>
    <SLPRSNID>PAUL W.</SLPRSNID>
    <PRSTADCD>WAREHOUSE</PRSTADCD>
    <ShipToName>Aaron Fitz Electrical BBB</ShipToName>
    <ADDRESS1>4 Fernwood Drive</ADDRESS1>
    <ADDRESS2>Suite 1234566</ADDRESS2>
    <ADDRESS3>Building 2</ADDRESS3>
    <CNTCPRSN>Bob Fitz</CNTCPRSN>
    <FAXNUMBR>31255501040000</FAXNUMBR>
    <CITY>test</CITY>
    <STATE>CT</STATE>
    <ZIPCODE>06070</ZIPCODE>
    <COUNTRY>USA</COUNTRY>
    <PHONE1>31255501000000</PHONE1>
    <PHONE2>31255501020000</PHONE2>
    <PHONE3>31355501030000</PHONE3>
    <ReqShipDate>2017-04-12T00:00:00</ReqShipDate>
    <SHIPMTHD>GROUND</SHIPMTHD>
    <AUTOALLOCATESERIAL>1</AUTOALLOCATESERIAL>
    <AUTOALLOCATELOT>1</AUTOALLOCATELOT>
    <RequesterTrx>0</RequesterTrx>
    <ALLOCATE>0</ALLOCATE>
    <UpdateIfExists>1</UpdateIfExists>
    <KitCompMan>0</KitCompMan>
    <DEFPRICING>0</DEFPRICING>
    <DEFEXTPRICE>1</DEFEXTPRICE>
    <CURNCYID>Z-US$</CURNCYID>
    <UOFM>EACH</UOFM>
    <IncludePromo>0</IncludePromo>
    <CKCreditLimit>0</CKCreditLimit>
    <QtyShrtOpt>2</QtyShrtOpt>
    <INVINDX>000-1300-01</INVINDX>
    <CSLSINDX>000-4510-01</CSLSINDX>
    <SLSINDX>000-4110-01</SLSINDX>
    <MKDNINDX>000-1205-00</MKDNINDX>
    <RTNSINDX>000-1330-01</RTNSINDX>
    <INUSINDX>000-1520-00</INUSINDX>
    <INSRINDX>000-1300-01</INSRINDX>
    <DMGDINDX>000-4700-00</DMGDINDX>
    <IVITMTXB>1</IVITMTXB>
    <ITMTSHID>ALL DETAILS</ITMTSHID>
    <TAXSCHID>USASTCITY-6*</TAXSCHID>
    <INTEGRATIONSOURCE>0</INTEGRATIONSOURCE>
    <QTYTBAOR>0.00000</QTYTBAOR>
    <QUANTITY>1.00000</QUANTITY>
    <QTYCANCE>0.00000</QTYCANCE>
    <QTYFULFI>1.00000</QTYFULFI>
    <RecreateDist>0</RecreateDist>
</taSopLineIvcInsert>

 

 Stack Trace: at Microsoft.Dynamics.GP.eConnect.EntityMessageProcessor.ExecuteSqlCommands(XElement transactionNode, EntityMessage message) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.ProcessMessageImport(EntityMessage message) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.EntityImportImplementation(String connectionString, String sXML, Boolean isTransaction) at Microsoft.Dynamics.GP.eConnect.eConnectMethods.CreateEntity(String connectionString, String sXML) Exception type: Microsoft.Dynamics.GP.eConnect.eConnectException Exception message: Error Number = 115 Stored Procedure taSopLineIvcInsert Error Description = Unable to insert the component record Error Number = 3462 Stored Procedure taSopLineIvcInsertComponent Error Description = if AUTOALLOCATELOT = 1 or 2, the taSopLotAuto node must be called with a DOCID that fulfills or QTYFULFI > 0 Stack Trace: 

Version: GP 2013
Section: eConnect


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3