title: Cannot add row without complete selection of batch/serial numbers
body: <p>ERROR: (-4014) Cannot add row without complete selection of batch/serial numbers.</p>
  <p>The default function of DI API <code>SaveDraftToDocument()</code> is working fine on MS SQL Database but not SAP HANA.</p>
  <p>I am posting the Delivery document with Serial Numbers.</p>
  <pre><code>SAPbobsCOM.Documents oDrafts;
  oDrafts = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDrafts);
  oDrafts.GetByKey(Convert.ToInt32(EditText27.Value));
  var count = oDrafts.Lines.Count;
  var linenum = oDrafts.Lines.LineNum;
  //Validation
  #region
  var RsRecordCount = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
  var sQryRecordCount = String.Format(&quot;Select * from \&quot;SANTEXDBADDON\&quot;.\&quot;@TEMPITEMDETAILS\&quot; where \&quot;U_DraftNo\&quot; = '{0}'&quot;, EditText27.Value);
  RsRecordCount.DoQuery(sQryRecordCount);
  #endregion
  
  if (count == RsRecordCount.RecordCount)
  {
      //LINES
      string ItemCode = &quot;&quot;, WhsCode = &quot;&quot;; double Quantity = 0; int index = 0;
      for (int i = 0; i &lt; oDrafts.Lines.Count; i++)
      {
          oDrafts.Lines.SetCurrentLine(index);
          ItemCode = oDrafts.Lines.ItemCode;
          //SERIAL NUMBERS
          var RsSerial = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
          string table = &quot;\&quot;@TEMPSERIALS\&quot;&quot;;
          var sQrySerial = String.Format(
              &quot;Select \&quot;U_ItemCode\&quot; , \&quot;U_DistNumber\&quot; from \&quot;SANTEXDBADDON\&quot;.\&quot;@TEMPSERIALS\&quot; where &quot; +
              &quot;\&quot;U_DraftNo\&quot; = '{0}' and \&quot;U_ItemCode\&quot; = '{1}'&quot;, EditText27.Value, ItemCode);
              RsSerial.DoQuery(sQrySerial);
          int serialindex = 1, lineindex = 0;
          #region
          if (RsSerial.RecordCount &gt; 0)
          {
              while (!RsSerial.EoF)
              {
                  //OSRN SERIALS
                  var RsSerialOSRN = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                  var sQrySerialOSRN = String.Format(
                      &quot;Select * from OSRN where \&quot;DistNumber\&quot; = '{0}' and \&quot;ItemCode\&quot; = '{1}'&quot;
                      , RsSerial.Fields.Item(&quot;U_DistNumber&quot;).Value.ToString(), ItemCode);
                  RsSerialOSRN.DoQuery(sQrySerialOSRN);
  
                  oDrafts.Lines.SerialNumbers.SetCurrentLine(0);
  
                  oDrafts.Lines.SerialNumbers.BaseLineNumber = oDrafts.Lines.LineNum;
  
                  oDrafts.Lines.SerialNumbers.SystemSerialNumber =
                      Convert.ToInt32(RsSerialOSRN.Fields.Item(&quot;SysNumber&quot;).Value.ToString());
  
                  oDrafts.Lines.SerialNumbers.ManufacturerSerialNumber =
                      RsSerialOSRN.Fields.Item(&quot;DistNumber&quot;).Value.ToString();
  
                  oDrafts.Lines.SerialNumbers.InternalSerialNumber =
                      RsSerialOSRN.Fields.Item(&quot;DistNumber&quot;).Value.ToString();
  
                  oDrafts.Lines.SerialNumbers.Quantity = 1;
                  
                  if (RsSerial.RecordCount != serialindex)
                  {
                      Application.SBO_Application.StatusBar.SetText(&quot;INTERNAL NO  &quot; + oDrafts.Lines.SerialNumbers.InternalSerialNumber, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                      oDrafts.Lines.SerialNumbers.Add();
                      serialindex++;
                      lineindex++;
                  }
                  RsSerial.MoveNext();
              }
          }
          #endregion
          index++;
      }
      var status = oDrafts.SaveDraftToDocument();
  
      if (status == 0)
      {
          oDrafts.Remove();
          Application.SBO_Application.StatusBar.SetText(&quot;Delivery Posted Successfully !&quot;, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
      }
      else
      {
          int code = 0; string message = &quot;&quot;;
          oCompany.GetLastError(out code, out message);
          Application.SBO_Application.SetStatusBarMessage(message, SAPbouiCOM.BoMessageTime.bmt_Medium, true);
      }
  }`
  </code></pre>