Tracking specification Purchase order

RikarddoRikarddo Posts: 64Member

I'm trying to implement a code that calculates on the tracking specification table the expiration date automatically.

This is the procedure.

Select a line of purche order, go to item tracking lines page( tracking specification table) . Assign a random lot, and fill up that information. On close that page it should calculate the expiration date with

the production order before imputed.
item.GET("Item No.");
LotNoInformation.SETRANGE("Item No.","Item No.");
LotNoInformation.SETRANGE("Lot No.","Lot No.");
IF LotNoInformation.FIND('-') THEN 
 IF FORMAT(item."Expiration Calculation")<>'' THEN
  expdatetemp:=CALCDATE(item."Expiration Calculation",LotNoInformation."Production Date");

But it gives me an error "the tracking specification does not exist mov. nº 0"

Please some help, or if there is another way to calculate that field

Thanks in advance


  • vaprogvaprog Posts: 948Member

    Where did you add your code?
    expdatetemp appears to be a variable; TrackingSpecification is not assigned to.

    Have you considered to do your modification in the same place as the standard functionality using item."Expiration Calculation", which is (mainly) Table 83 Item Journal Line?
  • RikarddoRikarddo Posts: 64Member
    To create a new lot i have to attribute new lot, then open page 6508, and create new lot in page 6505.
    I'm adding the code on trigger close page of 6508.
  • vaprogvaprog Posts: 948Member

    check out the WriteToDatabase functions and you'll realize it is not as straight forward to do this as you might have thought.
Sign In or Register to comment.