Categories
SQR

How to Get Process Name by Process Instance Using PeopleSoft SQR

When i was working on reportlog.sqc Projects then i have found really interesting tips that is Getting Process Name by process instance.
So lets tell the procedure.We all know the all process related information PeopleSoft Stored on PSPRCSRQST table. You can easily look the table data along with column name by using

  SELECT * FROM PSPRCSRQST;

here is the results

Query Results
Query Results

PRCSINSTANCEĀ  is the Key Field here.

I am telling the overall scenario before starting main SQR Code snippet section.

Fortunately PeopleSoft Deliver a SQC File called eoprcsnm.sqc , So just include the SQC file

 #include 'eoprcsnm.sqc'

at the bottom of your SQR Programme File. else you can use this if you don’t intend to include another file.

  
!********************************
begin-procedure Get-Process-Name (#prcs_process_instance, :$prcsname)
!********************************
Begin-SELECT 
P.PRCSNAME  
FROM PSPRCSRQST P
WHERE P.PRCSINSTANCE = #prcs_process_instance

End-SELECT

   let $prcsname = RTRIM(&P.PRCSNAME,' ') 

End-Procedure !Get-Process-Name

Here you can see, this procedure take 1 parameter as input (#prcs_process_instance) and return Process Name ($prcsname)

Now lets go to Example how to call them

  
!Get Process Name By Process Instance 
do Get-Process-Name (#prcs_process_instance, $prcsname)

Now again another Example

  
!*******************************************************************************
begin-procedure Get_Runcntl_Defn
!*******************************************************************************

!Get Process Name By Process Instance 
do Get-Process-Name (#prcs_process_instance, $prcsname)

Begin-Select
PNLGRPNAME &COMPONENT
			FROM PS_PRCSDEFNPNL
			WHERE PRCSNAME = $prcsname
End-Select

Begin-Select
PF.RECNAME
PF.FIELDNAME
PF.LBLTEXT

		Let $RecordName = 'PS_' || &PF.RECNAME
		do Get_Runcntl_Page_Value
		FROM PSPNLGROUP PG, PSPNLFIELD PF
			WHERE PG.PNLGRPNAME = &COMPONENT
			AND PF.PNLNAME = PG.PNLNAME
			AND PF.RECNAME <> ' '
			AND PF.FIELDNAME <> ' '
		    AND EXISTS ( SELECT 1
					FROM PSRECFIELD
					WHERE RECNAME = PF.RECNAME
					AND FIELDNAME = 'OPRID'
					AND FIELDNUM = 1
				)
			ORDER BY PF.RECNAME, PF.FIELDNUM
End-Select
End-Procedure

Hope this Helps šŸ™‚
Please let me know your Suggestion or any Correction.

I have also attached the eoprcsnm.sqc

Download the eoprcsnm.sqc
Also you can find it to your PS_HOME/sqr Folder

2 replies on “How to Get Process Name by Process Instance Using PeopleSoft SQR”

Hey hi nayan I went through it bt I cant understand the use of eoprcs sqc what I understand is that is it basically used for calling process name???

Kunal For your clarification eoprcsnm.sqc is delivered by PeopleSoft that contain

!********************************
begin-procedure Get-Process-Name (#prcs_process_instance, :$prcsname)
!********************************
Begin-SELECT 
P.PRCSNAME  
FROM PSPRCSRQST P
WHERE P.PRCSINSTANCE = #prcs_process_instance

End-SELECT
  
   let $prcsname = RTRIM(&P.PRCSNAME,' ') 

End-Procedure !Get-Process-Name

So either you can include eoprcsnm.sqc file at bottom of your primary sqr programme then call

do Get-Process-Name (#prcs_process_instance, $prcsname)

where you need.
As i mention in the blog post if you think that i will not include the sqc file then simplay copy paste the procedure code in your sqr programme and call them.
hopefully you can get understand easily, also let me knwo if any doubt.

Leave a Reply

Your email address will not be published. Required fields are marked *