PO Receipts are not created properly in Sage100 using SData

SOLVED

I'm trying to create receipts in Sage 100 using the SData interface. The XML that is sent to the server is presented below. It should create one receipt with one receipt line. Request to the server is executed successfully, however created receipt is invalid: all fields concerning amounts are not filled. In my XML I set values to PrepaidAmt and NontaxableAmt fields, but in the database I see that these fields are set to zero. Also the receipt has no lines, PO_ReceiptDetail table stays empty. Am I missing something?

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns:sdata="http://schemas.sage.com/sdata/2008/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://schemas.sage.com/sdata/http/2008/1" xmlns="http://www.w3.org/2005/Atom">
  <id>http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptHeader/$template</id>
  <sdata:payload>
    <PO_ReceiptHeaderSPECIAL sdata:uri="http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptHeader/$template" xmlns="">
      <ReceiptType>G</ReceiptType>
      <ReceiptNo>010007</ReceiptNo>
      <PurchaseOrderNo>0000010</PurchaseOrderNo>
      <PrepaidAmt>4656.08</PrepaidAmt>
      <NontaxableAmt>4656.08</NontaxableAmt>
      <PrepaidFreightAmt>4656.08</PrepaidFreightAmt>
      <APDivisionNo>01</APDivisionNo>
      <VendorNo>AIRWAY</VendorNo>
      <PO_ReceiptDetailSPECIALSECOND sdata:uri="http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptDetail/$template">
        <ReceiptType>G</ReceiptType>
        <ReceiptNo>010007</ReceiptNo>
        <LineKey>000001</LineKey>
        <LineSeqNo>00000100000000</LineSeqNo>
        <ItemCode>2480-8-50</ItemCode>
        <UseTax>N</UseTax>
        <RequiredDate>2015-05-25T00:00:00-07:00</RequiredDate>
        <PurchasesAcctKey>0000000AT</PurchasesAcctKey>
        <UnitOfMeasure>EACH</UnitOfMeasure>
        <WarehouseCode>000</WarehouseCode>
        <LotSerialFullyDistributed>Y</LotSerialFullyDistributed>
        <OrderLineKey>000001</OrderLineKey>
        <OriginalQtyOrdered>2</OriginalQtyOrdered>
        <BalanceQtyBackordered>1</BalanceQtyBackordered>
        <OriginalOrderQty>0</OriginalOrderQty>
        <QuantityReceived>1</QuantityReceived>
        <QuantityInvoiced>0</QuantityInvoiced>
        <QuantityBackordered>1</QuantityBackordered>
        <PreviousQtyReceived>0</PreviousQtyReceived>
        <PreviousQtyInvoiced>0</PreviousQtyInvoiced>
        <UnitCost>2115.750000</UnitCost>
        <OriginalUnitCost>2115.750000</OriginalUnitCost>
        <ExtensionAmt>2115.750000</ExtensionAmt>
      </PO_ReceiptDetailSPECIALSECOND>
    </PO_ReceiptHeaderSPECIAL>
  </sdata:payload>
  <http:httpStatus>200</http:httpStatus>
