Assign a document number to a sales order

The following XML example shows how to use an eConnect XML document to create a sales order. In addition, the document uses eConnect to query Microsoft Dynamics GP for a sales order number. The query result populates the <SOPNUMBE> element of the document. Note the following characteristics of the document:

  • The document contains a single <SOPTransactionType> transaction type schema. The schema specifies the XML nodes you use to create a sales order.
  • Notice how the document uses a <taSopLineIvcInsert> node to create a line item and a <taSopHdrIvcInsert> node for the header of the sales order. The <taSopLineIvcInsert_Items> node enables the document to include one or more line items.
  • Notice how the <SOPNUMBE> element of the <taSopLineIvcInsert> and <taSopHdrIvcInsert> nodes do not specify a value. The element will be populated when the query obtains the new sales order number.
  • Notice how the <SOPTYPE> element of the <taSopLineIvcInsert> and <taSopHdrIvcInsert> nodes are populated the with the value of 2. The value specifies that the document is a sales order.
  • Notice that the <DOCID> element of the <taSopHdrIvcInsert> node is populated with the value STDORD. The value specifies the type of sales order you want to create.
  • The values you use in the <SOPTYPE> and <DOCID> elements determine the type of Microsoft Dynamics GP document number that is requested for this sales order.
<eConnect xmlns:dt="urn:schemas-microsoft-com:datatypes">
    <SOPTransactionType>
        <taSopLineIvcInsert_Items>
            <taSopLineIvcInsert>
                <SOPTYPE>2</SOPTYPE>
                <SOPNUMBE></SOPNUMBE>
                <CUSTNMBR>ALTONMAN0001</CUSTNMBR>
                <DOCDATE>2007-03-03</DOCDATE>
                <LOCNCODE>WAREHOUSE</LOCNCODE>
                <ITEMNMBR>ACCS-CRD-12WH</ITEMNMBR>
                <UNITPRCE>9.95</UNITPRCE>
                <XTNDPRCE>19.90</XTNDPRCE>
                <QUANTITY>2</QUANTITY>
                <MRKDNAMT>0</MRKDNAMT>
                <COMMNTID>TEST</COMMNTID>
                <COMMENT_1>cmt1</COMMENT_1>
                <COMMENT_2>cmt2</COMMENT_2>
                <COMMENT_3>cmt3</COMMENT_3>
                <COMMENT_4>cmt4</COMMENT_4>
                <ITEMDESC>yes</ITEMDESC>
                <TAXAMNT>0</TAXAMNT>
                <QTYONHND>0</QTYONHND>
                <QTYRTRND>0</QTYRTRND>
                <QTYINUSE>0</QTYINUSE>
                <QTYINSVC>0</QTYINSVC>
                <QTYDMGED>0</QTYDMGED>
                <NONINVEN>0</NONINVEN>
                <LNITMSEQ>0</LNITMSEQ>
                <DROPSHIP>0</DROPSHIP>
                <QTYTBAOR>0</QTYTBAOR>
                <DOCID>STDORD</DOCID>
                <SALSTERR>TERRITORY 2</SALSTERR>
                <SLPRSNID>GREG E.</SLPRSNID>
            </taSopLineIvcInsert>
        </taSopLineIvcInsert_Items>
        <taSopHdrIvcInsert>
            <SOPTYPE>2</SOPTYPE>
            <DOCID>STDORD</DOCID>
            <SOPNUMBE></SOPNUMBE>
            <ORIGNUMB>0</ORIGNUMB>
            <ORIGTYPE>0</ORIGTYPE>
            <TAXSCHID>USASTCITY-6*</TAXSCHID>
            <FRTSCHID>USASTCITY-6*</FRTSCHID>
            <MSCSCHID>USASTCITY-6*</MSCSCHID>
            <SHIPMTHD>UPS GROUND</SHIPMTHD>
            <TAXAMNT>0</TAXAMNT>
            <LOCNCODE>WAREHOUSE</LOCNCODE>
            <DOCDATE>2007-03-03</DOCDATE>
            <FREIGHT>3.00</FREIGHT>
            <MISCAMNT>2.00</MISCAMNT>
            <TRDISAMT>0</TRDISAMT>
            <DISTKNAM>0</DISTKNAM>
            <MRKDNAMT>0</MRKDNAMT>
            <CUSTNMBR>ALTONMAN0001</CUSTNMBR>
            <CUSTNAME>Alton Manufacturing</CUSTNAME>
            <CSTPONBR>4859</CSTPONBR>
            <ShipToName>SERVICE</ShipToName>
            <ADDRESS1>P.O. Box 3333</ADDRESS1>
            <CNTCPRSN>person1</CNTCPRSN>
            <FAXNUMBR>55553200810000</FAXNUMBR>
            <CITY>Detroit</CITY>
            <STATE>MI</STATE>
            <ZIPCODE>48233-3343</ZIPCODE>
            <COUNTRY>USA</COUNTRY>
            <PHNUMBR1>55553289890000</PHNUMBR1>
            <PHNUMBR3>55553200810000</PHNUMBR3>
            <SUBTOTAL>19.90</SUBTOTAL>
            <DOCAMNT>24.90</DOCAMNT>
            <PYMTRCVD>0</PYMTRCVD>
            <SALSTERR>TERRITORY 2</SALSTERR>
            <SLPRSNID>GREG E.</SLPRSNID>
            <USER2ENT>sa</USER2ENT>
            <BACHNUMB>TEST</BACHNUMB>
            <PRBTADCD>PRIMARY</PRBTADCD>
            <PRSTADCD>SERVICE</PRSTADCD>
            <FRTTXAMT>0</FRTTXAMT>
            <MSCTXAMT>0</MSCTXAMT>
            <ORDRDATE>2007-03-03</ORDRDATE>
            <MSTRNUMB>0</MSTRNUMB>
            <NONINVEN>0</NONINVEN>
            <PYMTRMID>2% 10/Net 30</PYMTRMID>
            <USINGHEADERLEVELTAXES>0</USINGHEADERLEVELTAXES>
            <CREATECOMM>0</CREATECOMM>
            <CREATETAXES>1</CREATETAXES>
            <DEFTAXSCHDS>0</DEFTAXSCHDS>
            <FREIGTBLE>1</FREIGTBLE>
            <MISCTBLE>1</MISCTBLE>
        </taSopHdrIvcInsert>
    </SOPTransactionType>
</eConnect>