Skip to Content
0

Stored Procedure to block MRN Qty >= PO Openqty

May 31, 2017 at 01:23 PM

37

avatar image
Former Member

Dear Wael,

I wrote a SP to block Goods Receipt PO where GRPO qty should not more than Purchase Order Open qty. It was executed successfully.

But when I pass the entry for condition GRPO Qty = PO OpenqtySP triggered and blocking the entry. below is my stored procedure.

--Additional Validation for MRN Qty > PO Qty.


IF :object_type = '20' and (:transaction_type='A') then

SELECT PDN1."Quantity" into mrnqty FROM PDN1 WHERE PDN1."DocEntry" = :list_of_cols_val_tab_del;
SELECT IFNULL (POR1."OpenQty", 0) into poqty FROM POR1 LEFT JOIN PDN1 ON PDN1."BaseEntry"= POR1."DocEntry"
WHERE PDN1."ItemCode"=POR1."ItemCode" AND PDN1."BaseLine"=POR1."LineNum" AND PDN1."DocEntry" = :list_of_cols_val_tab_del;
IF :mrnqty > :poqty then
error := -002;
error_message := 'GRPO Qty should not be more than PO Qty';
END IF;

End IF;

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers