Archive for the ‘SQL’ category

Auditing Journal Post in PS9.0

February 11th, 2010

In every GL implementation I’ve been involved with, auditors or managers always ask for the ability to audit who posted their own journal entries. Unfortunately PeopleSoft doesn’t provide the means to do this very easily, so I’ve written a couple of queries that you can use to build a report or a view that satisfies this requirement.

The first query is only valid if you’ve disallowed users from On-Demand Posting journals (the “Journal Post” option in the drop-down box on the JE Lines screen). If you disable this process, users have to utilize the batch journal post process. Here is the SQL:

SELECT A.OPRID, B.BUSINESS_UNIT, B.JOURNAL_ID, B.JOURNAL_DATE, B.DESCR
	FROM PS_JRNL_POST_REQ A, PS_JRNL_HEADER B
	WHERE A.OPRID = B.OPRID
		AND B.BUSINESS_UNIT = A.BUSINESS_UNIT;

The second query is valid if you haven’t restricted On-Demand Posting of journal entries. It’s a bit tricky, so stay with me:

SELECT A.BUSINESS_UNIT, A.JOURNAL_ID, A.JOURNAL_DATE, A.DESCR, A.OPRID,
	A.POSTED_DATE, A.PROCESS_INSTANCE, B.JOBID, B.PROGRAM_NAME,
	C.MESSAGE_PARM
  FROM PS_JRNL_HEADER A, PS_MESSAGE_LOG B, PS_MESSAGE_LOGPARM C
  WHERE B.PROCESS_INSTANCE = A.PROCESS_INSTANCE
    AND B.PROCESS_INSTANCE = C.PROCESS_INSTANCE
    AND B.MESSAGE_SEQ = C.MESSAGE_SEQ
    AND C.MESSAGE_SEQ = 2
    AND C.PARM_SEQ = 2
    AND A.OPRID = C.MESSAGE_PARM
    AND B.PROGRAM_NAME LIKE 'GLPP%'
  ORDER BY A.BUSINESS_UNIT, A.JOURNAL_ID, A.JOURNAL_DATE;

I’ve heard that PeopleSoft 9.1 provides this ability as delivered, but haven’t seen it yet. I’ll update this post once I verify the feature is available. Happy querying!

Share and Enjoy:
  • PDF
  • Print
  • email
  • Twitter
  • Facebook
  • LinkedIn
  • RSS
  • Tumblr
  • Google Bookmarks
  • Netvibes

PeopleSoft Trees via SQL

January 21st, 2010

I need to export (using SQL) a PeopleSoft tree – showing all Tree Nodes and Leafs from the Top of the tree all the way down. levels are not used on the tree I am trying to retrieve. Can someone please help – it would be much appreciated!

Here is the SQL I use to get the Parent Node, Node, Detail Value (Leaf), and Level from trees in PeopleSoft via SQL:

Note: Click View Plain in the codeblock below to see all the SQL correctly. I’m working on my current WP theme to get it to quit interfering with my syntax highlighter.

SELECT PSTREENODE.SETID,
  PSTREENODE.TREE_NAME,
  PSTREENODE.EFFDT,
  PARENT_NODE_NAME AS PARENTNODE,
  TREE_NODE        AS NODENAME,
  TREE_NODE        AS TREENODE,
  TREE_LEVEL_NUM,
  TREE_NODE_NUM
FROM PSTREENODE
  --- REPLACE WITH YOUR SETID
WHERE PSTREENODE.SETID = 'SHARE'
  --- REPLACE WITH YOUR TREE NAME
AND TREE_NAME = 'ACCOUNT'
  --- REPLACE WITH YOUR TREE EFFECTIVE DATE
AND EFFDT = TO_DATE('01011900','MMDDYYYY')
UNION ALL
--- REPLACE WITH YOUR SETID
SELECT 'SHARE',
  N.TREE_NAME,
  --- REPLACE WITH YOUR TREE EFFECTIVE DATE
  TO_DATE('01011900','MMDDYYYY'),
  N.TREE_NODE AS PARENTNODE,
  A.DESCR     AS NODENAME,
  --- REPLACE A.ACCOUNT WITH A.your_chartfield
  A.ACCOUNT AS TREENODE,
  TREE_LEVEL_NUM,
  N.TREE_NODE_NUM
FROM PSTREENODE N
INNER JOIN PSTREELEAF L
ON N.SETID      = L.SETID
AND N.TREE_NAME = L.TREE_NAME
  --- REPLACE WITH YOUR SETID
AND N.SETID = 'SHARE'
  --- REPLACE WITH YOUR TREE NAME
AND N.TREE_NAME = 'ACCOUNT'
  --- REPLACE WITH YOUR TREE EFFECTIVE DATE
AND N.EFFDT         = TO_DATE('01011900','MMDDYYYY')
AND N.EFFDT         = L.EFFDT
AND N.TREE_NODE_NUM = L.TREE_NODE_NUM
  --- REPLACE TABLE WITH LOOKUP TABLE FOR YOUR chartfield
INNER JOIN PS_GL_ACCOUNT_TBL A
  --- REPLACE A.ACCOUNT WITH A.your_chartfield
ON A.ACCOUNT >= L.RANGE_FROM
  --- REPLACE A.ACCOUNT WITH A.your_chartfield
AND A.ACCOUNT <= L.RANGE_TO
  --- REPLACE WITH YOUR SETID
AND L.SETID = 'SHARE'
ORDER BY TREE_NODE_NUM,
  TREE_LEVEL_NUM,
  TREENODE;

Remember to read the comments on each line to see where and what you need to replace in the query, depending on the tree you are querying and the ChartField stored on the tree.

Share and Enjoy:
  • PDF
  • Print
  • email
  • Twitter
  • Facebook
  • LinkedIn
  • RSS
  • Tumblr
  • Google Bookmarks
  • Netvibes

SQL Developer Tweaks

January 16th, 2010

I came across Duncan Davies‘s PeopleSoft Tipster blog when searching for ways to customize and optimize SQL Developer to make my job easier. He has some great tips for tweaking Oracle’s free SQL Developer tool to look better and work better for the consultants of the world. Some tips that I’ve started using:

1) Change the Font. Developers like to indent and line up their code to make it more readable. Why deliver the product with a default font that isn’t fixed width, therefore making this harder? The first change I make is to swap the font (Tools > Preferences > Code Editor > Fonts) for Lucida Console, 11pts – although the font size may vary depending upon monitor resolution and the state of your eyesight.

3) Syntax Colours. Picking a better colour scheme eases readability as you’ll be able to pick out strings, operators and brackets/braces quicker but the delivered scheme highlights keywords in bold, which throws out the alignment if you’ve pick a fixed-width font. I normally make the following changes (Tools > Preferences > Code Editor > Syntax Colours):

  • Remove the bold highlight from ‘Default Element Name’ and ‘Default Keyword’.
  • Change Default Separator to purple
  • Change Default String to red
  • Uncheck ‘Enable highlight’ against Current SQL

I also use several of the Toolbar Shortcuts he mentions, such as F9 to execute SQL queries.

Thanks for the great article, Duncan!

Share and Enjoy:
  • PDF
  • Print
  • email
  • Twitter
  • Facebook
  • LinkedIn
  • RSS
  • Tumblr
  • Google Bookmarks
  • Netvibes