Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Create Sales Invoice with Tax on Header Level by eConnect

(0) ShareShare
ReportReport
Posted on by 140

Hi Expects,

We have one requirement to create sales invoice with Tax on Header Level. I did some investigation, we may need to use <taSopLineIvcTaxInsert>.

When I tried to use below xml for eConnect to create the sales invoice, it always returns error. Can someone shed me some lights on how to solve this error?

I also attached a screenshot for the Tax. If I need to create invoice with this Tax, how to generate the <taSopLineIvcTaxInsert>  xml struct?

Besides, To generate the invoice, do we need to calculate all the amount fields under <taSopHdrIvcInsert>?

For example, <SUBTOTAL>,<DOCAMNT>,<TAXAMNT>,<FRTTXAMT>,<MSCTXAMT>..

Error

Error Number = 799 Stored Procedure= taSopHdrIvcInsert Error Description = Tax table detail does not equal the tax amount
Node Identifier Parameters: taSopHdrIvcInsert
SOPNUMBE = STDINV2281
SOPTYPE = 3
Related Error Code Parameters for Node : taSopHdrIvcInsert
TAXAMNT = 89.6
FRTTXAMT = 0
MSCTXAMT = 0

XML

<eConnect xmlns:dt="urn:schemas-microsoft-com:datatypes">
<SOPTransactionType>
<taSopLineIvcInsert_Items>
<taSopLineIvcInsert>
<SOPNUMBE>STDINV2281</SOPNUMBE>
<SOPTYPE>3</SOPTYPE>
<CUSTNMBR>ADVANCED0001</CUSTNMBR>
<DOCDATE>2022-10-12</DOCDATE>
<ITEMNMBR>128 SDRAM</ITEMNMBR>
<UNITPRCE>448</UNITPRCE>
<XTNDPRCE>448</XTNDPRCE>
<QUANTITY>1</QUANTITY>
<ITEMDESC>128 meg SDRAM</ITEMDESC>
<DROPSHIP>0</DROPSHIP>
<QtyShrtOpt>2</QtyShrtOpt>
<NONINVEN>0</NONINVEN>
<PRSTADCD>PRIMARY</PRSTADCD>
<CURNCYID>Z-US$</CURNCYID>
</taSopLineIvcInsert>
</taSopLineIvcInsert_Items>
<taSopLineIvcTaxInsert_Items>
<taSopLineIvcTaxInsert>
<CUSTNMBR>ADVANCED0001</CUSTNMBR>
<LNITMSEQ>1</LNITMSEQ>
<SOPNUMBE>STDINV2281</SOPNUMBE>
<SOPTYPE>3</SOPTYPE>
<SALESAMT>448</SALESAMT>
<TDTTXSLS>448</TDTTXSLS>
<STAXAMNT>537</STAXAMNT>
<TAXDTLID>AUSSTE-PS20N0</TAXDTLID>
<TAXTYPE>0</TAXTYPE>
</taSopLineIvcTaxInsert>
</taSopLineIvcTaxInsert_Items>
<taSopHdrIvcInsert>
<SOPNUMBE>STDINV2281</SOPNUMBE>
<SOPTYPE>3</SOPTYPE>
<DOCID>STDINV</DOCID>
<TAXSCHID>ALL DETAILS</TAXSCHID>
<SHIPMTHD>UPS Ground</SHIPMTHD>
<DOCDATE>2022-10-12</DOCDATE>
<CUSTNMBR>ADVANCED0001</CUSTNMBR>
<CSTPONBR>pabeauty|102311</CSTPONBR>
<ShipToName>Advanced Paper Co.</ShipToName>
<ADDRESS1>456 19th Street S.</ADDRESS1>
<CITY>Chicago</CITY>
<STATE>IL</STATE>
<ZIPCODE>60603-911</ZIPCODE>
<COUNTRY>US</COUNTRY>
<BACHNUMB>EDI10/25/2022</BACHNUMB>
<PRSTADCD>PRIMARY</PRSTADCD>
<ORDRDATE>2022-10-12</ORDRDATE>
<CURNCYID>Z-US$</CURNCYID>
<COMMENT_1>Free B3e with this intro</COMMENT_1>
<SUBTOTAL>448</SUBTOTAL>
<DOCAMNT>537.6</DOCAMNT>
<TAXAMNT>89.6</TAXAMNT>
<FRTTXAMT>0</FRTTXAMT>
<MSCTXAMT>0</MSCTXAMT>
<CREATETAXES>0</CREATETAXES>
<DEFTAXSCHDS>1</DEFTAXSCHDS>
<USINGHEADERLEVELTAXES>1</USINGHEADERLEVELTAXES>
</taSopHdrIvcInsert>
<taSopUserDefined>
<SOPNUMBE>STDINV2281</SOPNUMBE>
<SOPTYPE>3</SOPTYPE>
</taSopUserDefined>
<TCEDI>
<StoreNumber>TCEDI</StoreNumber>
<DCCode>TCEDI</DCCode>
<MarkForCode>785</MarkForCode>
<DepartmentNumber>TCEDI</DepartmentNumber>
<User1>TCEDI</User1>
<User2>TCEDI</User2>
</TCEDI>
<taCreateCustomerItems_Items/>
</SOPTransactionType>
</eConnect>

 

