/* ===> This is a dynamically generated PeopleCode template to be used only as a helper to the application developer.

You need to replace all references to '[*]' OR default values with references t o PeopleCode variables and/or a Rec.Fields. */ Local Local Local Local Local Local Local File &fileLog; ApiObject &oSession, &oGenlDedDataCi; ApiObject &oGenlDedCd2; ApiObject &oGenlDedCdCollection, &oGenlDedCd; ApiObject &oGenlDeductionCollection, &oGenlDeduction; ApiObject &oGvtBondTmpVwCollection, &oGvtBondTmpVw; ApiObject &oBondTmpVwCollection, &oBondTmpVw; errorHandler() ApiObject &oPSMessageCollection, &oPSMessage; number &i; string &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType;

Function Local Local Local

&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; &rs2 = CreateRowset(Record.CX_GEN_DED_TMP1); &rs2.fill(); rem &num_read = &rs2.fill(" WHERE FLAG IN ('N')"); For &i = 1 To &rs2.activerowcount try rem ***** Set the Log File *****; &fileLog = GetFile("C:\Users\user-21\AppData\Local\Temp\GENL_DED_DATA_CI.l og", "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 *****; &oGenlDedDataCi = &oSession.GetCompIntfc(CompIntfc.GENL_DED_DATA_CI); If &oGenlDedDataCi = Null Then errorHandler(); throw CreateException(0, 0, "GetCompIntfc failed");

End-If; rem ***** Set the Component Interface Mode *****; &oGenlDedDataCi.InteractiveMode = True; &oGenlDedDataCi.GetHistoryItems = True; &oGenlDedDataCi.EditHistoryItems = True; rem ***** Set Component Interface Get/Create Keys *****; &oGenlDedDataCi.EMPLID = &rs2.getrow(&i).CX_GEN_DED_TMP1.EMPLID.value; &fileLog.WriteLine("&oGenlDedDataCi.EMPLID = " | &oGenlDedDataCi.EMPLID); &oGenlDedDataCi.COMPANY = &rs2.getrow(&i).CX_GEN_DED_TMP1.COMPANY.value; &DEDCODE = &rs2.getrow(&i).CX_GEN_DED_TMP1.DEDCD.value; rem ***** Execute Get *****; If Not &oGenlDedDataCi.Get() Then rem ***** No rows exist for the specified keys.*****; errorHandler(); throw CreateException(0, 0, "Get failed"); End-If; rem ***** Begin: Get/Set Component Interface Properties *****; &oGenlDedCdCollection = &oGenlDedDataCi.GENL_DED_CD; &oGenlDedCd2 = &oGenlDedDataCi.GENL_DED_CD.ItemByKeys(&DEDCODE); &fileLog.WriteLine("Value found = " | &oGenlDedCd2); rem &fileLog.WriteLine("Value found at row number = " | &oGenlDedCd2.ItemN um); rem &fileLog.WriteLine("Number of rows= " | &oGenlDedCdCollection.ItemNum) ; rem If &oGenlDedCdCollection.ItemNum = True Then; If All(&oGenlDedCd2) Then rem If All(&oGenlDedCd2) And &oGenlDedCdCollection.ItemNum = True Then; rem If &oGenlDedCdCollection.ItemNum = True Then; rem Local integer &i110g; rem &i110g = &oGenlDedCd2.ItemNum; &fileLog.WriteLine("Value found = " | &oGenlDedCd2.ItemNum); &oGenlDedCd = &oGenlDedCdCollection.Item(&oGenlDedCd2.ItemNum); &oGenlDedCd.DEDCD = &rs2.getrow(&i).CX_GEN_DED_TMP1.DEDCD.value; &fileLog.WriteLine("&oGenlDedCd.DEDCD = " | &oGenlDedCd.DEDCD); rem ***** Set/Get GENL_DEDUCTION Collection Field Properties -- Parent: GENL_DED_CD Collection *****; &oGenlDeductionCollection = &oGenlDedCd.GENL_DEDUCTION; rem Local integer &i212; rem For &i212 = 1 To &oGenlDeductionCollection.Count; &oGenlDeduction = &oGenlDeductionCollection.InsertItem(1); &oGenlDeduction.EFFDT = &rs2.getrow(&i).CX_GEN_DED_TMP1.EFFDT.value; &fileLog.WriteLine("&oGenlDeduction.EFFDT = " | &oGenlDeduction.EFFDT); &oGenlDeduction.DED_CALC = &rs2.getrow(&i).CX_GEN_DED_TMP1.DED_CALC.val ue; &fileLog.WriteLine("&oGenlDeduction.DED_CALC = " | &oGenlDeduction.DED_ CALC); &oGenlDeduction.DEDUCTION_END_DT = &rs2.getrow(&i).CX_GEN_DED_TMP1.DEDU

CTION_END_DT.value; &fileLog.WriteLine("&oGenlDeduction.DEDUCTION_END_DT = " | &oGenlDeduct ion.DEDUCTION_END_DT); &oGenlDeduction.DED_ADDL_AMT = &rs2.getrow(&i).CX_GEN_DED_TMP1.DED_ADDL _AMT.value; &fileLog.WriteLine("&oGenlDeduction.DED_ADDL_AMT = " | &oGenlDeduction. DED_ADDL_AMT); &oGenlDeduction.DED_RATE_PCT = &rs2.getrow(&i).CX_GEN_DED_TMP1.DED_RATE _PCT.value; &fileLog.WriteLine("&oGenlDeduction.DED_RATE_PCT = " | &oGenlDeduction. DED_RATE_PCT); &oGenlDeduction.GOAL_AMT = &rs2.getrow(&i).CX_GEN_DED_TMP1.GOAL_AMT.val ue; &fileLog.WriteLine("&oGenlDeduction.GOAL_AMT = " | &oGenlDeduction.GOAL _AMT); &oGenlDeduction.GOAL_BAL = &rs2.getrow(&i).CX_GEN_DED_TMP1.GOAL_BAL.val ue; &fileLog.WriteLine("&oGenlDeduction.GOAL_BAL = " | &oGenlDeduction.GOAL _BAL); &oGenlDeduction.LOAN_INT_PCT = &rs2.getrow(&i).CX_GEN_DED_TMP1.LOAN_INT _PCT.value; &fileLog.WriteLine("&oGenlDeduction.LOAN_INT_PCT = " | &oGenlDeduction. LOAN_INT_PCT); &oGenlDeduction.PROCESS_DEDN = &rs2.getrow(&i).CX_GEN_DED_TMP1.PROCESS_ DEDN.value; &fileLog.WriteLine("&oGenlDeduction.PROCESS_DEDN = " | &oGenlDeduction. PROCESS_DEDN); rem End-For; Else rem Local integer &i212; rem For &i212 = 1 To &oGenlDeductionCollection.Count; &oGenlDedCd3 = &oGenlDedCdCollection.Item(1); rem &string = &oGenlDedCdCollection.GetPropertyByName(&oGenlDedCd3.DEDC D); &fileLog.WriteLine("&oGenlDedCd3.DEDCD = " | &oGenlDedCd3.DEDCD); If All(&oGenlDedCd3.DEDCD) Then; &oGenlDedCd = &oGenlDedCdCollection.InsertItem(1); &oGenlDedCd.DEDCD = &rs2.getrow(&i).CX_GEN_DED_TMP1.DEDCD.value; &fileLog.WriteLine("&oGenlDedCd.DEDCD = " | &oGenlDedCd.DEDCD); rem ***** Set/Get GENL_DEDUCTION Collection Field Properties -- Pare nt: GENL_DED_CD Collection *****; &oGenlDeductionCollection = &oGenlDedCd.GENL_DEDUCTION; Local integer &i213; For &i213 = 1 To &oGenlDeductionCollection.Count; &oGenlDeduction = &oGenlDeductionCollection.Item(&i213); &oGenlDeduction.EFFDT = &rs2.getrow(&i).CX_GEN_DED_TMP1.EFFDT.val ue; &fileLog.WriteLine("&oGenlDeduction.EFFDT = " | &oGenlDeduction.E FFDT); &oGenlDeduction.DED_CALC = &rs2.getrow(&i).CX_GEN_DED_TMP1.DED_CA

LC.value; &fileLog.WriteLine("&oGenlDeduction.DED_CALC = " | &oGenlDeductio n.DED_CALC); &oGenlDeduction.DEDUCTION_END_DT = &rs2.getrow(&i).CX_GEN_DED_TMP 1.DEDUCTION_END_DT.value; &fileLog.WriteLine("&oGenlDeduction.DEDUCTION_END_DT = " | &oGenl Deduction.DEDUCTION_END_DT); &oGenlDeduction.DED_ADDL_AMT = &rs2.getrow(&i).CX_GEN_DED_TMP1.DE D_ADDL_AMT.value; &fileLog.WriteLine("&oGenlDeduction.DED_ADDL_AMT = " | &oGenlDedu ction.DED_ADDL_AMT); &oGenlDeduction.DED_RATE_PCT = &rs2.getrow(&i).CX_GEN_DED_TMP1.DE D_RATE_PCT.value; &fileLog.WriteLine("&oGenlDeduction.DED_RATE_PCT = " | &oGenlDedu ction.DED_RATE_PCT); &oGenlDeduction.GOAL_AMT = &rs2.getrow(&i).CX_GEN_DED_TMP1.GOAL_A MT.value; &fileLog.WriteLine("&oGenlDeduction.GOAL_AMT = " | &oGenlDeductio n.GOAL_AMT); &oGenlDeduction.GOAL_BAL = &rs2.getrow(&i).CX_GEN_DED_TMP1.GOAL_B AL.value; &fileLog.WriteLine("&oGenlDeduction.GOAL_BAL = " | &oGenlDeductio n.GOAL_BAL); &oGenlDeduction.LOAN_INT_PCT = &rs2.getrow(&i).CX_GEN_DED_TMP1.LO AN_INT_PCT.value; &fileLog.WriteLine("&oGenlDeduction.LOAN_INT_PCT = " | &oGenlDedu ction.LOAN_INT_PCT); &oGenlDeduction.PROCESS_DEDN = &rs2.getrow(&i).CX_GEN_DED_TMP1.PR OCESS_DEDN.value; &fileLog.WriteLine("&oGenlDeduction.PROCESS_DEDN = " | &oGenlDedu ction.PROCESS_DEDN); End-For; Else &oGenlDedCd = &oGenlDedCdCollection.Item(1); &oGenlDedCd.DEDCD = &rs2.getrow(&i).CX_GEN_DED_TMP1.DEDCD.value; &fileLog.WriteLine("&oGenlDedCd.DEDCD = " | &oGenlDedCd.DEDCD); rem ***** Set/Get GENL_DEDUCTION Collection Field Properties -- Pare nt: GENL_DED_CD Collection *****; &oGenlDeductionCollection = &oGenlDedCd.GENL_DEDUCTION; Local integer &i214; For &i214 = 1 To &oGenlDeductionCollection.Count; &oGenlDeduction = &oGenlDeductionCollection.Item(&i214); &oGenlDeduction.EFFDT = &rs2.getrow(&i).CX_GEN_DED_TMP1.EFFDT.val ue; &fileLog.WriteLine("&oGenlDeduction.EFFDT = " | &oGenlDeduction.E FFDT); &oGenlDeduction.DED_CALC = &rs2.getrow(&i).CX_GEN_DED_TMP1.DED_CA LC.value; &fileLog.WriteLine("&oGenlDeduction.DED_CALC = " | &oGenlDeductio

n.DED_CALC); &oGenlDeduction.DEDUCTION_END_DT = &rs2.getrow(&i).CX_GEN_DED_TMP 1.DEDUCTION_END_DT.value; &fileLog.WriteLine("&oGenlDeduction.DEDUCTION_END_DT = " | &oGenl Deduction.DEDUCTION_END_DT); &oGenlDeduction.DED_ADDL_AMT = &rs2.getrow(&i).CX_GEN_DED_TMP1.DE D_ADDL_AMT.value; &fileLog.WriteLine("&oGenlDeduction.DED_ADDL_AMT = " | &oGenlDedu ction.DED_ADDL_AMT); &oGenlDeduction.DED_RATE_PCT = &rs2.getrow(&i).CX_GEN_DED_TMP1.DE D_RATE_PCT.value; &fileLog.WriteLine("&oGenlDeduction.DED_RATE_PCT = " | &oGenlDedu ction.DED_RATE_PCT); &oGenlDeduction.GOAL_AMT = &rs2.getrow(&i).CX_GEN_DED_TMP1.GOAL_A MT.value; &fileLog.WriteLine("&oGenlDeduction.GOAL_AMT = " | &oGenlDeductio n.GOAL_AMT); &oGenlDeduction.GOAL_BAL = &rs2.getrow(&i).CX_GEN_DED_TMP1.GOAL_B AL.value; &fileLog.WriteLine("&oGenlDeduction.GOAL_BAL = " | &oGenlDeductio n.GOAL_BAL); &oGenlDeduction.LOAN_INT_PCT = &rs2.getrow(&i).CX_GEN_DED_TMP1.LO AN_INT_PCT.value; &fileLog.WriteLine("&oGenlDeduction.LOAN_INT_PCT = " | &oGenlDedu ction.LOAN_INT_PCT); &oGenlDeduction.PROCESS_DEDN = &rs2.getrow(&i).CX_GEN_DED_TMP1.PR OCESS_DEDN.value; &fileLog.WriteLine("&oGenlDeduction.PROCESS_DEDN = " | &oGenlDedu ction.PROCESS_DEDN); End-For; End-If; rem End-For; End-If;

rem ***** End: Get/Set Component Interface Properties *****; rem ***** Execute Save *****; If Not &oGenlDedDataCi.Save() Then; errorHandler(); throw CreateException(0, 0, "Save failed"); End-If; rem ***** Execute Cancel *****; If Not &oGenlDedDataCi.Cancel() Then; errorHandler(); throw CreateException(0, 0, "Cancel failed"); End-If; catch Exception &ex

rem Handle the exception; &fileLog.WriteLine(&ex.ToString()); end-try; End-For; &fileLog.WriteLine("End"); &fileLog.Close();