Sales Line updated accordingly when new location code is pic

liizzliizz Member Posts: 125
Hi all,

I have created a new Sales Return Order for a particular Sell-To-Customer No. and I have done Functions->Get Posted Document Lines to Reverse.

On the Sales Header part, I have picked up a location code(BLUE) but I want to update the Sales Lines accordingly without doing it manually. Is there a way to bypass the standard logic of the code?

Please help.

Thanks

Liizz

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    When you use Get Posted Document Lines to reserve function, it will update sales return order lines location code with posted order location code only..not the header location code..which is correct as per busuiness scenario..

    How can you return from blue location when it is posted from red location?
  • liizzliizz Member Posts: 125
    Thanks Mohana

    But if I have changed the location code to GREEN on the Sales Header.

    I will get this warning message:
    You have changed Location Code on the sales header, but it has not been changed on the existing sales lines. You must update the existing sales lines manually. Lets say for an item where location is BLUE

    I do not want to go through this warning message and update it manually but want it to populate directly the location code that has been selected on the Sales Header.

    Is it possible to do so?

    Thanks
    Liizz
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    You have to very clear on the effect of this change..

    You have to write below code in Tabel 36 Location Code - OnValidate() trigger
    IF ("Location Code" <> xRec."Location Code") THEN BEGIN
      SalesLine.RESET;
      SalesLine.SETRANGE("Document Type","Document Type");
      SalesLine.SETRANGE("Document No.","No.");
      IF SalesLine.FINDSET THEN
        REPEAT
          IF SalesLine.Type <> SalesLine.Type::"" THEN BEGIN
            SalesLine.VALIDATE("Location Code","Location Code");
            SalesLine.MODIFY(TRUE);
          END;
        UNTIL SalesLine.NEXT=0;
    END;
    

    Comment out below code in same trigger

    IF ("Location Code" <> xRec."Location Code") AND
       (xRec."Sell-to Customer No." = "Sell-to Customer No.")
    THEN
      MessageIfSalesLinesExist(FIELDCAPTION("Location Code"));
    
  • liizzliizz Member Posts: 125
    Thanks Mohana.

    Is it a good practice to do so? Bypass the standard logic.

    Thanks

    Liizz
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    liizz wrote:
    Is it a good practice to do so? Bypass the standard logic.
    You have to very clear on the effect of this change..
Sign In or Register to comment.