Posting error with Sales line

alex123alex123 Member Posts: 6
Hi,

We have imported Sales Head and Sale Lines from other system by using Dataport.

When we stay in Sales Order form and try to post this, some lines gets error message “There is nothing to post” even if there are some lines with amount . With some sales orders that posting goes well but with another it doesn’t.
Also all works fine with "Post and Print" option…
If I try to set one more line to Sales order and doesn’t really make it just put a new line to the order so again posting goes well.

I have checked Sales lines tabel they are identical and seem looks right.

When I trace in debugger CU-80 I saw that in code

SalesLine.RESET;
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
SalesLine.SETFILTER(SalesLine."Qty. to Ship",'<>0');
IF SalesLine.FIND('-') THEN …
Programm finds some lines but with some lines that were imported in that FIND doesn’t return any Salesline. I wrote out filter from that debug and tried it in table Sales Line. I have got some lines but in codeunit it just couldn’t find exact the same lines.
Looks strange Navison behaviour.

Thanks in advance.

Comments

  • David_CoxDavid_Cox Member Posts: 509
    This could be due to the dataport, did you vaildate the quantity field?

    This message is due to these Base fields not being populated.

    5415 Quantity (Base)
    5416 Outstanding Qty. (Base)
    5417 Qty. to Invoice (Base)
    5418 Qty. to Ship (Base)
    5458 Qty. Shipped Not Invd. (Base)
    5460 Qty. Shipped (Base)
    5461 Qty. Invoiced (Base)
    5404 Qty. per Unit of Measure

    You will have to Open the Orders and Validate the unit of Measure and the Quantity Fields to correct this, or create a report to populate these fields above.

    The posting codeunit filters on the Quantities but posts the base values, that is why you are confused by the trace! :?

    If you are unsure how to do this let us know!
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • alex123alex123 Member Posts: 6
    David Cox wrote:
    This could be due to the dataport, did you vaildate the quantity field?

    This message is due to these Base fields not being populated.

    5415 Quantity (Base)
    5416 Outstanding Qty. (Base)
    5417 Qty. to Invoice (Base)
    5418 Qty. to Ship (Base)
    5458 Qty. Shipped Not Invd. (Base)
    5460 Qty. Shipped (Base)
    5461 Qty. Invoiced (Base)
    5404 Qty. per Unit of Measure

    You will have to Open the Orders and Validate the unit of Measure and the Quantity Fields to correct this, or create a report to populate these fields above.

    The posting codeunit filters on the Quantities but posts the base values, that is why you are confused by the trace! :?

    If you are unsure how to do this let us know!

    I have validated both the Quantity and the unit of Measure in dataport. I have checked in the Sales Line table the record all parameters such Quntity (base) etc.. are validated.
    I have wrote before that I have cheked to lines one witch was created with dataport and one that I have creted in the Sales Order form. They are identical.
    But as I know with validating Quntity fires other triggers.



    If I create a new line without Quantity so I can post after that both lines.

    Here is example of the two line they are identical :

    Document Type Order Order
    Sell-to Customer No. 103764 103764
    Document No. 2048171 2048171
    Line No. 20000 10000
    Type G/L Account G/L Account
    No. 3120 3120
    Location Code LAGER LAGER
    Posting Group
    Shipment Date 28.06.2006 28.06.2006
    Description Foto Handsfree Pla
    Description 2
    Unit of Measure Stykk Stykk
    Quantity 1 1
    Outstanding Quantity 1 1
    Qty. to Invoice 1 1
    Qty. to Ship 1 1
    Unit Price Excl. VAT 990 990
    Unit Cost (LCY) 0 0
    VAT % 25 25
    Line Discount % 0 0
    Line Discount Amount 0 0
    Amount 0 0
    Amount Including VAT 0 0
    Allow Invoice Disc. No No
    Gross Weight 0 0
    Net Weight 0 0
    Units per Parcel 0 0
    Unit Volume 0 0
    Appl.-to Item Entry 0 0
    Avdelings - kode
    Produkt - kode
    Customer Price Group
    Job No.
    Appl.-to Job Entry 0 0
    Phase Code
    Job Applies-to ID
    Apply and Close (Job) No No
    Work Type Code
    Outstanding Amount 1 237,5 1 237,5
    Qty. Shipped Not Invoiced 0 0
    Shipped Not Invoiced 0 0
    Quantity Shipped 0 0
    Quantity Invoiced 0 0
    Shipment No.
    Shipment Line No. 0 0
    Profit % 0 0
    Bill-to Customer No. 103764 103764
    Inv. Discount Amount 0 0
    Purchase Order No.
    Purch. Order Line No. 0 0
    Drop Shipment No No
    Gen. Bus. Posting Group INNLAND INNLAND
    Gen. Prod. Posting Group FOTO FOTO
    VAT Calculation Type Normal VAT Normal VAT
    Transaction Type
    Transport Method
    Attached to Line No. 0 0
    Exit Point
    Area
    Tax Area Code
    Tax Liable No No
    Tax Group Code
    VAT Bus. Posting Group INNLAND INNLAND
    VAT Prod. Posting Group VARE 25 VARE 25
    Currency Code
    Outstanding Amount (LCY) 1 237,5 1 237,5
    Shipped Not Invoiced (LCY) 0 0
    Reserved Quantity 0 0
    Reserve Never Never
    Blanket Order No.
    Blanket Order Line No. 0 0
    VAT Base Amount 0 0
    Unit Cost 0 0
    System-Created Entry No No
    Line Amount Excl. VAT 990 990
    VAT Difference 0 0
    Inv. Disc. Amount to Invoice 0 0
    VAT Identifier VARE 25 VARE 25
    IC Partner Ref. Type
    IC Partner Reference
    Variant Code
    Bin Code
    Qty. per Unit of Measure 1 1
    Planned No No
    Unit of Measure Code STK STK
    Quantity (Base) 1 1
    Outstanding Qty. (Base) 1 1
    Qty. to Invoice (Base) 1 1
    Qty. to Ship (Base) 1 1
    Qty. Shipped Not Invd. (Base) 0 0
    Qty. Shipped (Base) 0 0
    Qty. Invoiced (Base) 0 0
    Reserved Qty. (Base) 0 0
    FA Posting Date
    Depreciation Book Code
    Depr. until FA Posting Date No No
    Duplicate in Depreciation Book
    Use Duplication List No No
    Responsibility Center
    Out-of-Stock Substitution No No
    Substitution Available No No
    Originally Ordered No.
    Originally Ordered Var. Code
    Cross-Reference No.
    Unit of Measure (Cross Ref.)
    Cross-Reference Type
    Cross-Reference Type No.
    Item Category Code
    Nonstock No No
    Purchasing Code
    Product Group Code
    Special Order No No
    Special Order Purchase No.
    Special Order Purch. Line No. 0 0
    Whse. Outstanding Qty. (Base) 0 0
    Completely Shipped No No
    Requested Delivery Date
    Promised Delivery Date
    Shipping Time
    Outbound Whse. Handling Time
    Planned Delivery Date 28.06.2006
    Planned Shipment Date 28.06.2006
    Shipping Agent Code
    Shipping Agent Service Code
    Allow Item Charge Assignment No No
    Qty. to Assign 0 0
    Qty. Assigned 0 0
    Return Qty. to Receive 0 0
    Return Qty. to Receive (Base) 0 0
    Return Qty. Rcd. Not Invd. 0 0
    Ret. Qty. Rcd. Not Invd.(Base) 0 0
    Return Rcd. Not Invd. 0 0
    Return Rcd. Not Invd. (LCY) 0 0
    Return Qty. Received 0 0
    Return Qty. Received (Base) 0 0
    Appl.-from Item Entry 0 0
    Service Contract No.
    Service Order No.
    Service Item No.
    Appl.-to Service Entry 0 0
    Service Item Line No. 0 0
    Serv. Price Adjmt. Gr. Code
    BOM Item No.
    Return Receipt No.
    Return Receipt Line No. 0 0
    Return Reason Code
    Allow Line Disc. No No
    Customer Disc. Group
    VAT Code

    Sorry for so logn list :)
  • David_CoxDavid_Cox Member Posts: 509
    wrong posting
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • alex123alex123 Member Posts: 6
    BlackTiger wrote:
    SalesLine.RESET;
    SalesLine.SETRANGE("Document Type","Document Type");
    SalesLine.SETRANGE("Document No.","No.");
    SalesLine.SETFILTER(SalesLine."Qty. to Ship",'<>0');
    IF SalesLine.FIND('-') THEN … 
    

    Strange code... Line "SalesLine.SETFILTER(SalesLine."Qty. to Ship",'<>0');" isn't original.

    Check values in "Document Type" and "No." fields or filter value for SalesLine. Also... Try to find one more "SalesLine" variable (sound stupid, but possible) in locals/globals. There IS a reason why you have such message.

    Definately something wrong with customizations.

    This is kode form Codeunit 80 OnRun() trigger:
    SalesLine.RESET; 
    SalesLine.SETRANGE("Document Type","Document Type"); 
    SalesLine.SETRANGE("Document No.","No."); 
    SalesLine.SETFILTER(SalesLine."Qty. to Ship",'<>0'); 
    IF SalesLine.FIND('-') THEN
        Cust.CheckBlockedCustOnDocs(Cust,"Document Type",TRUE,TRUE);
    

    And this is standart code.


    I guess problem in my dataport but why standard codeunit 80 sometimes posts lines and sometimes doesn’t :(
    I have doubled checked filters and value and variables.
    In dataport I just put/modify record and validate fileds.

    InitLinjeParam();
    linje := 10000;
    
    //oppretter eller oppdatere salgslinjer
    WITH TLinje DO BEGIN
      INIT;
      VALIDATE("Document Type","Document Type"::Order);
      VALIDATE("Document No.",FORMAT(FormatDig(SCL_Fakturanr)));
      VALIDATE("Line No.",FormatDig(SCL_Linjenr) * linje);
    
      // sjekkes hvis linje er med STK da blir det behandlet som Finanskonto.
      IF DELCHR(FORMAT(SCL_Enhetsbetingelse,5),'=', ' ') = 'STK' THEN BEGIN
        VALIDATE(Type,Type::"G/L Account"); // type Finanskonto
    
        //sjekk MOMS kode iht. oppsett.
        momskode1 := SalesSetup.momskode1;
        momskode2 := SalesSetup.momskode2;
        IF momskode1 = '' THEN momskode1 :='3010';
        IF momskode2 = '' THEN momskode2 :='3110';
        IF SCL_Momskode <>'' THEN BEGIN
           CASE FormatDig(SCL_Momskode) OF
             3: VALIDATE("No.",momskode1);
             4: VALIDATE("No.",momskode2);
           END;
        END;
    
        // Teste hvis finnes FakturaLinje i Navision
        tmpLinje.INIT;
        tmpLinje.SETRANGE("Document Type","Document Type"::Order); 
        tmpLinje.SETFILTER("Document No.",FormatStr(SCL_Fakturanr));
        tmpLinje.SETFILTER("Line No.",FORMAT(FormatDig(SCL_Linjenr) * linje));
    
        IF tmpLinje.FIND('-') THEN
          MODIFY(TRUE)
        ELSE
          INSERT(TRUE);
    
        VALIDATE("Unit of Measure Code",DELCHR(FORMAT(SCL_Enhetsbetingelse,5),'=', ' '));
        VALIDATE("Unit Price",FormatDec(SCL_Pris));
    
        VALIDATE(Quantity,FormatDec(SCL_Antall));
        VALIDATE("Quantity (Base)",FormatDec(SCL_Antall));
        VALIDATE("Outstanding Qty. (Base)",FormatDec(SCL_Antall));
        VALIDATE("Qty. to Invoice (Base)",FormatDec(SCL_Antall));
        VALIDATE("Qty. to Ship (Base)",FormatDec(SCL_Antall));
        VALIDATE("Qty. Shipped Not Invd. (Base)",0);
        VALIDATE("Qty. Shipped (Base)",0);
        VALIDATE("Qty. Invoiced (Base)",0);
        VALIDATE("Qty. per Unit of Measure",1);
    
        VALIDATE(Quantity,FormatDec(SCL_Antall));
    
        VALIDATE("Line Discount %",FormatDec(SCL_Rabattprosent));
        VALIDATE("Line Discount Amount",FormatDec(SCL_Rabattbeloop));
    
      // hvis som tekst
      END ELSE BEGIN
        // Teste hvis finnes FakturaLinje i Navision
        tmpLinje.INIT;
        tmpLinje.SETRANGE(tmpLinje."Document Type","Document Type"::Order);
        tmpLinje.SETFILTER(tmpLinje."Document No.",FormatStr(SCL_Fakturanr));
        tmpLinje.SETFILTER("Line No.",FORMAT(FormatDig(SCL_Linjenr) * linje));
        IF tmpLinje.FIND('-') THEN
          MODIFY(TRUE)
        ELSE
          INSERT(TRUE);
      END;
    
      // håndtere linje beskrivelse og kombinere med vare nummer derfor det finnes.
      IF(FormatCode(SCL_Varenummer) <>'') THEN strVarnummer := 'Varenr.: '
      ELSE  strVarnummer := '';
        IF(FormatCode(SCL_Varebetingelse) <>'') THEN BEGIN
          tmpCode := FormatCode(SCL_Varebetingelse);
          IF STRLEN(tmpCode) <= 50 THEN BEGIN
            EVALUATE(Description,FORMAT( FormatCode(SCL_Varebetingelse),STRLEN(FormatCode(SCL_Varebetingelse)) ));
            EVALUATE("Description 2",FORMAT(  FormatCode(strVarnummer + SCL_Varenummer)) )
          END ELSE BEGIN
            EVALUATE(Description,FORMAT( FormatCode(SCL_Varebetingelse),50));
            EVALUATE("Description 2",FORMAT( FormatCode( strVarnummer+SCL_Varenummer)) );
          END;
      END;
      MODIFY(TRUE);
    
    END;
    
  • alex123alex123 Member Posts: 6
    I am importing also customers and sales head records.
  • ManosAManosA Member Posts: 40
    Do you use Whse handling or Whse Location in any of the items?
Sign In or Register to comment.