Options

Variant Code field in inventory putaway window

Dr_mjhDr_mjh Member Posts: 203
Hi everyone:

The variant code field at the inventory putaway window is not editable when you didn't it fill in the purch. order window, so I made it editable in the object designer but this only solve the editability problem; I mean when I post the document the variant that I add doesn't appear at the ledger entries as I didn't add it in first place which is not true and it is completely weired. So please help me with this! ](*,)

Comments

  • Options
    ara3nara3n Member Posts: 9,255
    The variant field that goes to Item Ledger comes from Purchase/Sales Line not from warehouse documents. you need to write code to update the PO/SO line either during posting, or when the user puts it on putaway document.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    Dr_mjhDr_mjh Member Posts: 203
    Thank you very much, but what is the code unit responsible for such posting process?
  • Options
    krikikriki Member, Moderator Posts: 9,090
    Purchase orders, invoices, return orders, credit memos are posted with codeunit 90.
    Warehouse receipts are posted with codeunit 5761 or 5762 that calls codeunit 5760. This last codeunit calls codeunit 90 for each purchase order it finds (C80 for sales return orders ; C5705 for receipt of transfer)
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Dr_mjhDr_mjh Member Posts: 203
    are you sure about the code unit? because i tried them but it didn't work. ](*,)
  • Options
    Dr_mjhDr_mjh Member Posts: 203
    I mean that the code unit 5760 is not reflected in the item ledger entries which means that any change in the variant code is not reflected there. So I would really appreciate it if you provide me with the function that make this possible. And thanks for everyone who helped and still helping and will help me in this issue.
  • Options
    krikikriki Member, Moderator Posts: 9,090
    Copied from C5760 form Navision 3.10A
    InitSourceDocument()
    WITH WhseActivLine DO BEGIN
      CASE "Source Type" OF
        DATABASE::"Purchase Line":
          BEGIN
            PurchHeader.GET("Source Subtype","Source No.");
            PurchLine.SETRANGE("Document Type","Source Subtype");
            PurchLine.SETRANGE("Document No.","Source No.");
            IF PurchLine.FIND('-') THEN
              REPEAT
                PurchLine.VALIDATE("Qty. to Receive",0);
                PurchLine.VALIDATE("Qty. to Invoice",0);
    //-TRY THIS :START
                PurchLine."Variant Code" := "Variant Code";
                // it is possible you have to change other fields in T39
                // I didn't try out the code, but this is the place I would try to start
    //-TRY THIS :STOP
                PurchLine.MODIFY;
                IF PurchLine."Item Tracking No." <> 0 THEN BEGIN
                  SourceItemTrkgLine.SETRANGE("Item Tracking No.",PurchLine."Item Tracking No.");
                  IF SourceItemTrkgLine.FIND('-') THEN
                    REPEAT
                      SourceItemTrkgLine.VALIDATE("Qty. to Ship/Receive",0);
                      SourceItemTrkgLine.VALIDATE("Qty. to Invoice",0);
                      SourceItemTrkgLine.MODIFY;
                    UNTIL SourceItemTrkgLine.NEXT = 0;
                END;
              UNTIL PurchLine.NEXT = 0;
          END;
    
    [/quote]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    Dr_mjhDr_mjh Member Posts: 203
    Thank you for your cooperation kriki, but this function is not available on Navision 4.0, so Iwould really appreciate it if someone could tell where can I do this in Navision 4.0. [-o<
  • Options
    Dr_mjhDr_mjh Member Posts: 203
    up
  • Options
    shafeaashafeaa Member Posts: 54
    up up up
  • Options
    krikikriki Member, Moderator Posts: 9,090
    I checked 4.0 and I think it is here:
    Still in codeunit 5760
    InitSourceDocumentLines(VAR WhseRcptLine : Record "Warehouse Receipt Line")
    WhseRcptLine2.COPY(WhseRcptLine);
    WITH WhseRcptLine2 DO BEGIN
      CASE "Source Type" OF
        DATABASE::"Purchase Line":
          BEGIN
            PurchLine.SETRANGE("Document Type","Source Subtype");
            PurchLine.SETRANGE("Document No.","Source No.");
            IF PurchLine.FIND('-') THEN
              REPEAT
                SETRANGE("Source Line No.",PurchLine."Line No.");
                IF FIND('-') THEN
                  IF "Source Document" = "Source Document"::"Purchase Order" THEN BEGIN
                    ModifyLine := PurchLine."Qty. to Receive" <> "Qty. to Receive";
                    IF ModifyLine THEN
                      PurchLine.VALIDATE("Qty. to Receive","Qty. to Receive")
                  END ELSE BEGIN
                    ModifyLine := PurchLine."Return Qty. to Ship" <> -"Qty. to Receive";
                    IF ModifyLine THEN
                      PurchLine.VALIDATE("Return Qty. to Ship",-"Qty. to Receive");
                  END
                ELSE
                  IF "Source Document" = "Source Document"::"Purchase Order" THEN BEGIN
                    ModifyLine := PurchLine."Qty. to Receive" <> 0;
                    IF ModifyLine THEN
                      PurchLine.VALIDATE("Qty. to Receive",0);
                  END ELSE BEGIN
                    ModifyLine := PurchLine."Return Qty. to Ship" <> 0;
                    IF ModifyLine THEN
                      PurchLine.VALIDATE("Return Qty. to Ship",0);
                  END;
                IF PurchLine."Bin Code" <> "Bin Code" THEN BEGIN
                  PurchLine."Bin Code" := "Bin Code";
                  ModifyLine := TRUE;
                END;
    
    //-TRY THIS :START
                ModifyLine := TRUE;
                PurchLine."Variant Code" := "Variant Code";
                // it is possible you have to change other fields in T39
                // I didn't try out the code, but this is the place I would try to start
    //-TRY THIS :STOP
    
                IF ModifyLine THEN
                  PurchLine.MODIFY;
              UNTIL PurchLine.NEXT = 0;
          END;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.