</entry>
  • 0

    Greetings,

    Do you have the Sage 100 SData demo website example that we showed at Sage Summit a fe years ago?  

    If so, are you able to use that to submit Sales Orders and Customer info via SData?  If not, please download (or have your Sage 100 partner download) the Sage 100 SData sample and documentation from SageSell and test that on your installation.

    If you have the Sage 100 SData demo website and it is working, then try the following.  In a test or copy company in Sage 100, create a PO Receipt with only the required fields filled out to see what the minimum required fields are to successfully create the receipt.  Using that information, scale down the XML payload being submitted to SData to use only those fields. See the Sales Order payload in the sample website as an example.

    As you will see, you don't need to pass the Linekey, LineSeqNo and other header information in the line detail (PO_ReceiptDetailSPECIALSECOND)since that information is added autmatically when the line is created.

    Once you have the minimum XML payload workiing, start adding the additional data you want to set one element at a time.

    Thank you,

    Kent Mackall

  • 0 in reply to Kent Mackall

    Hello Kent,

    Unfortunately I don't have Sage 100 SData demo website example. However in my application I'm able to create SO_InvoiceHeader and SO_InvoiceDetail records successfully.

    I figured out that the following XML is minimally required to create a receipt:

    <?xml version="1.0" encoding="utf-8"?>
    <entry xmlns:sdata="http://schemas.sage.com/sdata/2008/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://schemas.sage.com/sdata/http/2008/1" xmlns="http://www.w3.org/2005/Atom">
    <id>http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptHeader/$template</id>
    <sdata:payload>
    <PO_ReceiptHeaderSPECIAL sdata:uri="http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptHeader/$template" xmlns="">
    <ReceiptType>G</ReceiptType>
    <ReceiptNo>011006</ReceiptNo>
    <PurchaseOrderNo>0000011</PurchaseOrderNo>
    <PrepaidFreightAmt>2328.0384</PrepaidFreightAmt>
    <PO_ReceiptDetailSPECIALSECOND sdata:uri="http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptDetail/$template">
    <ReceiptNo>011006</ReceiptNo>
    <ItemCode>2480-8-50</ItemCode>
    <QuantityReceived>1</QuantityReceived>
    </PO_ReceiptDetailSPECIALSECOND>
    </PO_ReceiptHeaderSPECIAL>
    </sdata:payload>
    <http:httpStatus>200</http:httpStatus>
    </entry>

    But there are still problems here. Please notice the field PrepaidFreightAmt. If I don't specify value for it, I receive an error from server: 'This Receipt has no lines and has zero total amounts'. If I try to fill another amount field, say PrepaidAmt, the error is the same. It seems that PrepaidFreightAmt field is required for receipt creation, but the value assigned to it is not stored in database. And again, created receipt has completely no lines.

    Could you please advise.

  • 0 in reply to nalex

    Greetings,

    PrepaidFreightAmt is a column in PO_receiptHeader.  I think the problem is with the line infomraiton but I'm not sure as I don't have any SData sample to create a receipt.  You shouldn't need to set the ReseiptNo on the line.  What happens if you take that out?

    I strongly suggest that you get a copy of the demo webstie and other documentation that is on SageSell so you can use that as a guide.

    Thank you,

    Kent

  • 0 in reply to Kent Mackall

    Hello Kent.

    I downloaded P-51-Sage-100-ERP-SData.zip from Sage Sell. But unfortunately there is no receipt creation sample there. However, I used sales order creation sample to update look and feel of my receipt XML. It looks like this now:

    <?xml version="1.0" encoding="utf-8"?>
    <entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns="http://www.w3.org/2005/Atom" xmlns:sdata="http://schemas.sage.com/sdata/2008/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:sync="http://schemas.sage.com/sdata/sync/2008/1" xmlns:sme="http://schemas.sage.com/sdata/sme/2007" xmlns:http="http://schemas.sage.com/sdata/http/2008/1">
    <sdata:payload>
    <PO_ReceiptHeaderSPECIAL sdata:uri="http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptHeaderSPECIAL()" xmlns="">
    <ReceiptType>G</ReceiptType>
    <ReceiptNo>012001</ReceiptNo>
    <PurchaseOrderNo>0000012</PurchaseOrderNo>
    <PrepaidFreightAmt>2328.0384</PrepaidFreightAmt>
    <PO_ReceiptDetailSPECIALSECOND>
    <ReceiptNo>012001</ReceiptNo>
    <ItemCode>2480-8-50</ItemCode>
    <QuantityReceived>1</QuantityReceived>
    </PO_ReceiptDetailSPECIALSECOND>
    </PO_ReceiptHeaderSPECIAL>
    </sdata:payload>
    </entry>
    

    I sent it with POST to http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptHeaderSPECIAL() where 192.168.56.2 is the server running Sage 100 ERP with demo ABX company and SData enabled. I sent it with content type application/atom+xml;type=entry. This XML is processed successfully, server return 200 OK. But still PO_ReceiptDetail table is empty.

    I tried to remove ReceiptNo from XML as you suggested. This gives the following XML:

    <?xml version="1.0" encoding="utf-8"?>
    <entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns="http://www.w3.org/2005/Atom" xmlns:sdata="http://schemas.sage.com/sdata/2008/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:sync="http://schemas.sage.com/sdata/sync/2008/1" xmlns:sme="http://schemas.sage.com/sdata/sme/2007" xmlns:http="http://schemas.sage.com/sdata/http/2008/1">
    <sdata:payload>
    <PO_ReceiptHeaderSPECIAL sdata:uri="http://192.168.56.2/sdata/MasApp/MasContract/ABX/PO_ReceiptHeaderSPECIAL()" xmlns="">
    <ReceiptType>G</ReceiptType>
    <PurchaseOrderNo>0000012</PurchaseOrderNo>
    <PrepaidFreightAmt>2328.0384</PrepaidFreightAmt>
    <PO_ReceiptDetailSPECIALSECOND>
    <ItemCode>2480-8-50</ItemCode>
    <QuantityReceived>1</QuantityReceived>
    </PO_ReceiptDetailSPECIALSECOND>
    </PO_ReceiptHeaderSPECIAL>
    </sdata:payload>
    </entry>

    Result is the same: PO_ReceiptDetail table is empty. Besides, PrepaidFreightAmt field is still required. If I omit it, server says 'This Receipt has no lines and has zero total amounts'.

    Could you please provide a working example of receipt creation? Thanks in advance.

  • 0 in reply to nalex

    Greetings,

    I will try to come up with an example for a PO receipt but I can't provide any timetable for when I would have that available.

    Thank you,

    Kent

  • 0 in reply to Kent Mackall

    Hello Kent,

    That would be very kind of you. At this moment we got stuck with our integration module and do not know where to go for help. We couldn't find any example for the receipts with lines and at this point it looks like this just doesn't work via SData. Or we do not know something.

    Looking forward to your help and appreciate your time deeply. Thank you.

    Best wishes,

    Alexander Nurullaev.

  • 0 in reply to nalex
    verified answer

    Greetings,

    I spent some time this morning creating an extremely simple SData example for PO Receipt Of Goods based on the existing Sage 100 SData example from Summit 2013.  

    This uses ABX Demo Data with PO Receipt Batch entry turned off in PO Options.

    I created a Purchase Order for 01-AIRWAY with one line using item 2480-8-50 and an Ordered quantity of 1.  

    I modified the customerlite.html and added a new button in the body to go to a PO Receipt form:

    <div class="sageblock">
        <div id="poReceiptSelect"></div>
        <form action="poreceipt.html"><button id="poreceipt" type="submit">Add a new PO Receipt</button></form>
        <div id="poReceiptInfo"></div>
    </div>

    I created a new poreceipt.html file based on the neworder.html file that acccepts entry of the Purchase Order Number and then defaults the remaining values for the PO Receipt in the SData Payload.

    Here are the important details from the poreceipt.html.  Sorry for the poor formatting.

    Script excerpt:

     <script type="text/javascript">
      
      function submitNewReceipt() {
       var purchaseorderno = document.getElementById('purchaseorderno').value;
       
       var aUrl = '/sdata/MasApp/MasContract/' + gCompany + '/PO_ReceiptHeaderSPECIAL()';
       var aPayload = '<PO_ReceiptHeaderSPECIAL sdata:uri="' + aUrl + '" xmlns="">';
        aPayload += '<ReceiptType>G</ReceiptType>'   
        aPayload += '<PurchaseOrderNo>' + purchaseorderno + '</PurchaseOrderNo>';
        aPayload += '<APDivisionNo>01</APDivisionNo>';
        aPayload += '<VendorNo>AIRWAY</VendorNo>';    
        aPayload += '<PO_ReceiptHeaderSPECIALSECOND>';
         aPayload += '<ItemCode>2480-8-50</ItemCode>';
         aPayload += '<QuantityReceived>1</QuantityReceived>';
        aPayload += '</PO_ReceiptHeaderSPECIALSECOND>';
        aPayload += '</PO_ReceiptHeaderSPECIAL>';    
       
       sdataPost(
        aUrl,
        aPayload,
        'PO_ReceiptHeaderSPECIAL'
       );
      }
     </script>

    Body excerpt:

    <body onload="init()">

     <H1>Customer Maintenance Lite - New PO receipt</H1>

     <div id="textDiv">   <div id="poreceipt"></div>  </div>  <script type="text/javascript">   var div = document.getElementById("textDiv");   var nestedDiv = ""   nestedDiv.textContent = "Create PO Receipt of Goods";   var text = "[" + div.textContent + "]";  </script>

       <form id="newreceiptform">

      Purchase Order Number: <input type="text" id="purchaseorderno" />

      <button type="button" onclick="submitNewReceipt()">Submit</button>  </form>  <a href="customerlite.html">Back to Customer Maintenance Lite</a><br>

     <p class="sdataStatus">SData status: <span id="sdataStatus"></span></p>

    </body>

     

    When I run this and enter the PO Number for the PO I created and click the submit button, the PO Receipt Of Goods entry is created in Sage 100.  Feel free to use this as an example to create PO Receipts.


    Thank you,

    Kent

     

  • 0 in reply to Kent Mackall

    Hello Kent,

    Thank you for your example. I compared two XML snippets, one from your example and another that I used, and found an error in my XML. I was using PO_ReceiptDetailSPECIALSECOND instead of PO_ReceiptHeaderSPECIALSECOND. I fixed it and managed to create correct receipt with a line.

    Thank you for help!

    Best wishes,

    Alexander Nurullaev.

  • 0 in reply to nalex

    Greetings,

    thanks for posting back that it worked.  Sorry I missed that typo in your original post.