Zum Inhalt

Sales Invoice

This service is to recieve posted sales invoices from Business Central.

Service Endpoint

The base Endpoint is:

OutboundSalesInvoiceIISWebService/OutboundSalesInvoiceIISWebService

API Methods

Here are the available methods for the Sales Invoice Service:

  • GetSalesInvoice
  • GetSalesInvoiceByDate
  • GetSalesInvoiceAsPDF

GetSalesInvoice

Sample Request

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
   xmlns:out="http://tempuri.org/OutboundSalesInvoiceIISWebService/" 
   xmlns:x53="urn:microsoft-dynamics-nav/xmlports/x5371203">
   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:Action>http://tempuri.org/OutboundSalesInvoiceIISWebService/OutboundSalesInvoiceIISWebService/GetSalesInvoice</wsa:Action>
   </soap:Header>
   <soap:Body>
      <out:GetSalesInvoice>         
         <out:outboundSalesInvoice/>                   
         <out:fromDocNo>1</out:fromDocNo>         
         <out:customerNo>10000</out:customerNo>
         <out:maxEntries>1</out:maxEntries>
         <out:showDetails>false</out:showDetails>
      </out:GetSalesInvoice>
   </soap:Body>
</soap:Envelope>

Sample Response

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   <s:Header>
      <a:Action s:mustUnderstand="1">http://tempuri.org/OutboundSalesInvoiceIISWebService/OutboundSalesInvoiceIISWebService/GetSalesInvoiceResponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <GetSalesInvoiceResponse xmlns="http://tempuri.org/OutboundSalesInvoiceIISWebService/">
         <outboundSalesInvoice>
            <Sales_Invoice xmlns="urn:microsoft-dynamics-nav/xmlports/x5371203">
               <Amount>0</Amount>
               <Total_Amount>0</Total_Amount>
               <Invoice_Discount_Amount>0</Invoice_Discount_Amount>
               <VAT_Amount>0</VAT_Amount>
               <Amount_Incl_VAT>0</Amount_Incl_VAT>
               <Header_General>
                  <Document_No>103001</Document_No>
                  <Order_Date>2017-01-23</Order_Date>
                  <Shipment_Method_Code>EXW</Shipment_Method_Code>
                  <Currency_Code/>
                  <Shipping_Agent_Code/>
                  <Customer_Order_No/>
                  <External_Document_No/>
                  <Payment_Method_Code/>
               </Header_General>
               <Header_Sell_To_Customer>
                  <Customer_No>10000</Customer_No>
                  <Contact_No/>
                  <Name>Möbel-Meller KG</Name>
                  <Name_2/>
                  <Address>Tischlerstr. 4-10</Address>
                  <Address_2/>
                  <Post_Code>48436</Post_Code>
                  <City>Düsseldorf</City>
                  <Country_Code/>
               </Header_Sell_To_Customer>
               <Header_Bill_To_Customer>
                  <Customer_No>10000</Customer_No>
                  <Contact_No/>
                  <Name>Möbel-Meller KG</Name>
                  <Name_2/>
                  <Address>Tischlerstr. 4-10</Address>
                  <Address_2/>
                  <Post_Code>48436</Post_Code>
                  <City>Düsseldorf</City>
                  <Country_Code/>
               </Header_Bill_To_Customer>
               <Header_Ship_To_Customer>
                  <Code/>
                  <Name>Möbel-Meller KG</Name>
                  <Name_2/>
                  <Address>Tischlerstr. 4-10</Address>
                  <Address_2/>
                  <Post_Code>48436</Post_Code>
                  <City>Düsseldorf</City>
                  <Country_Code/>
               </Header_Ship_To_Customer>
               <Header_Payment>
                  <TX_ID/>
                  <TX_Code/>
                  <TX_Amount/>
               </Header_Payment>
            </Sales_Invoice>
         </outboundSalesInvoice>
      </GetSalesInvoiceResponse>
   </s:Body>
</s:Envelope>

GetSalesInvoiceByDate

Sample Request

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
   xmlns:out="http://tempuri.org/OutboundSalesInvoiceIISWebService/"   
   xmlns:x53="urn:microsoft-dynamics-nav/xmlports/x5371203">
   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:Action>http://tempuri.org/OutboundSalesInvoiceIISWebService/OutboundSalesInvoiceIISWebService/GetSalesInvoiceByDate</wsa:Action>
   </soap:Header>
   <soap:Body>
      <out:GetSalesInvoiceByDate>         
         <out:outboundSalesInvoice/>      
         <out:fromDocNo>1</out:fromDocNo>
         <out:customerNo>10000</out:customerNo>
         <out:maxEntries>1</out:maxEntries>
         <out:showDetails>true</out:showDetails>
         <out:fromDate>2016-01-01</out:fromDate>
         <out:toDate>2017-04-01</out:toDate>
      </out:GetSalesInvoiceByDate>
   </soap:Body>
