Menu

Invoice (Customer) - getNextId error

2009-03-03
2013-05-02
  • marian zanfir

    marian zanfir - 2009-03-03

    hi all,

    I need a little help.

    after installing compiere 3.1 and entering a lot of data into application :o)
    I want to create my first Invoice (Customer). after completing all the necessary fields on the master when I go to 'Invoice Line' tab I get this error message:
    "Could not save changes".
    from the java window a get some more details about this error:
    MSequence.getNextID: No record found - C_Invoice [11]
    MInvoice.saveNew: No NextID (-1) [11]
    GridTable.saveWarning: SaveError - [11]
    I thing that is about generating invoice number  function: getNextId

    I have tried both cases: auto numbering and manual numbering of the document and I think that the numbering sequences are right set.
    so where is the problem?

    thank you,
    have a nice day

     
    • albert

      albert - 2009-03-03

                      if (rs.next())
                      {
                      //    int AD_Sequence_ID = rs.getInt(4);
                          //
                          int incrementNo = rs.getInt(3);
                          if (compiereSys)
                          {
                              retValue = rs.getInt(2);
                              rs.updateInt(2, retValue + incrementNo);
                          }
                          else
                          {
                              retValue = rs.getInt(1);
                              rs.updateInt(1, retValue + incrementNo);
                          }
                          rs.updateRow();
                      }
                      else
                          s_log.severe ("No record found - " + TableName);

      the Message form your post  is Last Line "No record found".......
      what Datebase do u used ?
      and this is from  Callablestatement change to PrepareStatement

              String selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, AD_Sequence_ID "
                  + "FROM AD_Sequence "
                  + "WHERE Name=?"
                  + " AND IsActive='Y' AND IsTableID='Y' AND IsAutoSequence='Y' "
                  + " FOR UPDATE";

      cuase another Deadlock

       
    • stingreye

      stingreye - 2009-03-03

      Marian,

      Some things to look at:

      Anytime I get a constraint or sequence error I log into the system administrator role and run the process "sequence check".  Particularly if you imported any data or manually added any data.  The sequence check fixes most database id, document no, and sequence errors.  Usually that fixes anythings you run into (usually caused when I am dumping data into custom tables I created NOT using the import loader).  It sounds like your error may be caused by the internal database id (C_INVOICE_ID field) and not by the document no.  So manually changing the documentno would not fix your problem becuase it is the hidden primary key field C_INVOICE_ID field that might be causing your error (although usually I think it would be a unique constraint violated error)

      I would check the document sequence window of the client (client admin role) and the system and see if the sequence exists there.

      GOOD LUCK!

       
    • marian zanfir

      marian zanfir - 2009-03-04

      hi,

      my problem is solved :o)
      you both are right
      indeed it is about the C_Invoice_Id and not about the doc no.
      in fact in this case the error is generated by the "IsTableID='Y'" condition of the  select statement posted by albert. IsTableId is in fact the "Used for Record Id" check box on the sequence editing window. and is optional :o). if you don't check this box the select statement doesn't return anything -> error: No record found
      at list I think so.
      I see that all the sequences from the system have this check box "checked", so in order to use any sequence you must check this box. again why it is optional? :o)

      anyway thank you very much for the time spent with this matter
      have a nice day
      marian

       

Log in to post a comment.