Steps to create a Process flow trigger on GL20 changes (From M.Graham).
Overview:
There are 3 main steps to creating a process flow trigger in GL20:
1. Create code for a process flow trigger in either a COBOL user exit or Design Studio.
These instructions show you how to create a trigger in COBOL user exit code in files GL20EPD & GL20EWS (where “E” is an “End” user exit .
2. Process Flow Designer
Create a process flow, save it, and upload it to the server.
3. Process Flow Administration Tool
Create a service (4 steps) Detail Steps:
Create a service (4 steps)
1. COBOL user exit:
a. Create a trigger in a COBOL user exit in files GL20EPD & GL20EWS (where “E” = “End” user exit). See example code below.
b. Compile the user exit: qcompile –u dev90 if gl20e Verify no errors exist.
c. Compile the program: qcompile dev90 if gl20 Verify no errors exist.
GL20EWS
000100******************************************************************
000200* GL201EWS *
000300******************************************************************
GL20EPD
Note that the GL20EPD file must have the same number of sections as the GL20PD file.
*MG. 03/10/11 - Process flow trigger for GL20
******************************************************************
GL20ES1-TRANSACTION SECTION 10.
GL20ES1-START.
IF (GL20F1-FC NOT = "C")
GO TO GL20ES1-TRANSACTION-END.
*-----------------------------------------------------
*Check if workflow is enabled for the service
*-----------------------------------------------------------
PERFORM 1000-OPEN-WORKFLOW-DB.
INITIALIZE WFAPI-INPUT
WFAPI-OUTPUT.
IF (GL20F1-FC = "C")
MOVE "GL20E.1_C" TO WFAPI-I-SERVICE.
MOVE GL20F1-GLN-COMPANY TO WFAPI-I-CRITERION-1.
MOVE GL20F1-GLN-ACCT-UNIT TO WFAPI-I-CRITERION-2.
PERFORM 1000-WF-SERVICE.
IF (WFAPI-O-RETURN-CODE NOT = ZEROS)
*-------------------------------------------------------------
*Create work unit header
INITIALIZE WFAPI-INPUT.
MOVE WFAPI-O-SERVICE TO WFAPI-I-SERVICE.
MOVE WFAPI-O-AGENT TO WFAPI-I-AGENT.
MOVE WFAPI-O-PROCEDURE TO WFAPI-I-PROCEDURE.
MOVE 1 TO WFAPI-I-WORK-PRIORITY.
MOVE WFAPI-O-WORKUNIT TO WFAPI-I-WORKUNIT.
MOVE WFAPI-O-FILE TO WFAPI-I-FILE.
MOVE "GLNSET1" TO WFAPI-I-OBJECT-NAME.
MOVE GL20F1-GLN-COMPANY TO WFAPI-I-KEY-VALUE(1).
MOVE GL20F1-GLN-ACCT-UNIT TO WFAPI-I-KEY-VALUE(2).
MOVE SPACES TO WFAPI-I-WORK-TITLE.
STRING "GL20 Acct Unit " GL20F1-GLN-ACCT-UNIT
DELIMITED BY SIZE INTO WFAPI-I-WORK-TITLE.
MOVE "Acct Unit" TO WFAPI-I-WORK-CATEGORY.
INITIALIZE WFAPI-OUTPUT.
PERFORM 1000-WF-CREATE-SETUP.
*----------------------------------------------------------
*Create work unit variables
MOVE "Company" TO WFAPI-I-VARIABLE-NAME(1).
MOVE "S" TO WFAPI-I-VARIABLE-TYPE(1).
MOVE GL20F1-GLN-COMPANY TO WFAPI-I-VARIABLE-VAL (1).
MOVE "AcctUnit" TO WFAPI-I-VARIABLE-NAME(2).
MOVE "S" TO WFAPI-I-VARIABLE-TYPE(2).
MOVE GL20F1-GLN-ACCT-UNIT TO WFAPI-I-VARIABLE-VAL (2).
MOVE "PersonResp" TO WFAPI-I-VARIABLE-NAME(3).
MOVE "S" TO WFAPI-I-VARIABLE-TYPE(3).
MOVE GL20F1-GLN-PERSON-RESP TO WFAPI-I-VARIABLE-VAL (3).
MOVE "PostingFlag" TO WFAPI-I-VARIABLE-NAME(4).
MOVE "S" TO WFAPI-I-VARIABLE-TYPE(4).
MOVE GL20F1-GLN-POSTING-FLAG TO WFAPI-I-VARIABLE-VAL (4).
MOVE "ChartSection" TO WFAPI-I-VARIABLE-NAME(5).
MOVE "S" TO WFAPI-I-VARIABLE-TYPE(5).
MOVE GL20F1-GLN-CHART-SECTION TO WFAPI-I-VARIABLE-VAL(5).
PERFORM 1000-WF-ADD-VAR-SETUP.
PERFORM 1000-PROCESS-FLOW.
*Release Work Unit
PERFORM 1000-WF-RELEASE-SETUP.
GL20ES1-TRANSACTION-END.
GL20ES2-TRANSACTION SECTION 10.
GL20ES2-START.
GL20ES2-TRANSACTION-END.
GL20ES3-TRANSACTION SECTION 10.
GL20ES3-START.
GL20ES3-TRANSACTION-END.
GL20ES4-TRANSACTION SECTION 10.
GL20ES4-START.
GL20ES4-TRANSACTION-END.
GL20ES5-TRANSACTION SECTION 10.
GL20ES5-START.
GL20ES5-TRANSACTION-END.
GL20ES6-TRANSACTION SECTION 10.
GL20ES6-START.
GL20ES6-TRANSACTION-END.
GL20ES7-TRANSACTION SECTION 10.
GL20ES7-START.
GL20ES7-TRANSACTION-END.
GL20ES8-TRANSACTION SECTION 10.
GL20ES8-START.
GL20ES8-TRANSACTION-END.
GL20ES9-TRANSACTION SECTION 10.
GL20ES9-START.
GL20ES9-TRANSACTION-END.
2. Process Flow Administration Tool:
Create a service in the Process Flow Administration Tool. There are 4 steps to create a service as shown below:
a. Service Definition
Add a service named ‘GL20E.1_C” and enable it, where “GL20” = program name, “E”= End user exit, “.1” = part of token name, “C”=Change function code.
Product = ERP
Status = Enabled
b. Service Variables Definition:
Inquire on the service ‘GL20E.1_C”. Add variable names, indicating which fields are key fields, the size, and type. The variable names must be spelled the same as in the COBOL user exit file GL20EPD. Click the ‘PROCESS’ button to save it.
c. Service Criteria Level Definition:
Inquire on the service ‘GL20E.1_C”. Then add a blank record in the data area. Click the ‘PROCESS’ button to save it.
d. Service Process Definition:
Inquire on the service ‘GL20E.1_C”.
Select the process flow filename. Note: Before you can select the process flow filename, you must create the process flow filename in the Process Flow Designer, then upload the file to the server, as shown in step 3 below.
Select Event Type=”EVT_PFLOW”.
3. Process Flow Designer
a. Create a process flow and save it with a filename such as, ‘gl20.xml’.
b. Upload the process flow to the server by selecting PROCESS>>UPLOAD TO SERVER:
Task Name: PFIAdmin
Process Description: Enter a description of the process flow, such as ‘GL20 change trigger’
Verify a workunit gets created:
Verify that process flow creates a workunit when you make a change to GL20:
a. Run GL20, inquire on an account unit, and click the “Change” button.
b. Verify that a workunit was created by going into the Process Flow Administration Tool and click on “Workunit” on the left menu. The workunit will be either the last one created or one of the last ones created.