</soap:Envelope>

Sample Response

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   <s:Header>
      <a:Action s:mustUnderstand="1">http://tempuri.org/OutboundSalesInvoiceIISWebService/OutboundSalesInvoiceIISWebService/GetSalesInvoiceByDateResponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <GetSalesInvoiceByDateResponse xmlns="http://tempuri.org/OutboundSalesInvoiceIISWebService/">
         <outboundSalesInvoice>
            <Sales_Invoice xmlns="urn:microsoft-dynamics-nav/xmlports/x5371203">
               <Amount>12,035</Amount>
               <Total_Amount>11,433.25</Total_Amount>
               <Invoice_Discount_Amount>601.75</Invoice_Discount_Amount>
               <VAT_Amount>2,172.32</VAT_Amount>
               <Amount_Incl_VAT>13,605.57</Amount_Incl_VAT>
               <Header_General>
                  <Document_No>103001</Document_No>
                  <Order_Date>2017-01-23</Order_Date>
                  <Shipment_Method_Code>EXW</Shipment_Method_Code>
                  <Currency_Code/>
                  <Shipping_Agent_Code/>
                  <Customer_Order_No/>
                  <External_Document_No/>
                  <Payment_Method_Code/>
               </Header_General>
               <Header_Sell_To_Customer>
                  <Customer_No>10000</Customer_No>
                  <Contact_No/>
                  <Name>Möbel-Meller KG</Name>
                  <Name_2/>
                  <Address>Tischlerstr. 4-10</Address>
                  <Address_2/>
                  <Post_Code>48436</Post_Code>
                  <City>Düsseldorf</City>
                  <Country_Code/>
               </Header_Sell_To_Customer>
               <Header_Bill_To_Customer>
                  <Customer_No>10000</Customer_No>
                  <Contact_No/>
                  <Name>Möbel-Meller KG</Name>
                  <Name_2/>
                  <Address>Tischlerstr. 4-10</Address>
                  <Address_2/>
                  <Post_Code>48436</Post_Code>
                  <City>Düsseldorf</City>
                  <Country_Code/>
               </Header_Bill_To_Customer>
               <Header_Ship_To_Customer>
                  <Code/>
                  <Name>Möbel-Meller KG</Name>
                  <Name_2/>
                  <Address>Tischlerstr. 4-10</Address>
                  <Address_2/>
                  <Post_Code>48436</Post_Code>
                  <City>Düsseldorf</City>
                  <Country_Code/>
               </Header_Ship_To_Customer>
               <Header_Payment>
                  <TX_ID/>
                  <TX_Code/>
                  <TX_Amount/>
               </Header_Payment>
               <Sales_Inv_Lines>
                  <Sales_Inv_Line>
                     <Line_No>10000</Line_No>
                     <Type>3</Type>
                     <No>THORSTEN</No>
                     <Variant_Code/>
                     <Description>Möbelmontage, Januar</Description>
                     <Description_2/>
                     <Quantity>25</Quantity>
                     <Unit_Of_Measure_Code>STUNDE</Unit_Of_Measure_Code>
                     <Line_Amount>1971.25</Line_Amount>
                     <Line_Amount_Incl_VAT>2345.79</Line_Amount_Incl_VAT>
                     <Shipment_Date>2017-01-23</Shipment_Date>
                     <Unit_Price>83.00</Unit_Price>
                  </Sales_Inv_Line>
                  <Sales_Inv_Line>
                     <Line_No>20000</Line_No>
                     <Type>3</Type>
                     <No>THORSTEN</No>
                     <Variant_Code/>
                     <Description>Möbelmontage, Januar</Description>
                     <Description_2/>
                     <Quantity>120</Quantity>
                     <Unit_Of_Measure_Code>KILOMETER</Unit_Of_Measure_Code>
                     <Line_Amount>9462.00</Line_Amount>
                     <Line_Amount_Incl_VAT>11259.78</Line_Amount_Incl_VAT>
                     <Shipment_Date>2017-01-23</Shipment_Date>
                     <Unit_Price>83.00</Unit_Price>
                  </Sales_Inv_Line>
               </Sales_Inv_Lines>
            </Sales_Invoice>
         </outboundSalesInvoice>
      </GetSalesInvoiceByDateResponse>
   </s:Body>
</s:Envelope>

GetSalesInvoiceAsPDF

