BenD
4Penny.net
Points: 7734

7/1/2017 4:03:35 PM

ddf_CommaSeparatedPOs

* This article, and all our great SQL (Dynamics) documentation, Is available on the SQL (Dynamics) menu

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

4Penny.net
Version: All
Section: SQL Scripts
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
Please leave a comment

Add a Comment



Not Subscribed. You will not receive emails on article changes or comment additions

Comments

body header
No records to display.
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3