Printing slip just afer posting an order

JTProJTPro Member Posts: 169
Hello all,

I put some code inside the codeunit 81 (Sales Post Yes/No), that suppose to print slip based on "Last posting no.". I don't know why I have following error:

Sales Header doesn't exist
Identification field and values:
Document type = 'Order', No. = 'C06/00045'
Document type =Order, No. = C06/00045

The document is posted properly, but slip is not send to the printer.

I saw posts, that say about this issue, but without any solution.

Thanks in advance for your responses.

Best regards
JTPro
Navision Application Version: 4.0SP1
Navision Database Version: 4.0

Comments

  • mukesvemukesve Member Posts: 28
    Hi

    The sales header is deleted in teh CU80 so the report can not be printed in CU81.

    You should write your code in CU80 -> OnRun trigger

    write the code before any deletion code is exceuted. Probably before the following Standard Code-


    // Modify/delete sales header and sales lines
    IF NOT RECORDLEVELLOCKING THEN BEGIN
    IF WhseReceive THEN
    WhseRcptLine.LOCKTABLE(TRUE,TRUE);
    IF WhseShip THEN
    WhseShptLine.LOCKTABLE(TRUE,TRUE);
    IF DropShipOrder THEN BEGIN
    PurchOrderLine.LOCKTABLE(TRUE,TRUE);
    PurchOrderHeader.LOCKTABLE(TRUE,TRUE);
    END;


    I hope this will work

    Best Regards
    Mukesh :D
  • Alex_ChowAlex_Chow Member Posts: 5,063
    JTPro wrote:
    Hello all,

    I put some code inside the codeunit 81 (Sales Post Yes/No), that suppose to print slip based on "Last posting no.". I don't know why I have following error:

    Sales Header doesn't exist
    Identification field and values:
    Document type = 'Order', No. = 'C06/00045'
    Document type =Order, No. = C06/00045

    The document is posted properly, but slip is not send to the printer.

    I saw posts, that say about this issue, but without any solution.

    Thanks in advance for your responses.

    Best regards
    JTPro

    It depends on where you put the code. But based on your problem, it looks like you're putting the code after it has gone through the posting routine.

    In this case, you can either:
    1. Put the code before the posting routine is ran
    2. Modify the report to use the Sales Invoice Header table instead of the Sales Header table.
  • kinekine Member Posts: 12,562
    1) You are talking about "Last posting no." - this is No. of the invoice. But when I see the error, you are working with the order... are you sure that you are not mixing two things together???
    2) And yes, as mukesve and deadlizard wrote, the sales header if all is posted, is deleted after posting (you can find the DELETE; function in the CU80 near the end of the main function...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • JTProJTPro Member Posts: 169
    Thanks for your responses.

    I'm using "Last posting No." to get information form Sales Invoice Header, and use it to print a slip. The strange think is that the message shows that there is a problem with table Sales Header? ](*,)

    I don't really know what is wrong.

    And another strange thing is that my modification works once a while. Mhm

    Any idea? Navision bug?

    Navision version: 4.00 Sp2

    Best regards
    JTPro
    Navision Application Version: 4.0SP1
    Navision Database Version: 4.0
  • ssinglassingla Member Posts: 2,973
    Dear Friend,

    This is not a bug.

    Explanation:
    No. series is attached on the sales header based on which the last number is updated in the no. series line.
    The sales header and lines are deleted on posting of the sales invoice (invoice option) and 100% sales invoice and shipment (sales order option) and the transactions are posted in Sales Invoice Header/line and Sale Shipment header/line table. Therefore the system does not find any record in the sales order header/line table.

    Sales Invoice header has fields "Order No." , "Pre Assined No." which can be used to get the purchase order/invoice number at the time of creation.


    ihope it makes clear.
    CA Sandeep Singla
    http://ssdynamics.co.in
  • kinekine Member Posts: 12,562
    You can use debugger to find the code, where the error arise from. Than you can check, if you are correctly reading the data, if you really want to get order header or just invoice header...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Why not just modify your report to go off of the sales invoice header table and add this report to the Report Selections table? :-k
  • welanderwelander Member Posts: 20
    I'm aware that this is an old threat but I’m not sure the problem is that simple.

    I get the same error with a customer running NAV 3.70 but in my example none of the above could be the reason because:

    There is no modification to the posting routines. So it is not because I cal some code after deleting Sales Header in codeunit 80.

    The Sales Header table is not used in any of the reports printed during Poste Print. (It’s basically the Sales – Invoice report, the Sales – shipment report and a label report from the Report Selections table)

    But there is some other strange subjects:

    The customer has run with this setup for years with no problem, there is so far only one workstation where the error occurs and it began after re installation of the NAV Client.

    The Sales Header which doesn't exist is not the sales Header there is about to be posted but it refers to a Sales Order which is deleted.

    The order is posted but not printed.

    The error dos not always occur but I have not so far find out in which conditions it appears.

    The debugger dos not give me anything. It stops in the:


    IF NOT ShowInternalInfo THEN
    CurrReport.BREAK;

    In the dimension loop data item. (Standard NAV) where ShowInternalInfo is a boolean constant always FALSE in this case.

    Best Regards
    Lars W Hald
  • kinekine Member Posts: 12,562
    Check the Document Dimension table for dimensions for the deleted order. It seems that some lines in this table are reffering deleted record and thus leading to this error.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • EugeneEugene Member Posts: 309
    We used to have identical report copies printing from Sales Header then from Invoiced version and then the same from ledgers...

    final solution was to create a separate table that tells the system that there is data to be printed ( no matter where it came from ) and then print it at any moment it is convinient for the user to print or/and to reprint it
Sign In or Register to comment.