Sample Request

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:out="http://tempuri.org/OutboundSalesInvoiceIISWebService/">
   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <wsa:Action>http://tempuri.org/OutboundSalesInvoiceIISWebService/OutboundSalesInvoiceIISWebService/GetSalesInvoiceAsPDF</wsa:Action>
   </soap:Header>
   <soap:Body>
      <out:GetSalesInvoiceAsPDF>
         <!--Optional:-->
         <out:documentNo>103001</out:documentNo>
         <!--Optional:-->
         <out:resultBase64String></out:resultBase64String>
      </out:GetSalesInvoiceAsPDF>
   </soap:Body>
</soap:Envelope>

Sample Response

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   <s:Header>
      <a:Action s:mustUnderstand="1">http://tempuri.org/OutboundSalesInvoiceIISWebService/OutboundSalesInvoiceIISWebService/GetSalesInvoiceAsPDFResponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <GetSalesInvoiceAsPDFResponse xmlns="http://tempuri.org/OutboundSalesInvoiceIISWebService/">
         <GetSalesInvoiceAsPDFResult/>
         <resultBase64String> BASE 64 encoded string </resultBase64String>
      </GetSalesInvoiceAsPDFResponse>
   </s:Body>
</s:Envelope>

Field Information

Item Field Information

Name Description Type max. Length Occurance
Amount Amount without invoice discount Decimal 0..1
Total_Amount Amount incl. invoice discount Decimal 0..1
Invoice_Discount_Amount Invoice discount amount Decimal 0..1
Total_VAT_Amount Total VAT amount Decimal 0..1
Amount_Incl_VAT Amount incl. VAT Decimal 0..1

Header Field Information

Name Description Type max. Length Occurance
🔑 Document No* Specifies the number of the Sales invoice. Leave this empty when creating a new invoice. (Requieres auto incremented no. series in Business Central.) String 20 1..1
Order_Date Specifies the order DateTime. Date is saved in NAV/Business Central only! DateTime 0..1
Shipment_Method_Code Specifies a default shipment method code for the order. Get a list of codes from the Master Data Service String 50 0..1
Currency_Code Specifies a default currency code for the invoice. Get a list of codes from the Master Data Service String 10 0..1
Shipping_Agent_Code Specifies a default shipping agent code for the order. Get a list of codes from the Master Data Service String 10 0..1
Shipping_Agent_Service_Code Specifies a default shipping agent service code for the order. Get a list of codes from the Master Data Service String 10 0..1
Customer_Order_No Specifies the customer's order no. String 20 0..1
External_Document_No Specifies the external document no. This must be unique in Business Central. You'll receive an error when insert two orders with the same external document no. String 35 0..1
Payment_Method_Code Specifies a default payment method code for the invoice. Get a list of codes from the Master Data Service String 10 0..1
Prices_Incl_VAT Specifies the price to be incl. VAT Boolean 0..1

Address Sell-to, Ship-to, Bill-to Field Information

Name Description Type max. Length Occurance
Customer_No Specifies the number of the customer. String 20 1..1
Contact_No Specifies the number of the contact. String 20 1..1
Code Specifies the Ship-to Address Codes. String 10 0..1
Name Specifies the name. String 50 0..1
Name_2 Specifies the additional name. String 50 0..1
Address Specifies the address. i.E. 'Hauptstraße 12b' String 50 1..1
Address_2 Specifies the add. address information. String 50 1..1
City Specifies the city. String 30 1..1
Post_Code Specifies a code for the post code of the address. Get a list of codes from the Master Data Service String 10 0..1
Country_Region_Code Specifies a code for the country/region of the address. Get a list of codes from the Master Data Service String 10 0..1

Payment Field Information

Name Description Type max. Length Occurance
TX_ID Specifies the payment transaction no. String 80 1..1
TX_Code Specifies the transaction auth. code String 20 1..1
TX_Amount Specifies the amount String 10 0..1

Sales Invoice Line Field Information

Name Description Type max. Length Occurance
🔑 Line No* Specifies the pos. number. Decimal 1..1
Type Specifies the Type: "Item" No Specifies the No. i.E. Item No. "70000" String
Variant_Code Specifies the item variant code String 10 0..1
Description Specifies the Description. String 50 0..1
Description_2 Specifies the additional Description. String 50 0..1
Unit_Of_Measure_Code Specifies the sales unit of measure of the item. String 10 0..1
Quantity Specifies the quantity. Decimal 1..1
Line_Amount Specifies the lines amount Decimal 0..1
Line_Amount_Incl_VAT Specifies the lines amount incl. VAT. Decimal 0..1
Line_Discount_Percent Specifies the lines discount percentage. Decimal 0..1
Line_Discount_Amount Specifies the lines discount amount. Decimal 0..1
Shipment_Date Specifies the lines shipment date. DateTime 0..1
Unit_Price Specifies the lines unit price Decimal 0..1