AWE Mass Approval

The sample chapter for my PeopleTools Tips and Techniques book (Chapter 3) contains all of the steps required to add AWE to a PeopleSoft transaction. A colleague who recently used this chapter to AWE enable a transaction asked me how to mass approve transactions. Most of the code required to mass approve transactions is actually on the last page of Chapter 3. Here is an expanded template with placeholders. Just wrap this in a loop and wire it up to a button, App Engine, or some other execution environment.

Local "syntax-KEYWORD3">Record &headerRec "syntax-OPERATOR">= CreateRecord("syntax-KEYWORD3">Record.NAME_OF_AWE_HEADER_RECORD);  
Local EOAW_CORE:ApprovalManager &apprManager;
Local "syntax-KEYWORD3">string &processId "syntax-OPERATOR">= /*"syntax-COMMENT1"> hard"syntax-COMMENT1"> coded"syntax-COMMENT1"> value"syntax-COMMENT1"> goes"syntax-COMMENT1"> here"syntax-COMMENT1"> */;

REM"syntax-COMMENT2"> **"syntax-COMMENT2"> Populate"syntax-COMMENT2"> approval"syntax-COMMENT2"> header"syntax-COMMENT2"> record"syntax-COMMENT2"> keys"syntax-COMMENT2"> here"syntax-COMMENT2">;
&headerRec.GetField(Field.KEY1)."syntax-KEYWORD2">Value = "syntax-COMMENT1">/* "syntax-COMMENT1">Key "syntax-COMMENT1">1 "syntax-COMMENT1">from "syntax-COMMENT1">scroll "syntax-COMMENT1">*/
&headerRec.GetField(Field.KEY2)."syntax-KEYWORD2">Value = "syntax-COMMENT1">/* "syntax-COMMENT1">Key "syntax-COMMENT1">2 "syntax-COMMENT1">from "syntax-COMMENT1">scroll "syntax-COMMENT1">*/
...

&apprManager = "syntax-KEYWORD1">create EOAW_CORE:ApprovalManager(&processId, &headerRec, %OperatorId);

If (&apprManager.hasAppInst) "syntax-KEYWORD1">Then
&apprManager.DoApprove(&headerRec);
Else
REM"syntax-COMMENT2"> **"syntax-COMMENT2"> throw"syntax-COMMENT2"> error"syntax-COMMENT2">;
End-If;

Each time through the loop, update the header record values, acquire a new instance of the ApprovalManager, and execute DoApprove.