ddf_CommaSeparatedPOs

This is a function that returns the POs that are associated with a Payables document. 

The use of the function is demonstrated here http://dyndeveloper.com/ArticleView.aspx?ArticleID=1689

IF OBJECT_ID (N'dbo.ddf_CommaSeparatedPOs') IS NOT NULL
   DROP FUNCTION dbo.ddf_CommaSeparatedPOs
GO
   
CREATE FUNCTION dbo.ddf_CommaSeparatedPOs (@vendorid varchar(15), @docnumbr varchar(21))
--  select dbo.ddf_CommaSeparatedPOs('ASSOCIAT0001','445')
                       
RETURNS varchar(max)
   
AS
 
 
BEGIN
    declare @PO as varchar(max)
    select distinct @PO = coalesce(@PO + ',','') + rtrim(rl.PONUMBER)
        from pop30300 rh
            join pop30310 rl on rl.POPRCTNM = rh.POPRCTNM
        where rh.VENDORID = @vendorid and rh.VNDDOCNM = @docnumbr
   
    return @PO 
END
 
GO

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences