web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Set blank account code for eConnect purchase order

(0) ShareShare
ReportReport
Posted on by 121

Hello,

I am trying to set blank GL account codes on line items when creating a purchase order in Dynamics GP, however it keeps defaulting to our default "Stock" GL code. 

If I create the purchase order using the same information through the Dynamics GP GUI, the GL account code is left blank, which is what I'm desiring from eConnect. 

I have tried setting the `InventoryAccount` property of `taPoLine` to a blank string and tried setting the `IVIVINDX` property of `taPoLine` to 0 (zero), but in both of these instances the GL account code is still set to our "Stock" GL code. 

A bit of background -- I only want this to be blank for non-inventory purchase orders so that the finance team are forced to enter the correct GL code before processing the purchase order. This is because there are numerous different non-inventory categories and we want to allocate the non-inventory PO line to the appropriate one. Inventory purchase orders can (and do) just take the "Stock" GL code.

Here is my code so far. The `PO` object is deserialized from an XML file. 

static string eCon_PurchaseOrder (PO po)
{
  // PO header generate
  taPoHdr poHead = new taPoHdr();
  poHead.PONUMBER = po.Header.DynamicsPONumber;
  poHead.POSTATUS = 2;
  poHead.POSTATUSSpecified = true;
  poHead.VENDORID = po.Header.CreditorID;
  poHead.DOCDATE = po.Header.PODate;
  poHead.CURNCYID = po.Header.CurrencyID;
  poHead.UpdateIfExists = 1;
  poHead.BUYERID = "INTERFACEPO";
  poHead.PRMDATE = po.Header.DeliveryDate;
  poHead.REQDATE = po.Header.DeliveryDate;

  // PO lines generate
  IEnumerable<taPoLine_ItemsTaPoLine> poLines = eCon_POLines(po);
  POPTransactionType eConPo = new POPTransactionType();
  eConPo.taPoHdr = poHead;
  eConPo.taPoLine_Items = poLines.ToArray();

  // Create eConnect transaction and serialize it to string
  eConnectType eConType = new eConnectType()
  {
    POPTransactionType = new POPTransactionType[] {eConPo}
  };
  return SerializeToXmlString(eConType);
}

static IEnumerable<taPoLine_ItemsTaPoLine> eCon_POLines(PO po) 
{
  foreach (PO_Line line in po.LineItems)
  {
    taPoLine_ItemsTaPoLine eConPoLine = new taPoLine_ItemsTaPoLine();
    eConPoLine.PONUMBER = po.Header.DynamicsPONumber;
    eConPoLine.UNITCOST = decimal.Parse(line.UnitCost);
    eConPoLine.UNITCOSTSpecified = true;
    eConPoLine.QUANTITY = line.QtyOrdered_Int;
    eConPoLine.QUANTITYSpecified = true;
    eConPoLine.QTYCANCE = line.QtyCancelled_Int;
    eConPoLine.QTYCANCESpecified = true;
    eConPoLine.ITEMNMBR = line.ItemCode;
    eConPoLine.UOFM = "EACH";
    eConPoLine.UpdateIfExists = 1;
    eConPoLine.LineNumber = int.Parse(line.ORD);
    eConPoLine.LineNumberSpecified = true;
    eConPoLine.REQDATE = line.DeliveryDate_Sql;
    eConPoLine.VENDORID = po.Header.CreditorID;
    eConPoLine.CURNCYID = po.Header.CurrencyID;
    eConPoLine.LOCNCODE = line.SiteID;
    eConPoLine.ORD = int.Parse(line.ORD);

    if (!line.IsInventoryItem)
    {
      // Non-inventory item
      eConPoLine.IVIVINDXSpecified = true;
      eConPoLine.IVIVINDX = 0;                    // Set a blank distribution account
      eConPoLine.NONINVEN = 1;                    // Set noninven
      eConPoLine.ITEMDESC = line.ItemDescription; // Set item description as it won't pull from IV00101
    }
    else
    {
      // Inventory item
      eConPoLine.IVIVINDXSpecified = true;
      eConPoLine.IVIVINDX = 5;                    // Assign "Stock" account 8130-00-0000
      eConPoLine.VNDITNUM = line.ItemCode;        // Assign vendor item code previously created
    }
    yield return eConPoLine;
  }
}

So my question is, what am I missing to ensure that the GL account code is left blank for the non-inventory line items?

*This post is locked for comments

I have the same question (0)
  • chadbruels Profile Picture
    1,588 on at

    I believe taPOLine is always going to default an account from setup when IVIVINDX is 0. I think your best alternative is to add a step after the transactions has been imported which directly updates the table, removing the account value for non-inventory lines.

  • RyanSinfield Profile Picture
    121 on at

    Thanks for your suggestion.

    Do you know where it might be taking the default account from, as I can't see it in setup? It also doesn't populate it with an account code if I manually create the PO line.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans