jverrelli 10/15/2012 3:01:14 PM

Problem with creating a Purchase Order

Hi Everyone,

  I am creating an XML document to import purchase orders into Great Plains using eConnect. I am using eConnect to get the next PO number and that works first and then I serialize a PO line and PO Hdr but when I go to pass the XML string to the Entry Point Method I get the following error:

 

Sql procedure error codes returned:
Error Number = 880  Stored Procedure taPoLine  Error Description = Invalid Purchase Item Taxable (Purchase_IV_Item_Taxable) status (1=Taxable,2=Nontaxable,3=Base on Vendor
Node Identifier Parameters: taPoLine                                          
PONUMBER = PO9150856
VENDORID = IMP006
Related Error Code Parameters for Node : taPoLine                                          
Purchase_IV_Item_Taxable =  Note: This parameter was not passed in, no value for the parameter will be returned.

 

I also noticed that my vb method to populate the line item and hdr does not put in all of the line item attributes in the xml file. below is my code to serialize the PO information. Any help would be apreciated.

Sub SerializePurchaseOrderObject(ByVal filename As String, ByVal sPONumber As String)
        'This subroutine creates an eConnect Purchase Order XML document and
        'writes the XML to a file
        Dim purchaseOrder As New POPTransactionType
        Dim purchaseLine As New taPoLine_ItemsTaPoLine
        Dim purchaseHdr As New taPoHdr
        Dim lineItems(1) As taPoLine_ItemsTaPoLine
        Dim eConType As New eConnectType

        With purchaseLine
            .POTYPE = 1
            .PONUMBER = sPONumber
            .VENDORID = "IMP006"
            .LOCNCODE = "NORWALK"
            .VNDITNUM = "7104"
            .ITEMNMBR = "169550"
            .QUANTITY = 1
            .QTYCANCE = 0
            .FREEONBOARD = 1
            .REQSTDBY = "GROCERY"
            .REQDATE = "11/5/2012"
            .NONINVEN = 0
            .ITEMDESC = "1/2 8 Inch Cake Container"
            .VNDITDSC = "Half 8'' Round Cake Container Cakeware"
            .UNITCOST = 56.95
            .UOFM = "each"
            .Purchase_Item_Tax_Schedu = ""
            .Purchase_IV_Item_Taxable = 2
        End With
        lineItems(0) = purchaseLine
        purchaseOrder.taPoLine_Items = lineItems

        With purchaseHdr
            .POTYPE = 1
            .PONUMBER = sPONumber
            .VENDORID = "IMP006"
            .VENDNAME = "IMPERIAL BAG & PAPER CO., INC."
            .DOCDATE = "08/10/2012"
            .BUYERID = "testuser"
            .SUBTOTAL = "56.95"
            .TAXAMNT = "0"
            .REQDATE = "11/5/2012"
            .TAXAMNT = "0"
        End With

        purchaseOrder.taPoHdr = purchaseHdr
        Dim eConnect As New eConnectType
        ReDim Preserve eConnect.POPTransactionType(0)
        eConnect.POPTransactionType(0) = purchaseOrder

        Dim fs As New FileStream(filename, FileMode.Create)
        Dim writer As New XmlTextWriter(fs, New UTF8Encoding)

        Dim serializer As New XmlSerializer(GetType(eConnectType))
        serializer.Serialize(writer, eConnect)
        writer.Close()

 

End Sub

 

 

this is what my XML file looks like, as you can see it is missing some attributes:

<?xml version="1.0" encoding="UTF-8"?>
<eConnect xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <POPTransactionType>
        <eConnectProcessInfo xsi:nil="true"/>
        <taRequesterTrxDisabler_Items xsi:nil="true"/>
        <taUpdateCreateItemRcd xsi:nil="true"/>
        <taUpdateCreateVendorRcd xsi:nil="true"/>
        <taCreateVendorAddress_Items xsi:nil="true"/>
        <taUpdateCreateCustomerRcd xsi:nil="true"/>
        <taCreateCustomerAddress_Items xsi:nil="true"/>
        <taPopIvcTaxInsert_Items xsi:nil="true"/>
        <taPopDistribution_Items xsi:nil="true"/>
        <taAnalyticsDistribution_Items xsi:nil="true"/>
        <taPoLine_Items>
            <taPoLine>
                <PONUMBER>PO9150859</PONUMBER>
                <VENDORID>IMP006</VENDORID>
                <LOCNCODE>NORWALK</LOCNCODE>
                <VNDITNUM>7104</VNDITNUM>
                <ITEMNMBR>169550</ITEMNMBR>
                <REQSTDBY>GROCERY</REQSTDBY>
                <REQDATE>11/5/2012</REQDATE>
                <ITEMDESC>1/2 8 Inch Cake Container</ITEMDESC>
                <VNDITDSC>Half 8'' Round Cake Container Cakeware</VNDITDSC>
                <UOFM>each</UOFM>
            </taPoLine>
        </taPoLine_Items>
        <taPoHdr>
            <PONUMBER>PO9150859</PONUMBER>
            <VENDORID>IMP006</VENDORID>
            <VENDNAME>IMPERIAL BAG & PAPER CO., INC.</VENDNAME>
            <DOCDATE>08/10/2012</DOCDATE>
            <BUYERID>rluz</BUYERID>
            <REQDATE>11/5/2012</REQDATE>
        </taPoHdr>
    </POPTransactionType>
</eConnect>

 

Thanks

John

 

 

 

Version: GP 10
Section: .NET Development, Dynamics GP, 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