Tuesday, April 22, 2008

Find component link in PeopleSoft Applications for a given record or Page Name

Run following in SQL Database

/*********************************************************************/
/* This SQL can be used to find out were a page or a component */
/* is registered. */
/* IMPORTANT: This script is intended to run on MSSQL Server Only */
/* Written by Daniel Beaulne 01/23/2002 */
/*********************************************************************/
SET NOCOUNT ON
declare @PortalName as CHAR(50)
declare @ParentObjName as CHAR(50)
declare @PageName as CHAR(50)
declare @ComponentName as CHAR(50)
declare @MenuName as CHAR(50)
declare @ObjName as CHAR(50)
declare @ObjLabel as CHAR(100)
declare @Path as char(1000)
declare @Path2 as char(1000)
declare @PortalURL as char(1000)
declare @SiteURL as char(200)
DECLARE @PRICE_SET_ID CHAR(10)
declare @WhereStr char(100)
declare @Market as CHAR(10)
/*---------------------------------------------------------------*/
/* Change the value for the following variables. */
/* Site: Enter the base URL for your site. */
/* Page/Component: Enter one or the other to find its references.*/
/* IF a pagename is entered, the componentname is ignored */
/*---------------------------------------------------------------*/
set @SiteURL = 'http://localhost/psp/ps/?cmd=login' /* for example http://dbeaulne110599/psp/ps' */
set @PageName = 'SAD_TEST_SCTY'
set @ComponentName ='ORGANIZATIONS'
/*-----------------------------------------------------------*/

if @PageName <> ''
begin
DECLARE PageCursor CURSOR FOR
SELECT M.MENUNAME, M.PNLGRPNAME, M.MARKET
FROM PSPNLGROUP PG, PSMENUITEM M
WHERE PG.PNLNAME = @PageName
AND PG.PNLGRPNAME = M.PNLGRPNAME
print 'Navigation for page ' + @PageName
print ' '
end
else
begin
DECLARE PageCursor CURSOR FOR
SELECT DISTINCT M.MENUNAME, M.PNLGRPNAME, M.MARKET
FROM PSPNLGROUP PG, PSMENUITEM M
WHERE PG.PNLGRPNAME = @ComponentName
AND PG.PNLGRPNAME = M.PNLGRPNAME
print 'Navigation for component ' + @ComponentName
print ' '

end
OPEN PageCursor

FETCH NEXT FROM PageCursor INTO @MenuName, @ComponentName, @Market
WHILE @@FETCH_STATUS = 0
BEGIN
if rtrim(@ComponentName) <> ''
begin
DECLARE ComponentCursor CURSOR FOR
SELECT PORTAL_NAME, PORTAL_PRNTOBJNAME, PORTAL_OBJNAME, PORTAL_LABEL, '/' + rtrim(PORTAL_NAME) + '/' + rtrim(PORTAL_CNTPRV_NAM) + '/' + cast(PORTAL_URLTEXT as char(1000))
FROM PSPRSMDEFN
WHERE PORTAL_URLTEXT like '%/' + rtrim(@MenuName) + '.' + rtrim(@ComponentName) + '.' + rtrim(@Market) +'%'
and PORTAL_REFTYPE = 'C'
OPEN ComponentCursor

FETCH NEXT FROM ComponentCursor INTO @PortalName, @ParentObjName, @ObjName, @ObjLabel, @PortalURL

while @@FETCH_STATUS = 0
begin
SET @Path = @ObjLabel
SET @Path2 = @ObjName
SET @ObjName = @ParentObjName

while @ObjName <> ' '
BEGIN
select @ObjLabel = PORTAL_LABEL, @ParentObjName = PORTAL_PRNTOBJNAME from PSPRSMDEFN where PORTAL_NAME = @PortalName AND PORTAL_OBJNAME = @ObjName
SET @Path = rtrim(@ObjLabel) + ' --> ' + @Path
SET @Path2 = rtrim(@ObjName) + ' --> ' + @Path2
SET @ObjName = @ParentObjName
END
PRINT '---------------------------------------------------------------------------------------------------------------'
PRINT 'Menu : ' + @MenuName
PRINT ' '
PRINT 'Component : ' + @ComponentName
PRINT ' '
PRINT 'Market : ' + @Market
PRINT ' '
PRINT 'Portal : ' + @PortalName
PRINT ' '
PRINT 'Navigation : ' + @Path
PRINT ' '
PRINT 'CREF : ' + @Path2
PRINT ' '
PRINT 'URL : ' + rtrim(@SiteURL) + rtrim(@PortalURL)
PRINT '---------------------------------------------------------------------------------------------------------------'
PRINT ' '
PRINT ' '
FETCH NEXT FROM ComponentCursor INTO @PortalName, @ParentObjName, @ObjName, @ObjLabel, @PortalURL
end
CLOSE ComponentCursor
DEALLOCATE ComponentCursor
end
FETCH NEXT FROM PageCursor INTO @MenuName, @ComponentName, @Market
end
CLOSE PageCursor
DEALLOCATE PageCursor

No comments:

Post a Comment