Calculate planning filter not working

Hi all,

I am struggling with what appears to be simple but I somehow can't get past the error. Basically I want to calculate demand based on sales orders and if the planning worksheet already contains the SOs then skip it, else mark it for later processing. I have the following code to check for this condition:

ReqLine.RESET;
ReqLine.SETCURRENTKEY("Journal Batch Name","Sales Order No.","Sales Order Line No.");
ReqLine.SETRANGE("Journal Batch Name",ReqLine."Journal Batch Name");
ReqLine.SETFILTER("Sales Order No.",'%1',SHeaderOrderDate."No.");
ReqLine.SETFILTER("Sales Order Line No.",'%1', SLine."Line No.");
IF NOT (ReqLine.FINDFIRST) THEN
SLine.MARK(TRUE);

No matter what the error keeps on coming up stating that Line # so and so already exists. Yes, duh, I knew that. But my code is saying if not found then mark it. Why do I get an error on the IF NOT (ReqLine.FINDFIRST) THEN statement? Can someone please explain to me?

I also tried the opposite direction, whereas my filters would be '<>%1' then IF (ReqLine.FINDFIRST) THEN and either way I get the same exact error. Appreciate your guidance.

MisConsultng

Best Answers

Answers

Sign In or Register to comment.