Sales Shipment Header - OnAfterGetRecord() Location.RESET; Location.SETRANGE(Code,"Sales Shipment Header"."Location Code"); IF Location.FIND('-') THEN loc:=Location."Post Code"; DistanciaEntrega.RESET; DistanciaEntrega.SETRANGE(DistanciaEntrega."No.", "Sales Shipment Header"."Sell-to Customer No."); DistanciaEntrega.SETRANGE("Cod. Origem",loc); DistanciaEntrega.SETRANGE("Cod. Entrega","Sales Shipment Header"."Ship-to Post Code"); IF DistanciaEntrega.FIND('-') THEN SalesShipmentLine.RESET; SalesShipmentLine.SETRANGE("Document No.","Sales Shipment Header"."No."); SalesShipmentLine.SETRANGE("Sell-to Customer No.","Sales Shipment Header"."Sell-to Customer No."); SalesShipmentLine.SETRANGE(Type,SalesShipmentLine.Type::Item); SalesShipmentLine.SETFILTER("No.",'<>%1',''); SalesShipmentLine.SETRANGE("Item Container",FALSE); IF SalesShipmentLine.FINDSET THEN REPEAT SalesShipmentLine.Distance:=DistanciaEntrega.Distance; SalesShipmentLine.MODIFY; UNTIL SalesShipmentLine.NEXT=0;
Comments
But, to the point of the issue, have you tried stepping through the code with the debugger? That would be my next move.
One more suggestion. If you are going to edit a record, it is better to use
FINDSET(TRUE, FALSE) so that it is locked. What you are doing works, but is not optimal.
It solved my problem. Thanks a lot!
Just didn't understood the FINDSET(True,False) part.