'Unshipping' a Resource

jsny355jsny355 Member Posts: 4
Good afternoon - We currently use the Resource Functionality to create a line item on our Sales Orders for Freight which we bill a customer. At times, for a variety of reasons, we wish to unship a sales order. However, the system will not allow us and errors out stating that we cannot 'unship' a resource. Similarly, we cannot 'unreceive' a resource. Is there a workaround for this or can anyone help? Perhaps Resource is not the best way to do this? We were using this and the associated programming of the resource and posting groups so that users wouldnt have to (or be able to) select a GL Account.

Thanks in advance!

Comments

  • ara3nara3n Member Posts: 9,256
    Unshipping was implemented in 5.x version and they didn't do a good job of implementing it. They basically took shortcuts. I suggest to contact your partner and ask them to change the code to allow undo shipment with resource. You would run into same issue with gl type lines.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • MarkHamblinMarkHamblin Member Posts: 118
    The code changes are very simple (maybe 6 lines of code) - we've done this a few times. Code below is for NAV 5 in codeunit 5815 (anything tagged with <DMS> needs to be added - there are no lines to delete):
    OnRun(VAR Rec : Record "Sales Shipment Line")
      IF FALSE THEN BEGIN //<DMS author="MH" date="1/17/2011" issue="254" />
    
      SETRANGE(Type,Type::Item);
      IF NOT FIND('-') THEN
        ERROR(Text006);
    
      END;//<DMS author="MH" date="1/17/2011" issue="254" />
    
    
    CheckSalesShptLine(SalesShptLine : Record "Sales Shipment Line")
      WITH SalesShptLine DO BEGIN
        IF FALSE THEN //<DMS author="MH" date="1/17/2011" issue="254" />
        TESTFIELD(Type,Type::Item);
    
        IF "Qty. Shipped Not Invoiced" <> Quantity THEN
          ERROR(Text005);
        TESTFIELD("Drop Shipment",FALSE);
    
        UndoPostingMgt.TestSalesShptLine(SalesShptLine);
    
        IF Type=Type::Item THEN BEGIN //<DMS author="MH" date="1/17/2011" issue="254" />
          UndoPostingMgt.CollectItemLedgEntries(TempItemLedgEntry,DATABASE::"Sales Shipment Line",
            "Document No.","Line No.","Quantity (Base)","Item Shpt. Entry No.");
          UndoPostingMgt.CheckItemLedgEntries(TempItemLedgEntry,"Line No.");
        //<DMS author="M.Hamblin" date="1/17/2011" issue="254" >
        END ELSE BEGIN
          TempItemLedgEntry.RESET;
          TempItemLedgEntry.DELETEALL;
        END;//if
        //</DMS>
      END;
    
    PostItemJnlLine(SalesShptLine : Record "Sales Shipment Line";VAR DocLineNo : Integer) : Integer
      WITH SalesShptLine DO BEGIN
        SalesShptLine2.SETRANGE("Document No.","Document No.");
        SalesShptLine2."Document No." := "Document No.";
        SalesShptLine2."Line No." := "Line No.";
        SalesShptLine2.FIND('=');
    
        IF SalesShptLine2.FIND('>') THEN BEGIN
          LineSpacing := (SalesShptLine2."Line No." - "Line No.") DIV 2;
          IF LineSpacing = 0 THEN
            ERROR(Text002);
        END ELSE
          LineSpacing := 10000;
        DocLineNo := "Line No." + LineSpacing;
    
        //<DMS author="M.Hamblin" date="1/17/2011" issue="254" >
        IF Type<>Type::Item THEN
          EXIT(0);
        //</DMS>
    
        ...
    

    Of course, make sure you test to ensure these changes work in your database (and that I copied and pasted everything properly ;) ).
Sign In or Register to comment.