pastedimage1666778853219v1.png

Thanks

Categories:
  • Denny1986 Profile Picture
    140 on at
    RE: Create Sales Invoice with Tax on Header Level by eConnect

    Thanks, Derek.

    Another question,. Can GP help to calculate the Sales Tax automaticatlly by only passing Tax Detail ID?

    Otherwise, we have to the get the percent of the Tax Detail ID and then calculate the sales tax manually.

  • Verified answer
    Derek Albaugh Profile Picture
    on at
    RE: Create Sales Invoice with Tax on Header Level by eConnect

    Error Number = 799  Stored Procedure= taSopHdrIvcInsert  Error Description = Tax table detail does not equal the tax amount

    For this error, we are taking the total of all the tax columns in the SOP10105 table STAXAMNT + FRTTXAMT + MSCTXAMT and comparing it to the sum of the 3 tax variables that you are passing into your header: @I_vTAXAMNT + @I_vFRTTXAMT + @I_vMSCTXAMT.  If they don’t match then we get the error that you are seeing.

    select @TAXAMNTL = isnull(sum(STAXAMNT + FRTTXAMT + MSCTXAMT),0.00) from SOP10105 (nolock) where SOPTYPE = @I_vSOPTYPE and SOPNUMBE = @I_vSOPNUMBE and LNITMSEQ = 0 and BKOUTTAX = 0

                if (@TAXAMNTL <> (@I_vTAXAMNT + @I_vFRTTXAMT + @I_vMSCTXAMT))

                begin

    select @O_iErrorState = 799 /* Tax table detail does not equal the tax amount */

    We'd more need a support case for this type of question, but let's see what we can do.....

    Below is a example I've seen used for this type of eConnect error message. This was added to an existing customer script.

    On the sales tax line, it zeroes out the freight tax. Then a second tax line call is added specifically for the freight tax with a tax type of 1 for Freight.

    In this case, the sales order imported into the system without issue and it was able to be transfered into a sales invoice and posted without errors as well in the user interface.

    Again, this is just a piece of a example script that was used in a case with this same taSopHdrIvcInsert procedure / 799 error message.

    Hopefully it helps resolve the error in your case as well.

    EXEC   @return_value = [dbo].[taSopLineIvcTaxInsert]

                @I_vSOPTYPE = 2,

                @I_vSOPNUMBE = N'CUSTOMER123',

                @I_vCUSTNMBR = N'12345',

                @I_vSALESAMT = 8.40,

                @I_vFRTTXAMT = 0, --0 as we need a separate Freight Tax Line

                @I_vFREIGHT = 0,  --0 as we need a separate Freight Tax Line

                @I_vTAXDTLID = N'VAT-19%-SALES',

                @I_vSTAXAMNT = 1.60,

                @O_iErrorState = @O_iErrorState OUTPUT,

                @oErrString = @oErrString OUTPUT

       SELECT @oRptString = 'SELECT ErrorCode, SourceProc, ErrorDesc FROM DYNAMICS..taErrorCode WHERE ErrorCode IN (' + REPLACE(RTRIM('0'+@oErrString),CHAR(32), ',') + ')'

               EXEC(@oRptString)

    --ADDED SEPARATE FREIGHT TAX LINE

    EXEC   @return_value = [dbo].[taSopLineIvcTaxInsert]

                @I_vSOPTYPE = 2,

                @I_vSOPNUMBE = N'CUSTOMER123',

                @I_vCUSTNMBR = N'12345',

                @I_vTAXTYPE = 1, --Added Tax Type of 1 for Freight

                @I_vSALESAMT = 0,

                @I_vFRTTXAMT = 1.12, --Moved Freight Tax Amounts here

                @I_vFREIGHT = 5.87,  --Moved Freight Tax Amounts here

                @I_vTAXDTLID = N'VAT-19%-SALES',

                @I_vSTAXAMNT = 0,

                @O_iErrorState = @O_iErrorState OUTPUT,

                @oErrString = @oErrString OUTPUT

               SELECT @oRptString = 'SELECT ErrorCode, SourceProc, ErrorDesc FROM DYNAMICS..taErrorCode WHERE ErrorCode IN (' + REPLACE(RTRIM('0'+@oErrString),CHAR(32), ',') + ')'

               EXEC(@oRptString)

    Thanks

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,351 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,029 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans