Saturday, May 24, 2014
Script for updating the vendor short name sequence after vendor data insertion to the peoplesoft FSCM finanicals database,
CREATE TABLE SYSADM.scb_vnd_tmp_1 AS
SELECT setid,vendor_id,vndr_name_shrt_usr,
RANK() OVER (PARTITION BY vndr_name_shrt_usr ORDER BY vendor_id) AS VNDR_NAME_SEQ_NUM
FROM PS_VENDOR WHERE SETID = 'SCMGS' AND VNDR_NAME_SEQ_NUM = 999;
UPDATE PS_VENDOR V SET
V.VENDOR_NAME_SHORT = ( SELECT DISTINCT vndr_name_shrt_usr||'-'||LPAD(TO_CHAR(VNDR_NAME_SEQ_NUM),3,'0') FROM SYSADM.scb_vnd_tmp T WHERE T.VENDOR_ID = V.VENDOR_ID )
,V.VNDR_NAME_SEQ_NUM = ( SELECT DISTINCT VNDR_NAME_SEQ_NUM FROM SYSADM.scb_vnd_tmp T WHERE T.VENDOR_ID = V.VENDOR_ID )
WHERE V.SETID = 'SHARE' AND V.VNDR_NAME_SEQ_NUM = 999;
Tree denoralization script for PeopleSoft trees --max 9 levels only
--> Script to denormalize the PeopleSoft tree with 9 levels max
SELECT *
FROM (
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,' ' LVL2
,' ' LVL3
,' ' LVL4
,' ' LVL5
,' ' LVL6
,' ' LVL7
,' ' LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
,PSTREELEAF lf
WHERE T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T1.TREE_NODE_NUM = 1
AND T1.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,' ' LVL3
,' ' LVL4
,' ' LVL5
,' ' LVL6
,' ' LVL7
,' ' LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
, PSTREENODE T2
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T2.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,T3.TREE_NODE LVL3
,' ' LVL4
,' ' LVL5
,' ' LVL6
,' ' LVL7
,' ' LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
, PSTREENODE T2
, PSTREENODE T3
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = T3.SETID
AND T1.TREE_NAME = T3.TREE_NAME
AND T1.EFFDT = T3.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T2.TREE_NODE_NUM = T3.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T3.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,T3.TREE_NODE LVL3
,T4.TREE_NODE LVL4
,' ' LVL5
,' ' LVL6
,' ' LVL7
,' ' LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
, PSTREENODE T2
, PSTREENODE T3
, PSTREENODE T4
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = T3.SETID
AND T1.TREE_NAME = T3.TREE_NAME
AND T1.EFFDT = T3.EFFDT
AND T1.SETID = T4.SETID
AND T1.TREE_NAME = T4.TREE_NAME
AND T1.EFFDT = T4.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T2.TREE_NODE_NUM = T3.PARENT_NODE_NUM
AND T3.TREE_NODE_NUM = T4.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T4.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,T3.TREE_NODE LVL3
,T4.TREE_NODE LVL4
,T5.TREE_NODE LVL5
,' ' LVL6
,' ' LVL7
,' ' LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
, PSTREENODE T2
, PSTREENODE T3
, PSTREENODE T4
, PSTREENODE T5
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = T3.SETID
AND T1.TREE_NAME = T3.TREE_NAME
AND T1.EFFDT = T3.EFFDT
AND T1.SETID = T4.SETID
AND T1.TREE_NAME = T4.TREE_NAME
AND T1.EFFDT = T4.EFFDT
AND T1.SETID = T5.SETID
AND T1.TREE_NAME = T5.TREE_NAME
AND T1.EFFDT = T5.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T2.TREE_NODE_NUM = T3.PARENT_NODE_NUM
AND T3.TREE_NODE_NUM = T4.PARENT_NODE_NUM
AND T4.TREE_NODE_NUM = T5.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T5.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,T3.TREE_NODE LVL3
,T4.TREE_NODE LVL4
,T5.TREE_NODE LVL5
,T6.TREE_NODE LVL6
,' ' LVL7
,' ' LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
, PSTREENODE T2
, PSTREENODE T3
, PSTREENODE T4
, PSTREENODE T5
,PSTREENODE T6
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = T3.SETID
AND T1.TREE_NAME = T3.TREE_NAME
AND T1.EFFDT = T3.EFFDT
AND T1.SETID = T4.SETID
AND T1.TREE_NAME = T4.TREE_NAME
AND T1.EFFDT = T4.EFFDT
AND T1.SETID = T5.SETID
AND T1.TREE_NAME = T5.TREE_NAME
AND T1.EFFDT = T5.EFFDT
AND T1.SETID = T6.SETID
AND T1.TREE_NAME = T6.TREE_NAME
AND T1.EFFDT = T6.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T2.TREE_NODE_NUM = T3.PARENT_NODE_NUM
AND T3.TREE_NODE_NUM = T4.PARENT_NODE_NUM
AND T4.TREE_NODE_NUM = T5.PARENT_NODE_NUM
AND T5.TREE_NODE_NUM = T6.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T6.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,T3.TREE_NODE LVL3
,T4.TREE_NODE LVL4
,T5.TREE_NODE LVL5
,T6.TREE_NODE LVL6
,T7.TREE_NODE LVL7
,' ' LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
, PSTREENODE T2
, PSTREENODE T3
, PSTREENODE T4
, PSTREENODE T5
,PSTREENODE T6
,PSTREENODE T7
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = T3.SETID
AND T1.TREE_NAME = T3.TREE_NAME
AND T1.EFFDT = T3.EFFDT
AND T1.SETID = T4.SETID
AND T1.TREE_NAME = T4.TREE_NAME
AND T1.EFFDT = T4.EFFDT
AND T1.SETID = T5.SETID
AND T1.TREE_NAME = T5.TREE_NAME
AND T1.EFFDT = T5.EFFDT
AND T1.SETID = T6.SETID
AND T1.TREE_NAME = T6.TREE_NAME
AND T1.EFFDT = T6.EFFDT
AND T1.SETID = T7.SETID
AND T1.TREE_NAME = T7.TREE_NAME
AND T1.EFFDT = T7.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T2.TREE_NODE_NUM = T3.PARENT_NODE_NUM
AND T3.TREE_NODE_NUM = T4.PARENT_NODE_NUM
AND T4.TREE_NODE_NUM = T5.PARENT_NODE_NUM
AND T5.TREE_NODE_NUM = T6.PARENT_NODE_NUM
AND T6.TREE_NODE_NUM = T7.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T7.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,T3.TREE_NODE LVL3
,T4.TREE_NODE LVL4
,T5.TREE_NODE LVL5
,T6.TREE_NODE LVL6
,T7.TREE_NODE LVL7
,T8.TREE_NODE LVL8
,' ' LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
,PSTREENODE T2
,PSTREENODE T3
,PSTREENODE T4
,PSTREENODE T5
,PSTREENODE T6
,PSTREENODE T7
,PSTREENODE T8
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = T3.SETID
AND T1.TREE_NAME = T3.TREE_NAME
AND T1.EFFDT = T3.EFFDT
AND T1.SETID = T4.SETID
AND T1.TREE_NAME = T4.TREE_NAME
AND T1.EFFDT = T4.EFFDT
AND T1.SETID = T5.SETID
AND T1.TREE_NAME = T5.TREE_NAME
AND T1.EFFDT = T5.EFFDT
AND T1.SETID = T6.SETID
AND T1.TREE_NAME = T6.TREE_NAME
AND T1.EFFDT = T6.EFFDT
AND T1.SETID = T7.SETID
AND T1.TREE_NAME = T7.TREE_NAME
AND T1.EFFDT = T7.EFFDT
AND T1.SETID = T8.SETID
AND T1.TREE_NAME = T8.TREE_NAME
AND T1.EFFDT = T8.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T2.TREE_NODE_NUM = T3.PARENT_NODE_NUM
AND T3.TREE_NODE_NUM = T4.PARENT_NODE_NUM
AND T4.TREE_NODE_NUM = T5.PARENT_NODE_NUM
AND T5.TREE_NODE_NUM = T6.PARENT_NODE_NUM
AND T6.TREE_NODE_NUM = T7.PARENT_NODE_NUM
AND T7.TREE_NODE_NUM = T8.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T8.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0
UNION
SELECT DISTINCT T1.SETID
,T1.TREE_NAME
,T1.EFFDT
,T1.TREE_NODE LVL1
,T2.TREE_NODE LVL2
,T3.TREE_NODE LVL3
,T4.TREE_NODE LVL4
,T5.TREE_NODE LVL5
,T6.TREE_NODE LVL6
,T7.TREE_NODE LVL7
,T8.TREE_NODE LVL8
,T9.TREE_NODE LVL9
,LF.RANGE_FROM
,LF.RANGE_TO
FROM PSTREENODE T1
,PSTREENODE T2
,PSTREENODE T3
,PSTREENODE T4
,PSTREENODE T5
,PSTREENODE T6
,PSTREENODE T7
,PSTREENODE T8
,PSTREENODE T9
,PSTREELEAF lf
WHERE T1.SETID = T2.SETID
AND T1.TREE_NAME = T2.TREE_NAME
AND T1.EFFDT = T2.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T1.SETID = T3.SETID
AND T1.TREE_NAME = T3.TREE_NAME
AND T1.EFFDT = T3.EFFDT
AND T1.SETID = T4.SETID
AND T1.TREE_NAME = T4.TREE_NAME
AND T1.EFFDT = T4.EFFDT
AND T1.SETID = T5.SETID
AND T1.TREE_NAME = T5.TREE_NAME
AND T1.EFFDT = T5.EFFDT
AND T1.SETID = T6.SETID
AND T1.TREE_NAME = T6.TREE_NAME
AND T1.EFFDT = T6.EFFDT
AND T1.SETID = T7.SETID
AND T1.TREE_NAME = T7.TREE_NAME
AND T1.EFFDT = T7.EFFDT
AND T1.SETID = T8.SETID
AND T1.TREE_NAME = T8.TREE_NAME
AND T1.EFFDT = T8.EFFDT
AND T1.SETID = T9.SETID
AND T1.TREE_NAME = T9.TREE_NAME
AND T1.EFFDT = T9.EFFDT
AND T1.TREE_NODE_NUM = T2.PARENT_NODE_NUM
AND T2.TREE_NODE_NUM = T3.PARENT_NODE_NUM
AND T3.TREE_NODE_NUM = T4.PARENT_NODE_NUM
AND T4.TREE_NODE_NUM = T5.PARENT_NODE_NUM
AND T5.TREE_NODE_NUM = T6.PARENT_NODE_NUM
AND T6.TREE_NODE_NUM = T7.PARENT_NODE_NUM
AND T7.TREE_NODE_NUM = T8.PARENT_NODE_NUM
AND T8.TREE_NODE_NUM = T9.PARENT_NODE_NUM
AND T1.SETID = LF.SETID
AND T1.TREE_NAME = LF.TREE_NAME
AND T1.EFFDT = LF.EFFDT
AND T9.TREE_NODE_NUM = LF.TREE_NODE_NUM
AND T1.PARENT_NODE_NUM = 0 ) DNM
WHERE DNM.TREE_NAME = 'ACCOUNT_GLOBAL'
AND DNM.SETID = 'SHARE'
AND DNM.EFFDT = '01-Jan-2008'
SQL to list out the records and fields in a PeopleSoft pages
/* Formatted on 2014/03/12 14:28 (Formatter Plus v4.8.7) */
SELECT a.pnlname, a.recname, a.fieldname, a.lbltext, c.fieldtype, c.LENGTH,
(SELECT CASE
WHEN BITAND (m.useedit, 256) > 0
THEN 'YES'
ELSE 'NO'
END AS required_field
FROM PSRECFIELD m, PSDBFIELD n
WHERE m.recname = b.recname
AND m.fieldname = n.fieldname
AND m.fieldname = c.fieldname) AS req_field,
(SELECT CASE
WHEN EXISTS (
SELECT 'X'
FROM all_ind_columns
WHERE table_name = 'PS_' || a.recname
AND column_name = a.fieldname)
THEN 'YES'
ELSE 'NO'
END AS key_field
FROM PS_INSTALLATION) AS keys_field
FROM PSPNLFIELD a, PSRECFIELDDB b, PSDBFIELD c
WHERE a.recname = b.recname
AND a.fieldname = b.fieldname
AND b.fieldname = c.fieldname
AND a.pnlname IN ('CS_CNTRCT_HDR','CNTRCT_HDR_SBP')
ORDER BY a.recname
Multibyte characters related to peoplesoft in oracle database, can be used in multilingual databases in peoplesoft
Below codes will be used to convert the data in the non unicode database to the unicode database, as it oracle will not allow us to insert Multibyte chars.
--script to identify the difference,
SELECT descr FROM PS_PRODUCT_TBL
WHERE LENGTH(asciistr(descr))!=LENGTH(descr)
ORDER BY descr;
--script to fix the multibyte characters,
SELECT DUMP(a,1016), a FROM (
SELECT REGEXP_REPLACE (
CONVERT (
'3735844533120%$03 ',
'US7ASCII',
'WE8ISO8859P1'),
'[^!@/\.,;:<>#$%&()_=[:alnum:][:blank:]]') a
FROM DUAL);
Oracle long running operations /sql in the database
SELECT SQL.HASH_VALUE ,SQL.ADDRESS ,nvl(ses.username,'ORACLE PROC')||' ('||ses.sid||')' USERNAME,
SID,
MACHINE,
REPLACE(SQL.SQL_TEXT,CHR(10),'') STMT,
ltrim(to_char(floor(SES.LAST_CALL_ET/3600), '09')) || ':'
|| ltrim(to_char(floor(mod(SES.LAST_CALL_ET, 3600)/60), '09')) || ':'
|| ltrim(to_char(mod(SES.LAST_CALL_ET, 60), '09')) RUNT
FROM V$SESSION SES,
V$SQLtext_with_newlines SQL
where SES.STATUS = 'ACTIVE'
and SES.USERNAME is not null
and SES.SQL_ADDRESS = SQL.ADDRESS
and SES.SQL_HASH_VALUE = SQL.HASH_VALUE
and Ses.AUDSID <> userenv('SESSIONID')
order by runt desc, 1,sql.piece;
Script to list out long running operations or sql executions in Oracle...
SELECT s.sid,
s.serial#,
S.username,
s.OSUser,
s.machine,
ROUND(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,
ROUND(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) remaining,
ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
FROM v$session s,
v$session_longops sl
WHERE s.sid = sl.sid
AND s.serial# = sl.serial#
AND TOTALWORK != 0 AND SOFAR <> TOTALWORK
order by 1;
CREATE OR REPLACE FUNCTION getlong( p_tname IN VARCHAR2,p_cname IN VARCHAR2,p_rowid IN ROWID ) RETURN VARCHAR2
AS
l_cursor INTEGER DEFAULT DBMS_SQL.OPEN_CURSOR;
l_n NUMBER;
l_long_val VARCHAR2(4000);
l_buflen NUMBER := 4000;
l_long_len NUMBER;
l_curpos NUMBER := 0;
BEGIN
DBMS_SQL.PARSE( l_cursor,
'select ' || p_cname || ' from ' || p_tname ||
' where rowid = :x',
dbms_sql.native );
DBMS_SQL.BIND_VARIABLE( l_cursor, ':x', p_rowid );
DBMS_SQL.DEFINE_COLUMN_LONG(l_cursor, 1);
l_n := DBMS_SQL.EXECUTE(l_cursor);
IF (DBMS_SQL.FETCH_ROWS(l_cursor)>0)
THEN
DBMS_SQL.COLUMN_VALUE_LONG(l_cursor, 1, l_buflen, l_curpos ,
l_long_val, l_long_len );
END IF;
DBMS_SQL.CLOSE_CURSOR(l_cursor);
RETURN l_long_val;
END getlong;
/
PeopleSoft IB message transaction table names,
/* Formatted on 2014/04/30 09:41 (Formatter Plus v4.8.7) */
SELECT ibtransactionid, ib_segmentindex, ib_operationname, ibpubtransactid,
actionname, pubnode, queuename, queueseqid, subqueue, trxtype,
versionname, createdttm, publishtimestamp, actionowner, conversationid,
inreplytoid, isrequest, routingdefnname, subconstatus, statusstring,
lastupddttm, retrycount, machinename, slaveprocessname, ib_slavequeued,
tuxdomain, processid
FROM psapmsgsubcon
/* Formatted on 2014/04/30 09:42 (Formatter Plus v4.8.7) */
SELECT ibtransactionid, ib_segmentindex, subnode, ibpubtransactid,
ib_sendpubid, pubnode, queuename, queueseqid, subqueue, createdttm,
publishtimestamp, trxtype, ib_operationname, versionname,
conversationid, canonicaltrsfrmid, inreplytoid, isrequest,
routingdefnname, pubconstatus, statusstring, lastupddttm, retrycount,
machinename, slaveprocessname, ib_slavequeued, tuxdomain, processid,
nrid
FROM psapmsgpubcon
UPDATE PSOPRDEFN SET EMAILID='a@a.a'
UPDATE PSUSEREMAIL SET EMAILID='a@a.a'
UPDATE PS_ROLEXLATOPR SET EMAILID='a@a.a'
UPDATE PS_SAC_EMC_PND_HDR SET SENT_TO='a@a.a'
UPDATE PS_VENDOR_ADDR SET EMAILID='a@a.a'
UPDATE PS_VENDOR_CNTCT SET EMAILID='a@a.a'
TRUNCATE TABLE PS_PO_EMAIL_QUEUE
SELECT a.portal_name,f.portal_label AS parent5_folder,e.portal_label AS parent4_folder,d.portal_label AS parent3_folder,c.portal_label AS parent2_folder,
b.portal_label AS parent_folder,a.portal_label AS component,A.portal_uri_seg2 FROM PSPRSMDEFN a
LEFT JOIN PSPRSMDEFN b ON b.portal_name = a.portal_name AND b.portal_objname = a.portal_prntobjname LEFT JOIN PSPRSMDEFN c ON c.portal_name = b.portal_name
AND c.portal_objname = b.portal_prntobjname LEFT JOIN PSPRSMDEFN d ON d.portal_name = c.portal_name AND d.portal_objname = c.portal_prntobjname
LEFT JOIN PSPRSMDEFN e ON e.portal_name = d.portal_name AND e.portal_objname = d.portal_prntobjname LEFT JOIN PSPRSMDEFN f ON F.portal_name = E.portal_name
AND F.portal_objname = E.portal_prntobjname WHERE a.portal_reftype = 'C' AND a.portal_uri_seg2 LIKE '%CNTRCT_MSTR%'--substitute component name here
-->provides all navigation paths of a folder
SELECT a.portal_name,f.portal_label AS parent5_folder,e.portal_label AS parent4_folder,d.portal_label AS parent3_folder,c.portal_label AS parent2_folder,
b.portal_label AS parent_folder,a.portal_label AS component,A.portal_uri_seg2 FROM PSPRSMDEFN a
LEFT JOIN PSPRSMDEFN b ON b.portal_name = a.portal_name AND b.portal_objname = a.portal_prntobjname LEFT JOIN PSPRSMDEFN c ON c.portal_name = b.portal_name
AND c.portal_objname = b.portal_prntobjname LEFT JOIN PSPRSMDEFN d ON d.portal_name = c.portal_name AND d.portal_objname = c.portal_prntobjname
LEFT JOIN PSPRSMDEFN e ON e.portal_name = d.portal_name AND e.portal_objname = d.portal_prntobjname LEFT JOIN PSPRSMDEFN f ON F.portal_name = E.portal_name
AND F.portal_objname = E.portal_prntobjname WHERE a.portal_reftype = 'C' AND a.portal_uri_seg1 LIKE '%EXTRACT%'--substitute folder name here
-->provides navigation path of a folder
SELECT a.portal_name,f.portal_label AS parent5_folder,e.portal_label AS parent4_folder,d.portal_label AS parent3_folder,c.portal_label AS parent2_folder,
b.portal_label AS parent_folder,a.portal_label AS component,A.portal_uri_seg2 FROM PSPRSMDEFN a
LEFT JOIN PSPRSMDEFN b ON b.portal_name = a.portal_name AND b.portal_objname = a.portal_prntobjname LEFT JOIN PSPRSMDEFN c ON c.portal_name = b.portal_name
AND c.portal_objname = b.portal_prntobjname LEFT JOIN PSPRSMDEFN d ON d.portal_name = c.portal_name AND d.portal_objname = c.portal_prntobjname
LEFT JOIN PSPRSMDEFN e ON e.portal_name = d.portal_name AND e.portal_objname = d.portal_prntobjname LEFT JOIN PSPRSMDEFN f ON F.portal_name = E.portal_name
AND F.portal_objname = E.portal_prntobjname WHERE a.portal_reftype = 'C' AND a.portal_prntobjname LIKE '%DAILY_PROCESSING1%'--substitute folder name here
--provides PIA navigation path of a Component/folder
SELECT a.portal_name,f.portal_label AS parent5_folder,e.portal_label AS parent4_folder,d.portal_label AS parent3_folder,c.portal_label AS parent2_folder,
b.portal_label AS parent_folder,a.portal_label AS component,A.portal_uri_seg2 FROM PSPRSMDEFN a
LEFT JOIN PSPRSMDEFN b ON b.portal_name = a.portal_name AND b.portal_objname = a.portal_prntobjname LEFT JOIN PSPRSMDEFN c ON c.portal_name = b.portal_name
AND c.portal_objname = b.portal_prntobjname LEFT JOIN PSPRSMDEFN d ON d.portal_name = c.portal_name AND d.portal_objname = c.portal_prntobjname
LEFT JOIN PSPRSMDEFN e ON e.portal_name = d.portal_name AND e.portal_objname = d.portal_prntobjname LEFT JOIN PSPRSMDEFN f ON F.portal_name = E.portal_name
AND F.portal_objname = E.portal_prntobjname WHERE a.portal_reftype = 'C' AND a.portal_uri_seg1 IN ('COMPONENET_NAME') ORDER BY 5,6
Thursday, April 25, 2013
Sql to find out the cont ref based out of the component name
Sql to find out the cont ref based out of the component name
SELECT PORTAL_NAME,portal_reftype,PORTAL_URLTEXT FROM PSPRSMDEFN WHERE PORTAL_NAME = 'EMPLOYEE' AND PORTAL_OBJNAME like '%RUN_BI_PRNTEXT%'
Best Regards
Aravind Kumar R
System Analyst/Peoplesoft Practice
Birlasoft • 36,
Cell: +91 9566750166
************************************************************************************************************************************************************************************
"This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the mail.admin@birlasoft.com immediately without opening the mail and attachment . Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email
************************************************************************************************************************************************************************************
Thursday, April 18, 2013
PeopleSoft - PeopleCode for archiving the file in PSNT server using Application Engine
Tuesday, April 16, 2013
SQL Check if a user has access to a PeopleSoft portal content reference/folder - PIA
SQL to check if a user has access to a PeopleSoft portal content reference/folder -PIA
SELECT * FROM (
SELECT A.*, C.ROLEUSER, C.ROLENAME
FROM PSPRSMPERM A, PSROLECLASS B, PSROLEUSER C
WHERE A.PORTAL_PERMTYPE = 'P' AND A.PORTAL_PERMNAME= B.CLASSID AND B.ROLENAME = C.ROLENAME
UNION
SELECT A.*, C.ROLEUSER, C.ROLENAME
FROM PSPRSMPERM A, PSROLEUSER C
WHERE A.PORTAL_PERMTYPE = 'R' AND A.PORTAL_PERMNAME = C.ROLENAME) X
WHERE X.PORTAL_NAME = 'EMPLOYEE'
and X.PORTAL_OBJNAME like '%CUSTOMER%'
AND X.ROLEUSER = 'aravindkumar'
Best Regards
Aravind Kumar R
System Analyst/Peoplesoft Practice
Birlasoft • 36,
Cell: +91 9566750166
************************************************************************************************************************************************************************************
"This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the mail.admin@birlasoft.com immediately without opening the mail and attachment . Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email
************************************************************************************************************************************************************************************
PeopleSoft FSCM important tables
PeopleSoft finance and supply chain management important tables list
SELECT * FROM PS_JRNL_LN_BUDG
SELECT * FROM PS_LEDGER_BUDG
SELECT * FROM PS_COMBO_DATA_TBL
SELECT * FROM PS_COMBO_DATA_BUDG
SELECT * FROM PS_REQ_HDR
SELECT * FROM PS_REQ_LINE
SELECT * FROM PS_REQ_LINE_SHIP
SELECT * FROM PS_REQ_LINE_DISTRIB
SELECT * FROM PS_REQ_LINE_ACCTG
SELECT * FROM PS_PO_HDR
SELECT * FROM PS_PO_LINE
SELECT * FROM PS_PO_LINE_SHIP
SELECT * FROM PS_PO_LINE_DISTRIB
SELECT * FROM PS_PO_LINE_ACCTG
SELECT * FROM PS_RECV_HDR
SELECT * FROM PS_RECV_LN
SELECT * FROM PS_RECV_LN_SHIP
SELECT * FROM PS_RECV_LN_DISTRIB
SELECT * FROM PS_VOUCHER
SELECT * FROM PS_VOUCHER_LINE
SELECT * FROM PS_DISTRIB_LINE
SELECT * FROM PS_VCHR_ACCTG_LINE
SELECT * FROM PS_PO_LINE_MATCHED
SELECT * FROM PS_PYMNT_ADVICE
SELECT * FROM PS_PYMNT_VCHR_XREF
SELECT * FROM PS_PAYMENT_TBL
SELECT * FROM PS_VENDOR
SELECT * FROM PS_VENDOR_LOC
SELECT * FROM PS_VENDOR_PAY
SELECT * FROM PS_VNDR_LOC_ADDR
SELECT * FROM PS_VENDOR_WTHD
SELECT * FROM PS_VENDOR_ADDR
--AR
SELECT * FROM PS_AR_PAYMENT_EC
SELECT * FROM PS_AR_IDCUST_EC
SELECT * FROM PS_AR_IDITEM_EC
SELECT * FROM PS_PAYMENT_ID_CUST
SELECT * FROM PS_PAYMENT_ID_ITEM
SELECT * FROM PS_DEPOSIT_CONTROL
SELECT * FROM PS_PAYMENT
Best Regards
Aravind Kumar R
System Analyst/Peoplesoft Practice
Birlasoft • 36,
Cell: +91 9566750166
************************************************************************************************************************************************************************************
"This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the mail.admin@birlasoft.com immediately without opening the mail and attachment . Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email
************************************************************************************************************************************************************************************
PeopleCode for inserting the AR pending item interface using Component Interface
Peoplesoft -- PeopleCode for inserting the AR pending item interface using Component Interface
Local File &fileLog;
Local ApiObject &oSession, &oDcPenditemCi;
Local ApiObject &oPendingItemCollection, &oPendingItem;
Local ApiObject &oPendingDstCollection, &oPendingDst;
Local ApiObject &oPendingVatCollection, &oPendingVat;
Function errorHandler()
Local ApiObject &oPSMessageCollection, &oPSMessage;
Local number &i;
Local string &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType;
&oPSMessageCollection = &oSession.PSMessages;
For &i = 1 To &oPSMessageCollection.Count
&oPSMessage = &oPSMessageCollection.Item(&i);
&sErrMsgSetNum = &oPSMessage.MessageSetNumber;
&sErrMsgNum = &oPSMessage.MessageNumber;
&sErrMsgText = &oPSMessage.Text;
&fileLog.WriteLine(&sErrType | " (" | &sErrMsgSetNum | "," | &sErrMsgNum | ") - " | &sErrMsgText);
End-For;
rem ***** Delete the Messages from the collection *****;
&oPSMessageCollection.DeleteAll();
End-Function;
SQLExec("select GROUP_BU,GROUP_ID,OPRID,ASSN_OPRID,GROUP_TYPE,POST_ACTION,CONTROL_AMT,CONTROL_CNT,ORIGIN_ID,%dateout(RECEIVED_DT),%dateout(ENTRY_DT), %dateout(ACCOUNTING_DT),CONTROL_CURRENCY,FORMAT_CURRENCY,ALLOW_DST FROM PS_Z_AR_GCTL_TMP WHERE PROCESS_INSTANCE = :1 AND Z_AR_STATUS ='P'", Z_AR_ALNCE_AET.PROCESS_INSTANCE.Value, &GROUP_BU, &GROUP_ID, &OPRID, &ASSN_OPRID, &GROUP_TYPE, &POST_ACTION, &CONTROL_AMT, &CONTROL_CNT, &ORIGIN_ID, &RECEIVED_DT, &ENTRY_DT, &ACCOUNTING_DT, &CONTROL_CURRENCY, &FORMAT_CURRENCY, &ALLOW_DST);
try
rem ***** Set the Log File *****;
&fileLog = GetFile("C:\temp\DC_PENDITEM_CI.log", "w", "a", %FilePath_Absolute);
&fileLog.WriteLine("Begin");
rem ***** Get current PeopleSoft Session *****;
&oSession = %Session;
rem ***** Set the PeopleSoft Session Error Message Mode *****;
rem ***** 0 - None *****;
rem ***** 1 - PSMessage Collection only (default) *****;
rem ***** 2 - Message Box only *****;
rem ***** 3 - Both collection and message box *****;
&oSession.PSMessagesMode = 1;
rem ***** Get the Component Interface *****;
&oDcPenditemCi = &oSession.GetCompIntfc(CompIntfc.DC_PENDITEM_CI);
If &oDcPenditemCi = Null Then
errorHandler();
throw CreateException(0, 0, "GetCompIntfc failed for pending item ");
End-If;
rem ***** Set the Component Interface Mode *****;
&oDcPenditemCi.InteractiveMode = False;
&oDcPenditemCi.GetHistoryItems = True;
&oDcPenditemCi.EditHistoryItems = False;
rem ***** Set Component Interface Get/Create Keys *****;
&oDcPenditemCi.GROUP_BU = &GROUP_BU;
&oDcPenditemCi.GROUP_ID = "NEXT";
rem ***** Execute Create ******;
If Not &oDcPenditemCi.Create() Then;
rem ***** Unable to Create Component Interface for the Add keys provided. *****;
errorHandler();
throw CreateException(0, 0, "Create pending item failed ");
End-If;
rem ***** Begin: Get/Set Component Interface Properties *****;
rem ***** Get/Set Level 0 Field Properties *****;
&oDcPenditemCi.GROUP_BU = &GROUP_BU;
&oDcPenditemCi.GROUP_ID = "NEXT";
&oDcPenditemCi.OPRID = &OPRID;
&oDcPenditemCi.ASSN_OPRID = &ASSN_OPRID;
&oDcPenditemCi.GROUP_TYPE = "B";
rem &oDcPenditemCi.GROUP_SEQ_NUM = 17;
&oDcPenditemCi.POST_ACTION = "L";
&oDcPenditemCi.CONTROL_AMT = &CONTROL_AMT;
&oDcPenditemCi.CONTROL_CNT = &CONTROL_CNT;
&oDcPenditemCi.ORIGIN_ID = &ORIGIN_ID;
&oDcPenditemCi.RECEIVED_DT = &RECEIVED_DT;
&oDcPenditemCi.ENTRY_DT = &ENTRY_DT;
&oDcPenditemCi.ACCOUNTING_DT = &ACCOUNTING_DT;
rem &oDcPenditemCi.DST_BAL_STATUS = "I";
&oDcPenditemCi.FORMAT_CURRENCY = &FORMAT_CURRENCY;
&oDcPenditemCi.ALLOW_DST = &ALLOW_DST;
rem ***** Set/Get PENDING_ITEM Collection Field Properties -- Parent: PS_ROOT Collection *****;
&oPendingItemCollection = &oDcPenditemCi.PENDING_ITEM;
Local integer &i126;
&i126 = 1;
&SelPndRecord = CreateRecord(Record.Z_AR_PITM_TMP);
&SQL = CreateSQL("%Selectall(:1) WHERE PROCESS_INSTANCE = :2 AND Z_AR_STATUS ='P'", Record.Z_AR_PITM_TMP, Z_AR_ALNCE_AET.PROCESS_INSTANCE.Value);
While &SQL.fetch(&SelPndRecord)
&oPendingItem = &oPendingItemCollection.InsertItem(&i126);
REM MessageBox(0, "", 0, 0, &SelPndRecord.CUST_ID.VALUE);
&oPendingItem.GROUP_BU = &SelPndRecord.GROUP_BU.VALUE;
&oPendingItem.GROUP_ID = "NEXT";
&oPendingItem.BUSINESS_UNIT = &SelPndRecord.BUSINESS_UNIT.VALUE;
&oPendingItem.CUST_ID = &SelPndRecord.CUST_ID.VALUE;
&oPendingItem.ITEM = &SelPndRecord.ITEM.VALUE;
&oPendingItem.ITEM_LINE = &SelPndRecord.ITEM_LINE.VALUE;
&EntryType = &SelPndRecord.ENTRY_TYPE.VALUE;
If &SelPndRecord.GROUP_SEQ_NUM.VALUE = 1 Then
&EntryType = "IN";
End-If;
If &SelPndRecord.GROUP_SEQ_NUM.VALUE = 2 Then
&EntryType = "CR";
End-If;
&oPendingItem.GROUP_SEQ_NUM = &SelPndRecord.GROUP_SEQ_NUM.VALUE;
&oPendingItem.ENTRY_TYPE = &EntryType;
REM &SelPndRecord.ENTRY_TYPE.VALUE;
&oPendingItem.ENTRY_REASON = &SelPndRecord.ENTRY_REASON.VALUE;
&oPendingItem.ENTRY_AMT = &SelPndRecord.ENTRY_AMT.VALUE;
&oPendingItem.ENTRY_EVENT = &SelPndRecord.ENTRY_EVENT.VALUE;
&oPendingItem.ACCOUNTING_DT = &SelPndRecord.ACCOUNTING_DT.VALUE;
&oPendingItem.ASOF_DT = &SelPndRecord.ASOF_DT.VALUE;
&oPendingItem.DUE_DT = &SelPndRecord.DUE_DT.VALUE;
&oPendingItem.CR_ANALYST = &SelPndRecord.CR_ANALYST.VALUE;
&oPendingItem.SALES_PERSON = &SelPndRecord.SALES_PERSON.VALUE;
&oPendingItem.COLLECTOR = &SelPndRecord.COLLECTOR.VALUE;
REM &oPendingItem.DISPUTE_STATUS = &SelPndRecord.DISPUTE_STATUS.VALUE;
&oPendingItem.PO_REF = &SelPndRecord.PO_REF.VALUE;
REM &oPendingItem.PO_LINE = &SelPndRecord.PO_LINE.VALUE;
REM &oPendingItem.DOCUMENT = &SelPndRecord.DOCUMENT.VALUE;
REM &oPendingItem.DOCUMENT_LINE = &SelPndRecord.DOCUMENT_LINE.VALUE;
&oPendingItem.POSTED_FLAG = "N";
&oPendingItem.PYMNT_TERMS_CD = &SelPndRecord.PYMNT_TERMS_CD.VALUE;
REM &oPendingItem.DISC_AMT = &SelPndRecord.DISC_AMT.VALUE;
REM &oPendingItem.DISC_AMT1 = &SelPndRecord.DISC_AMT1.VALUE;
REM &oPendingItem.DISC_DT = &SelPndRecord.DISC_DT.VALUE;
REM &oPendingItem.DISC_DT1 = &SelPndRecord.DISC_DT1.VALUE;
REM &oPendingItem.DISC_DAYS = &SelPndRecord.DISC_DAYS.VALUE;
REM &oPendingItem.DUE_DAYS = &SelPndRecord.DUE_DAYS.VALUE;
REM &oPendingItem.ALLOW_DISC = &SelPndRecord.ALLOW_DISC.VALUE;
&oPendingItem.DST_ID_AR = &SelPndRecord.DST_ID_AR.VALUE;
&oPendingItem.ENTRY_USE_ID = &SelPndRecord.ENTRY_USE_ID.VALUE;
&oPendingItem.DST_BAL_ITEM = &SelPndRecord.DST_BAL_ITEM.VALUE;
REM &oPendingItem.COLLECTION_STATUS = &SelPndRecord.COLLECTION_STATUS.VALUE;
REM &oPendingItem.COLLECTION_DT = &SelPndRecord.COLLECTION_DT.VALUE;
REM &oPendingItem.BILL_OF_LADING = &SelPndRecord.BILL_OF_LADING.VALUE;
&oPendingItem.SUBCUST_QUAL1 = &SelPndRecord.SUBCUST_QUAL1.VALUE;
&oPendingItem.SUBCUST_QUAL2 = &SelPndRecord.SUBCUST_QUAL2.VALUE;
&oPendingItem.ENTRY_CURRENCY = &SelPndRecord.ENTRY_CURRENCY.VALUE;
REM &oPendingItem.RT_TYPE = &SelPndRecord.RT_TYPE.VALUE;
REM &oPendingItem.RATE_MULT = &SelPndRecord.RATE_MULT.VALUE;
REM &oPendingItem.RATE_DIV = &SelPndRecord.RATE_DIV.VALUE;
REM &oPendingItem.ENTRY_AMT_BASE = &SelPndRecord.ENTRY_AMT_BASE.VALUE;
&oPendingItem.PAYMENT_METHOD = &SelPndRecord.PAYMENT_METHOD.VALUE;
&oPendingItem.USER_AMT7 = &SelPndRecord.USER_AMT7.VALUE;
&oPendingItem.USER7 = &SelPndRecord.USER7.VALUE;
&oPendingItem.USER8 = &SelPndRecord.USER8.VALUE;
&oPendingItem.USER9 = &SelPndRecord.USER9.VALUE;
&oPendingItem.REVALUE_FLAG = &SelPndRecord.REVALUE_FLAG.VALUE;;
rem &oPendingItem.PC_DISTRIB_STATUS = &SelPndRecord.PC_DISTRIB_STATUS.VALUE;;
&oPendingItem.CURRENCY_CD = &SelPndRecord.CURRENCY_CD.VALUE;
<*
&oPendingItem.DST_ID_REAL = &SelPndRecord.DST_ID_REAL.VALUE;
&oPendingItem.ITEM_ACCTG_DT = &SelPndRecord.ITEM_ACCTG_DT.VALUE;
&oPendingItem.ORDER_NO = &SelPndRecord.ORDER_NO.VALUE;
&oPendingItem.CONTRACT_NUM = &SelPndRecord.CONTRACT_NUM.VALUE;
&oPendingItem.BUSINESS_UNIT_BI = &SelPndRecord.BUSINESS_UNIT_BI.VALUE;
&oPendingItem.BUSINESS_UNIT_OM = &SelPndRecord.BUSINESS_UNIT_OM.VALUE;
&oPendingItem.ADDRESS_SEQ_NUM = &SelPndRecord.ADDRESS_SEQ_NUM.VALUE;
&oPendingItem.LETTER_CD = &SelPndRecord.LETTER_CD.VALUE;
&oPendingItem.CONSOL_BUS_UNIT = &SelPndRecord.CONSOL_BUS_UNIT.VALUE;
&oPendingItem.CONSOL_INVOICE = &SelPndRecord.CONSOL_INVOICE.VALUE;
&oPendingItem.PAYMENT_METHOD = &SelPndRecord.PAYMENT_METHOD.VALUE;
&oPendingItem.DRAFT_FORMAT = &SelPndRecord.DRAFT_FORMAT.VALUE;
&oPendingItem.BANK_SETID = &SelPndRecord.BANK_SETID.VALUE;
&oPendingItem.BANK_CD = &SelPndRecord.BANK_CD.VALUE;
&oPendingItem.BANK_ACCT_KEY = &SelPndRecord.BANK_ACCT_KEY.VALUE;
&oPendingItem.DRAFT_TYPE = &SelPndRecord.DRAFT_TYPE.VALUE;
&oPendingItem.DRAFT_AMT_BASE = &SelPndRecord.DRAFT_AMT_BASE.VALUE;
&oPendingItem.DOC_TYPE = &SelPndRecord.DOC_TYPE.VALUE;
&oPendingItem.DOC_SEQ_NBR = &SelPndRecord.DOC_SEQ_NBR.VALUE;
&oPendingItem.DOC_SEQ_DATE = &SelPndRecord.DOC_SEQ_DATE.VALUE;
&oPendingItem.USER_AMT1 = &SelPndRecord.USER_AMT1.VALUE;
&oPendingItem.USER1 = &SelPndRecord.USER1.VALUE;
&oPendingItem.USER2 = &SelPndRecord.USER2.VALUE;
&oPendingItem.REGION_CD = &SelPndRecord.REGION_CD.VALUE;
&oPendingItem.PACKSLIP_NO = &SelPndRecord.PACKSLIP_NO.VALUE;
&oPendingItem.VAT_ADVPAY_FLG = &SelPndRecord.VAT_ADVPAY_FLG.VALUE;
&oPendingItem.LC_ID = &SelPndRecord.LC_ID.VALUE;
&oPendingItem.RECEIVABLE_TYPE = &SelPndRecord.RECEIVABLE_TYPE.VALUE;
&oPendingItem.ENTITY_CODE = &SelPndRecord.ENTITY_CODE.VALUE;
&oPendingItem.PPRC_PROMO_CD = &SelPndRecord.PPRC_PROMO_CD.VALUE;
&oPendingItem.CLAIM_NO = &SelPndRecord.CLAIM_NO.VALUE;
&oPendingItem.CONTROL_CURRENCY = &SelPndRecord.CONTROL_CURRENCY.VALUE;
&oPendingItem.CONTROL_CURR_BASE = &SelPndRecord.CONTROL_CURR_BASE.VALUE;
*>
&i126 = &i126 + 1;
End-While;
&oPendingItemCollection.DeleteItem(1);
rem ***** Execute Save *****;
If Not &oDcPenditemCi.Save() Then;
errorHandler();
throw CreateException(0, 0, "Pending item save failed");
Else
Z_AR_ALNCE_AET.GROUP_ID.Value = &oDcPenditemCi.GROUP_ID;
Z_AR_ALNCE_AET.GROUP_BU.Value = &oDcPenditemCi.GROUP_BU;
MessageBox(0, "", 0, 0, "Group ID created -" | Z_AR_ALNCE_AET.GROUP_ID.Value);
End-If;
rem ***** Execute Cancel *****;
rem If Not &oDcPenditemCi.Cancel() Then;
rem errorHandler();
rem throw CreateException(0, 0, "Cancel failed");
rem End-If;
catch Exception &ex
rem Handle the exception;
MessageBox(0, "", 0, 0, &ex.ToString());
Z_AR_ALNCE_AET.GROUP_ID.Value = " ";
Z_AR_ALNCE_AET.GROUP_BU.Value = " ";
end-try;
Best Regards
Aravind Kumar R
System Analyst/Peoplesoft Practice
Birlasoft • 36,
Cell: +91 9566750166
************************************************************************************************************************************************************************************
"This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the mail.admin@birlasoft.com immediately without opening the mail and attachment . Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email
************************************************************************************************************************************************************************************
PeopleCode for reading the file using the rowset and file layout objects - file with headers & lines combination
Sunday, March 24, 2013
PeopleCode to access the other databases from JDBC and Java
Below code is based out of java JDBC classes and executes the SQL queries on Oracle databases, Provided that JDBC is installed and TNS entry is know,
&TEMP = Z_PRC_PRM_TBL.USER1.Value;
Z_PRC_PRM_TBL.USER1.Value = "";
Z_PRC_PRM_TBL.USER1.Value = &TEMP;
DoSaveNow();
Local JavaObject &driverManager = GetJavaClass("java.sql.DriverManager");
&driverManager.registerDriver(CreateJavaObject("oracle.jdbc.OracleDriver"));
Local string &QueryString;
Local Rowset &PrcsMonRS;
Local JavaObject &driver = CreateJavaObject("oracle.jdbc.OracleDriver");
Local JavaObject &info = CreateJavaObject("java.util.Properties");
&info.put("user", Z_PRC_PRM_TBL.USER1.Value);
&info.put("password", Z_PRC_PRM_TBL.PASSWD.Value);
Local JavaObject &conn = &driverManager.getConnection(Z_PRC_PRM_TBL.CONNECTSTRING.Value, "sysadm", "ad%sy8");
&QueryString1 = "SELECT R.RUNSTATUS ,SERVERNAMERUN ,R.RUNDTTM ,(CASE WHEN R.RUNSTATUS IN (16,5,4) THEN to_char(floor(((RUNDTTM-SYSDATE)*60*24/60)/24))||'d'|| to_char(MOD(floor( (RUNDTTM-SYSDATE)*60*24/60),24)) ||'h'||to_char(MOD(FLOOR((RUNDTTM-SYSDATE)*60*24),60)) ";
&QueryString2 = " ||'m' WHEN R.RUNSTATUS IN (10,3,17,1,8) THEN '0' WHEN R.RUNSTATUS IN (6,7) THEN to_char(CEIL((SYSDATE-BEGINDTTM)*60*24)) WHEN R.RUNSTATUS IN (9) THEN to_char(CEIL((ENDDTTM-BEGINDTTM)*60*24)) ELSE TO_CHAR(R.RUNDTTM,'mm-Mon-yyyy') END) AS TTE_ETA ,DECODE(R.PRCSTYPE,'Application Engine','AE','SQR Process','SQR P','SQR Report','SQR R',R.PRCSTYPE) AS PRCSTYPE ";
&QueryString3 = " ,R.PRCSNAME,NVL(P.DESCR,J.DESCR) AS PRCS_DESCR ,R.RUNCNTLID AS RUNCNTLID ,R.RECURNAME AS RECURNAME ,R.PRCSINSTANCE AS PI ,R.RQSTDTTM AS RQSTDTTM ,SYSDATE AS CURDTTM ,ENDDTTM FROM PSPRCSRQST R LEFT OUTER JOIN PS_PRCSJOBDEFN J ON R.MAINJOBNAME = J.PRCSJOBNAME LEFT OUTER JOIN PS_PRCSDEFN P ON R.PRCSTYPE = P.PRCSTYPE AND R.PRCSNAME = P.PRCSNAME ";
&QueryString11 = "WHERE R.OPRID LIKE ':1' AND R.RQSTDTTM BETWEEN SYSDATE-DECODE(R.RUNSTATUS,:2,4) AND SYSDATE AND R.PRCSTYPE LIKE '%' AND R.PRCSJOBSEQ=0 AND R.RUNSTATUS IN (:3) ORDER BY 1 ASC,RUNDTTM ASC";
SQLExec("SELECT CONNECTSTRING, RTRIM(XMLAGG (XMLELEMENT (b, RUNSTATUS|| ','||DAYSTOCACHE || ',')).EXTRACT ('//text()'), ',') AS EXPR FROM PS_Z_PRC_STS_TBL WHERE CONNECTSTRING = :1 AND Z_PRC_NAME = :2 AND FLAG = 'Y' GROUP BY CONNECTSTRING", Z_PRC_PRM_TBL.CONNECTSTRING.Value, Z_PRC_PRM_TBL.Z_PRC_NAME.Value, &dMY1, &StatusSting);
SQLExec("SELECT CONNECTSTRING, RTRIM(XMLAGG (XMLELEMENT (b, RUNSTATUS||',')).EXTRACT ('//text()'), ',') AS EXPR FROM PS_Z_PRC_STS_TBL WHERE CONNECTSTRING = :1 AND Z_PRC_NAME = :2 AND FLAG = 'Y' GROUP BY CONNECTSTRING", Z_PRC_PRM_TBL.CONNECTSTRING.Value, Z_PRC_PRM_TBL.Z_PRC_NAME.Value, &dMY1, &StatusSelSting);
&QueryString14 = Substitute(&QueryString11, ":1", Z_PRC_PRM_TBL.OPRID.Value);
&QueryString13 = Substitute(&QueryString14, ":2", &StatusSting);
&QueryString12 = Substitute(&QueryString13, ":3", &StatusSelSting);
&QueryString = &QueryString1 | &QueryString2 | &QueryString3 | &QueryString12;
rem MessageBox(0, "", 0, 0, &QueryString12);
&PrcsMonRS = GetLevel0()(1).GetRowset(Scroll.DUMMY_MSG_TBL);
&PrcsMonRS.Flush();
&rowcounter = 0;
Local JavaObject &stmt = &conn.createStatement();
Local JavaObject &rs = &stmt.executeQuery(&QueryString);
Local number &rowIdx;
While &rs.next()
&rowIdx = &rowIdx + 1;
&rowcounter = &rowcounter + 1;
&PrcsMonRS.InsertRow(&rowcounter);
rem MessageBox(0, "", 0, 0, "Row " | &rowIdx | " column 1: " | &rs.getObject(1).toString());
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.RUNSTATUS.Value = &rs.getString("RUNSTATUS");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.SERVERNAMERUN.Value = &rs.getString("SERVERNAMERUN");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.RUNDTTM.Value = &rs.getString("RUNDTTM");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.DESCR.Value = &rs.getString("TTE_ETA");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.PRCSTYPE.Value = &rs.getString("PRCSTYPE");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.PRCSNAME.Value = &rs.getString("PRCSNAME");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.DESCR1.Value = &rs.getString("PRCS_DESCR");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.RUNCNTLID.Value = &rs.getString("RUNCNTLID");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.RECURNAME.Value = &rs.getString("RECURNAME");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.PROCESS_INSTANCE.Value = &rs.getString("PI");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.CURRENT_DTTM.Value = &rs.getString("CURDTTM");
&PrcsMonRS.GetRow(&rowcounter).Z_PRC_MON_TBL.END_DTTM.Value = &rs.getString("ENDDTTM");
End-While;
If &rowcounter > 1 Then
&PrcsMonRS.DeleteRow(&rowcounter + 1);
End-If;
&PrcsMonRS.Sort(Z_PRC_MON_TBL.RUNSTATUS, "A", Z_PRC_MON_TBL.RUNDTTM, "D");
&rs.close();
&stmt.close();
&conn.close();
************************************************************************************************************************************************************************************
"This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the mail.admin@birlasoft.com immediately without opening the mail and attachment . Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email
************************************************************************************************************************************************************************************
Wednesday, February 13, 2013
Production Monitoring SQL for PeopleSoft
/*+ index (PSPRCSRQST PSBPSPRCSRQST) */
DECODE(R.RUNSTATUS,16,'333',5,'333',4,'333', 10,'111',3,'111',17,'111',1,'111',8,'111',6,'222',7,'222',9,'444',2,'000','555')
||DECODE(R.RUNSTATUS,1,'Cancel',10,'NOT Successful',16,'Pending',17,'Warning',18,'Blocked'
,19,'Restart',2,'Delete',3,'Error',4,'Hold',5,'Queued',6,'Initiated',7,'Processing',8,'Cancelled',9,'Success','N/A') AS STATUS,SERVERNAMERUN
,R.RUNDTTM AS RUNDTTM
,(CASE WHEN R.RUNSTATUS IN (16,5,4) THEN
to_char(floor(((RUNDTTM-SYSDATE)*60*24/60)/24))||'d'|| to_char(MOD(floor( (RUNDTTM-SYSDATE)*60*24/60),24)) ||'h'||to_char(MOD(FLOOR((RUNDTTM-SYSDATE)*60*24),60))||'m'
WHEN R.RUNSTATUS IN (10,3,17,1,8) THEN '0'
WHEN R.RUNSTATUS IN (6,7) THEN to_char(CEIL((SYSDATE-BEGINDTTM)*60*24))
WHEN R.RUNSTATUS IN (9) THEN to_char(CEIL((ENDDTTM-BEGINDTTM)*60*24)) ELSE TO_CHAR(R.RUNDTTM,'mm-Mon-yyyy') END) AS TTE_ETA
,DECODE(R.PRCSTYPE,'Application Engine','AE','SQR Process','SQR P','SQR Report','SQR R',R.PRCSTYPE) AS PRCSTYPE
,R.PRCSNAME,NVL(P.DESCR,J.DESCR) AS PRCS_DESCR
,R.RUNCNTLID AS RUNCNTLID
,R.RECURNAME AS RECURNAME
,R.PRCSINSTANCE AS PI
,R.RQSTDTTM AS RQSTDTTM
,SYSDATE AS CURDTTM
,ENDDTTM
FROM
PSPRCSRQST R LEFT OUTER JOIN PS_PRCSJOBDEFN J
ON R.MAINJOBNAME = J.PRCSJOBNAME LEFT OUTER JOIN PS_PRCSDEFN P
ON R.PRCSTYPE = P.PRCSTYPE AND R.PRCSNAME = P.PRCSNAME
WHERE
R.OPRID IN ('TC0996')
AND R.RQSTDTTM BETWEEN SYSDATE-DECODE(R.RUNSTATUS,16,99,5,99,4) AND SYSDATE
AND R.PRCSTYPE LIKE '%'
AND R.PRCSJOBSEQ=0
AND R.RUNSTATUS IN (16,5,4,10,3,17,1,8,6,7,9,3)
ORDER BY 1 ASC,RUNDTTM ASC;