Hi Experts,
I have an approval for sales orders orders where a Sales order for a Business partner belonging to a certain division( this is UDF in OCRD) are approved by a certain manager.
The approval for sales order works fine, but now I want the same manager that approved the sales order to approve a purchase order raised from the sales order where the purchase order is created from the Procurement Confirmation wizard.
Below is a query I used for the sales order approval:
DECLARE @Type as varchar(5)
DECLARE @BP as varchar(20)
set @Type = (select $[ORDR.Doctype])
set @BP = (SELECT OCRD.U_Division
FROM OCRD
WHERE
OCRD.CardCode = $[ORDR.CardCode])
IF @Type = 'I' and (@BP = 1)
BEGIN
SELECT 'TRUE'
END
I am using this query for my PO approval but is not working:
DECLARE @Type as varchar(5)
DECLARE @BP as varchar(20)
DECLARE @SODOC as varchar (20)
set @Type = (select $[OPOR.Doctype])
set @BP = (SELECT OCRD.U_Division
FROM OCRD INNER JOIN ORDR ON OCRD.CARDCODE = ORDR.CARDCODE
INNER JOIN RDR1 ON ORDR.DOCENTRY = RDR1.DOCENTRY INNER JOIN POR1 ON RDR1.DOCENTRY = POR1.BaseEntry
WHERE
OCRD.CardCode = $[ORDR.CardCode])
RDR1.DOCENTRY = POR1.BaseEntry
IF @Type = 'I' and (@BP = 1) and ISNULL($[$38.43.0],0) = '17'
SELECT 'TRUE' ELSE SELECT 'FALSE'
Please help.
Aubrey