PO Approval - 5.0

MiniMini Member Posts: 17
Hi I was exploring PO Approval(Document Approval) in 5.0 and facing some problems.
In Approavl Template - If I set the Limit Type::"Appoval Limits" and
In User Setup - 'Not Unlimited Purhcase Approval' and 'Purchase Amount Approval Limit'= 100.

Now If I create the PO for amount = 200 and send for approval the system is stuck for sometimes and finally got the error message - Insufficient memory stack.
The Nav code written is like that -

Function - FindApproverPurchase:
AppTemplate."Approval Type"::"Sales Pers./Purchaser": BEGIN
IF PurchaseHeader."Purchaser Code" <> '' THEN BEGIN
CASE AppTemplate."Limit Type" OF
AppTemplate."Limit Type"::"Approval Limits": BEGIN
UserSetup.SETCURRENTKEY("Salespers./Purch. Code");
UserSetup.SETRANGE("Salespers./Purch. Code",PurchaseHeader."Purchaser Code");
IF NOT UserSetup.FIND('-') THEN
ERROR(Text008,UserSetup."User ID",UserSetup.FIELDCAPTION("Salespers./Purch. Code"),
UserSetup."Salespers./Purch. Code")
ELSE BEGIN
ApproverId := UserSetup."User ID";
MakeApprovalEntry(
DATABASE::"Purchase Header",PurchaseHeader."Document Type",PurchaseHeader."No.",PurchaseHeader."Purchaser Code",
ApprovalSetup,ApproverId,AppTemplate."Approval Code",UserSetup,ApprovalAmount,ApprovalAmountLCY,
PurchaseHeader."Currency Code",AppTemplate,0);
ApproverId := UserSetup."Approver ID";
IF NOT UserSetup."Unlimited Purchase Approval" AND
(ApprovalAmountLCY > UserSetup."Purchase Amount Approval Limit")
THEN BEGIN
UserSetup.RESET;
UserSetup.SETCURRENTKEY("User ID");
UserSetup.SETRANGE("User ID",ApproverId);
REPEAT
IF NOT UserSetup.FIND('-') THEN
ERROR(Text006,ApproverId);
ApproverId := UserSetup."User ID";
MakeApprovalEntry(
DATABASE::"Purchase Header",PurchaseHeader."Document Type",PurchaseHeader."No.",'',
ApprovalSetup,ApproverId,AppTemplate."Approval Code",UserSetup,ApprovalAmount,ApprovalAmountLCY,
PurchaseHeader."Currency Code",AppTemplate,0);
UserSetup.SETRANGE("User ID",UserSetup."Approver ID");
UNTIL UserSetup."Unlimited Purchase Approval" OR
(ApprovalAmountLCY <= UserSetup."Purchase Amount Approval Limit") OR
(UserSetup."User ID" = UserSetup."Approver ID")
END;
END;



Plese let me know if anybody has an idea on this issue.
Your help will be highly appriciated.

Thanks and Regards
Mini
Sign In or Register to comment.