iiSourceDomainID | input | integer | Source Domain ID |
icCOACrossRefCode | input | character | COA Cross Reference Code |
iiCOACrossRefID | input | integer | COA Cross Reference ID |
icCOACrossRefType | input | character | COA Cross Reference Type (If not coming from UI, this can be left blank. It will be retrieved from COA Cross Reference from the database) |
tApiCOACrossRefDet | input | temp-table | COA Cross Reference Detail (If not coming from UI, this can be left blank. It will be retrieved from COA Cross Reference from the database) |
ilSkipMessages | input | logical | |
tCOACrossRefResult | input-output | temp-table | Input-Output temp-table. Input: COA combination of GL, Division, Cost Centre and Project. Output: Target GL, Division, Cost Centre, Project or Alternate COA |
oiReturnStatus | output | integer | Return status of the method. |
/* ============================================================================================= */ /* Input */ /* iiSourceDomainID */ /* icCOACrossRefCode */ /* iiCOACrossRefID */ /* icCOACrossRefType */ /* If not coming from UI, this can be left blank amnd will be retrieved from the database */ /* tApiCOACrossRefDet */ /* If not coming from UI, this can be left blank and will be retrieved from the database */ /* Contains the mapping table to apply */ /* ilSkipMessages */ /* input-output */ /* tCOACrossRefResult */ /* Input: COA combination of GL Division CostCentre and Project which need to be mapped */ /* Contains the combinations which need to be mapped */ /* Output: Target GL, Division, Cost Centre, Project or Alternate COA */ /* output oiReturnStatus */ /* ==============================================================================================*/ /* tCOACrossRefResult --> tqCOACrossRefDetByIDParentID --> tCOACrossRefResult */ /* GL GL FR-TO-Target Target GL */ /* DIV DIV FR-TO-Target Target DIV */ /* CC CC FR-TO-Target Target CC */ /* PRJ PRJ FR-TO-Target Target PRJ */ /* ==============================================================================================*/ /* Structure */ /* 0- Check Input parameters */ /* 1- Retrieve COA Cross Reference if needed */ /* 2- Retrieve Cross Reference Detail Lines */ /* 3- Go through all the supplied combinations (tCOACrossRefResult) and find the corresponding */ /* mapping (tqCOACrossRefDetByIDParentID) */ /* 3a- SEPERATE --> GetCOACrossRefSeparate */ /* 3b- OMBINED/ALTERNATE --> GetCOACrossRefAltCombined1-2-3 */ /* 4- Check if all targets could be found. Raise an error if not */ /* ==============================================================================================*/ /* source elements in tCOACrossRefResult are: */ /* tcGLCode */ /* tcDivisionCode */ /* tcCostCentreCode */ /* tcProjectCode */ /* ===================================================================== */ /* target elements in tCOACrossRefResult are: */ /* tiTargetGL_ID and tcTargetGLCode */ /* tiTargetDivision_ID and tcTargetDivisionCode */ /* tiTargetCostCentre_ID and tcTargetCostCentreCode */ /* tiTargetProject_ID and tcTargetProjectCode */ /* tlGLIsProjectAccount */ /* tlGLIsDivisionAccount */ /* tlGLIsCostCentreAccount */ /* tlGLIsSafAccount */ /* tlCostCentreIsWithSaf */ /* tlProjectIsWithSaf */ /* tcGLExchangeMethod */ /* tcExchangeRateTypeCode */ /* tiTargetAltCOAStructDet_ID and tcTargetAltCOAStructDetCode */ /* tcAltCOAStructDetDescription */ /* tcAltCOAStructDetSeq */ /* tiAltCOAStruct_ID */ /* ===================================================================== */ assign oiReturnStatus = -98 viLocalReturnStatus = 0. /* ========================================= */ /* 0- Check Input parameters */ /* ========================================= */ /* Use current domain if no source domain was specified */ if iiSourceDomainID = ? or iiSourceDomainID = 0 then assign iiSourceDomainID = viDomainID. /* COA Cross Reference Code or Type should be passed */ if (icCOACrossRefCode = ? or icCOACrossRefCode = '':U) and (iiCOACrossRefID = ? or iiCOACrossRefID = 0 ) and (icCOACrossRefType = ? or icCOACrossRefType = '':U) then do: assign vcMessage = trim(#T-1'COA Cross Reference Code, ID or Type should be passed to retrieve the correct mapping.':255(71479)T-1#) oiReturnStatus = -3. <M-2 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input '':U (icFieldName), input '':U (icFieldValue), input 'S':U (icType), input 1 (iiSeverity), input '':U (icRowid), input 'QadFin-8712':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input '':U (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> return. end. /* if icCOACrossRefCode = ? or icCOACrossRefCode = '':U */ /* ========================================= */ /* 1- Retrieve COA Cross Reference if needed */ /* ========================================= */ if (icCOACrossRefType = ? or icCOACrossRefType = '':U) or not can-find(first tApiCOACrossRefDet) then do: /* Get COAXref */ <Q-30 run COACrossRefByAll (all) (Read) (Cache) (input iiCOACrossRefID, (COACrossRefID) input iiSourceDomainID, (SourceDomainID) input ?, (TargetDomainID) input ?, (AltCOAStructID) input icCOACrossRefCode, (COACrossRefCode) input ?, (COACrossRefType) input ?, (COACrossRefIsActive) input ?, (SourceDomainCode) input ?, (TargetDomainCode) input ?, (AltCOAStructCode) output dataset tqCOACrossRefByAll) in BCOACrossRef > find tqCOACrossRefByAll where tqCOACrossRefByAll.tiSourceDomain_ID = iiSourceDomainID and (tqCOACrossRefByAll.tcCOACrossRefCode = icCOACrossRefCode or tqCOACrossRefByAll.tiCOACrossRef_ID = iiCOACrossRefID) no-error. if not available tqCOACrossRefByAll then do: assign vcMessage = trim(#T-32'COA Cross reference could not be found.':255(71444)T-32#) + chr(10) + trim(substitute(#T-33'Source Domain ID: &1':255(71411)T-33#, trim(string(iiSourceDomainID)) )) + chr(10) + trim(substitute(#T-34'COA Cross Reference Code: &1':255(71384)T-34#, trim(icCOACrossRefCode) )) + chr(10) + trim(substitute(#T-35'COA Cross Reference ID: &1':255(71412)T-35#, trim(string(iiCOACrossRefID)) )) oiReturnStatus = -3. <M-31 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input '':U (icFieldName), input '':U (icFieldValue), input 'E':U (icType), input 3 (iiSeverity), input '':U (icRowid), input 'QadFin-8716':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input '':U (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> return. end. assign icCOACrossRefType = tqCOACrossRefByAll.tcCOACrossRefType iiCOACrossRefID = tqCOACrossRefByAll.tiCOACrossRef_ID. end. /* if (icCOACrossRefType = ? and icCOACrossRefType = '':U) or */ /*========================================================= */ /* 2- Retrieve Cross Reference Detail Lines */ /* This can be from the database or from the input table */ /* Replace some wildcards where possible */ /* ======================================================== */ empty temp-table tqCOACrossRefDetByIDParentID. assign vlHasWildCards = no. if not can-find(first tApiCOACrossRefDet) then do: /* Get the mappings (COAXrefdet) from the database and put them into tqCOACrossRefDetByIDParentID */ <Q-4 run COACrossRefDetByIDParentID (all) (Read) (Cache) (input iiCOACrossRefID, (COACrossRefID) input 0, (COACrossRefDetID) input 0, (CompanyId) output dataset tqCOACrossRefDetByIDParentID) in BCOACrossRef> for each tqCOACrossRefDetByIDParentID where tqCOACrossRefDetByIDParentID.tiCOACrossRef_ID = iiCOACrossRefID: if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivTo = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCTo = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjTo = '':U. if tqCOACrossRefDetByIDParentID.tlGLIsDivisionAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsDivisionAccount = no. if tqCOACrossRefDetByIDParentID.tlGLIsCostCentreAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsCostCentreAccount = no. if tqCOACrossRefDetByIDParentID.tlGLIsProjectAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsProjectAccount = no. if tqCOACrossRefDetByIDParentID.tlGLIsSafAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsSafAccount = no. if tqCOACrossRefDetByIDParentID.tlCostCentreIsWithSaf = ? then assign tqCOACrossRefDetByIDParentID.tlCostCentreIsWithSaf = no. if tqCOACrossRefDetByIDParentID.tlProjectIsWithSaf = ? then assign tqCOACrossRefDetByIDParentID.tlProjectIsWithSaf = no. /* Replace the wildcard in case source= <string>* and to is blank */ if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = '' and num-entries (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,'*') = 2 and substring (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,length (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"character"),1,"character") = '*' then do : assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = substring (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,1, length (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"character") - 1, "character") tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom + fill ("Z",8 - length (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"Character")). end. else do: /* Determine if there are wild cards used or not */ if num-entries (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,".") > 1 or num-entries (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"*") > 1 then do: if not (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = '*' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjTo = '') then assign vlHasWildCards = yes. end. end. end. /* for each tqCOACrossRefDetByIDParentID: */ end. /* if not can-find(first tApiCOACrossRefDet) */ else do: /* Get the mappings (COAXrefdet) from the input paramter table tApiCOACrossRefDet and put them into tqCOACrossRefDetByIDParentID */ for each tApiCOACrossRefDet: create tqCOACrossRefDetByIDParentID. <M-15 run BufferCopy (input buffer tApiCOACrossRefDet:handle (ihFrom), input buffer tqCOACrossRefDetByIDParentID:handle (ihTo), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> if viFcReturnSuper < 0 then assign viLocalReturnStatus = viFcReturnSuper. assign iiCOACrossRefID = tqCOACrossRefDetByIDParentID.tiCOACrossRef_ID. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivTo = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCTo = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjFrom = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjFrom = '':U. if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjTo = ? then assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjTo = '':U. if tqCOACrossRefDetByIDParentID.tlGLIsDivisionAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsDivisionAccount = no. if tqCOACrossRefDetByIDParentID.tlGLIsCostCentreAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsCostCentreAccount = no. if tqCOACrossRefDetByIDParentID.tlGLIsProjectAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsProjectAccount = no. if tqCOACrossRefDetByIDParentID.tlGLIsSafAccount = ? then assign tqCOACrossRefDetByIDParentID.tlGLIsSafAccount = no. if tqCOACrossRefDetByIDParentID.tlCostCentreIsWithSaf = ? then assign tqCOACrossRefDetByIDParentID.tlCostCentreIsWithSaf = no. if tqCOACrossRefDetByIDParentID.tlProjectIsWithSaf = ? then assign tqCOACrossRefDetByIDParentID.tlProjectIsWithSaf = no. /* Replace the wildcard in case source= <string>* and to is blank */ if tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = '' and num-entries (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,'*') = 2 and substring (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,length (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"character"),1,"character") = '*' then do : assign tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = substring (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,1, length (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"character") - 1, "character") tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom + fill ("Z",8 - length (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"Character")). end. else do: /* Determine if there are wild cards used or not */ if num-entries (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,".") > 1 or num-entries (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom,"*") > 1 then do: if not (tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = '*' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjTo = '') then assign vlHasWildCards = yes. end. end. end. /* for each tApiCOACrossRefDet: */ end. /* else do: */ /* ============================================================================== */ /* 3- Go through all the supplied combinations (tCOACrossRefResult) and find the */ /* corresponding mapping (tqCOACrossRefDetByIDParentID) */ /* ============================================================================== */ /* ================= */ /* 3a- Type Seperate */ /* ================= */ if icCOACrossRefType = {&COACROSSREFTYPE-SEPERATE} then do: <M-69 run GetCOACrossRefSeparate (input iiCOACrossRefID (iiCOACrossRefID), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0 then assign viLocalReturnStatus = viFcReturnSuper. end. /* 3a- if icCOACrossRefType = {&COACROSSREFTYPE-SEPERATE} */ /* ============================== */ /* 3b- Types Alternate & Combined */ /* ============================== */ else if icCOACrossRefType = {&COACROSSREFTYPE-ALTERNATE} or icCOACrossRefType = {&COACROSSREFTYPE-COMBINED} then do: RESULTBLOCK: for each tCOACrossRefResult: /* =================== */ /* Clear Target fields */ /* =================== */ assign tCOACrossRefResult.tiTargetGL_ID = 0 tCOACrossRefResult.tiTargetDivision_ID = 0 tCOACrossRefResult.tiTargetCostCentre_ID = 0 tCOACrossRefResult.tiTargetProject_ID = 0 tCOACrossRefResult.tiTargetAltCOAStructDet_ID = 0 tCOACrossRefResult.tcTargetGLCode = '':U tCOACrossRefResult.tcTargetDivisionCode = '':U tCOACrossRefResult.tcTargetCostCentreCode = '':U tCOACrossRefResult.tcTargetProjectCode = '':U tCOACrossRefResult.tcTargetAltCOAStructDetCode = '':U tCOACrossRefResult.tlGLIsDivisionAccount = no tCOACrossRefResult.tlGLIsCostCentreAccount = no tCOACrossRefResult.tlGLIsProjectAccount = no tCOACrossRefResult.tlGLIsSafAccount = no tCOACrossRefResult.tlCostCentreIsWithSaf = no tCOACrossRefResult.tlProjectIsWithSaf = no vlMappingFound = no. /* Search using '=' on the Account Source Field */ <M-54 run GetCOACrossRefAltCombined1 (output vlMappingFound (olMappingFound), input iiCOACrossRefID (iiCOACrossRefID), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0 then assign viLocalReturnStatus = viFcReturnSuper. /* Search using From/Till on the Account Source field */ if not vlMappingFound then do: <M-74 run GetCOACrossRefAltCombined2 (input iiCOACrossRefID (iiCOACrossRefID), output vlMappingFound (olMappingFound), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0 then assign viLocalReturnStatus = viFcReturnSuper. end. /* Search using matches on Source Account Field */ if not vlMappingFound and vlHasWildCards then do : <M-64 run GetCOACrossRefAltCombined3 (output vlMappingFound (olMappingFound), input iiCOACrossRefID (iiCOACrossRefID), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> if viFcReturnSuper <> 0 and viLocalReturnStatus >= 0 then assign viLocalReturnStatus = viFcReturnSuper. end. /* ====================================================================================== */ /* If no mapping is found, we look for the generic line. If it exists, we copy from there */ /* ====================================================================================== */ if not vlMappingFound then do : find tqCOACrossRefDetByIDParentID where tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLFrom = '*' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcGLTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcCCTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcDivTo = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjFrom = '' and tqCOACrossRefDetByIDParentID.tcCOACrossRefDetSrcProjTo = '' no-error. if available tqCOACrossRefDetByIDParentID then assign vlMappingFound = yes tCOACrossRefResult.tcTargetGLCode = tqCOACrossRefDetByIDParentID.tcTargetGLCode tCOACrossRefResult.tiTargetGL_ID = tqCOACrossRefDetByIDParentID.tiTargetGL_ID tCOACrossRefResult.tcTargetDivisionCode = tqCOACrossRefDetByIDParentID.tcTargetDivisionCode tCOACrossRefResult.tiTargetDivision_ID = tqCOACrossRefDetByIDParentID.tiTargetDivision_ID tCOACrossRefResult.tcTargetCostCentreCode = tqCOACrossRefDetByIDParentID.tcTargetCostCentreCode tCOACrossRefResult.tiTargetCostCentre_ID = tqCOACrossRefDetByIDParentID.tiTargetCostCentre_ID tCOACrossRefResult.tcTargetProjectCode = tqCOACrossRefDetByIDParentID.tcTargetProjectCode tCOACrossRefResult.tiTargetProject_ID = tqCOACrossRefDetByIDParentID.tiTargetProject_ID tCOACrossRefResult.tcTargetAltCOAStructDetCode = tqCOACrossRefDetByIDParentID.tcTargetAltCOAStructDetCode tCOACrossRefResult.tiTargetAltCOAStructDet_ID = tqCOACrossRefDetByIDParentID.tiTargetAltCOAStructDet_ID tCOACrossRefResult.tlGLIsDivisionAccount = tqCOACrossRefDetByIDParentID.tlGLIsDivisionAccount tCOACrossRefResult.tlGLIsCostCentreAccount = tqCOACrossRefDetByIDParentID.tlGLIsCostCentreAccount tCOACrossRefResult.tlGLIsProjectAccount = tqCOACrossRefDetByIDParentID.tlGLIsProjectAccount tCOACrossRefResult.tlGLIsSafAccount = tqCOACrossRefDetByIDParentID.tlGLIsSafAccount tCOACrossRefResult.tlCostCentreIsWithSaf = tqCOACrossRefDetByIDParentID.tlCostCentreIsWithSaf tCOACrossRefResult.tlProjectIsWithSaf = tqCOACrossRefDetByIDParentID.tlProjectIsWithSaf tCOACrossRefResult.tcGLExchangeMethod = tqCOACrossRefDetByIDParentID.tcGLExchangeMethod tCOACrossRefResult.tcExchangeRateTypeCode = tqCOACrossRefDetByIDParentID.tcExchangeRateTypeCode tCOACrossRefResult.tcAltCOAStructDetDescription = tqCOACrossRefDetByIDParentID.tcAltCOAStructDetDescription tCOACrossRefResult.tcAltCOAStructDetSeq = tqCOACrossRefDetByIDParentID.tcAltCOAStructDetSeq tCOACrossRefResult.tiAltCOAStruct_ID = tqCOACrossRefDetByIDParentID.tiAltCOAStruct_ID. end. /* if vlMappingFound = no */ end. /* for each tCOACrossRefResult: */ end. /* 3b- Types Alternate & Combined */ /* ============================================================= */ /* 4- Check if all targets could be found. Raise an error if not */ /* ============================================================= */ for each tCOACrossRefResult where (tCOACrossRefResult.tiTargetGL_ID = 0 and tCOACrossRefResult.tiTargetDivision_ID = 0 and tCOACrossRefResult.tiTargetCostCentre_ID = 0 and tCOACrossRefResult.tiTargetProject_ID = 0 and tCOACrossRefResult.tiTargetAltCOAStructDet_ID = 0 and tCOACrossRefResult.tcTargetGLCode = '':U and tCOACrossRefResult.tcTargetDivisionCode = '':U and tCOACrossRefResult.tcTargetCostCentreCode = '':U and tCOACrossRefResult.tcTargetProjectCode = '':U and tCOACrossRefResult.tcTargetAltCOAStructDetCode = '':U and ilSkipMessages = false) or (icCOACrossRefType = {&COACROSSREFTYPE-SEPERATE} and ilSkipMessages = false and ((tCOACrossRefResult.tcDivisionCode <> ? and tCOACrossRefResult.tcDivisionCode <> '':U and tCOACrossRefResult.tcTargetDivisionCode = '':U) or (tCOACrossRefResult.tcCostCentreCode <> ? and tCOACrossRefResult.tcCostCentreCode <> '':U and tCOACrossRefResult.tcTargetCostCentreCode = '':U) or (tCOACrossRefResult.tcProjectCode <> ? and tCOACrossRefResult.tcProjectCode <> '':U and tCOACrossRefResult.tcTargetProjectCode = '':U))) : if iiSourceDomainID = viDomainID then assign vcDomainCodeMsg = vcDomainCode. else do: <Q-48 run DomainsPrim (all) (Read) (NoCache) (input iiSourceDomainID, (DomainID) input ?, (DomainCode) output dataset tqDomainsPrim) in BDomain> find tqDomainsPrim where tqDomainsPrim.tiDomain_ID = iiSourceDomainID no-error. if available tqDomainsPrim then assign vcDomainCodeMsg = tqDomainsPrim.tcDomainCode. else assign vcDomainCodeMsg = ''. end. assign vcMessage = trim(#T-17'Unable to find a COA Cross Reference for this combination.':255(71410)T-17#) + chr(10) + trim(substitute(#T-18'Source Domain ID: &1':255(71411)T-18#, trim(string(iiSourceDomainID)) )) + chr(10) + trim(substitute(#T-19'COA Cross Reference Code: &1':255(71384)T-19#, trim(icCOACrossRefCode) )) + chr(10) + trim(substitute(#T-20'COA Cross Reference ID: &1':255(71412)T-20#, trim(string(iiCOACrossRefID)) )) + chr(10) + trim(substitute(#T-21'GL Account Code: &1':255(71413)T-21#, trim(tCOACrossRefResult.tcGLCode) )) + chr(10) + trim(substitute(#T-22'Sub-Account Code: &1':255(71414)T-22#, trim(tCOACrossRefResult.tcDivisionCode) )) + chr(10) + trim(substitute(#T-23'Cost Center Code: &1':255(71415)T-23#, trim(tCOACrossRefResult.tcCostCentreCode) )) + chr(10) + trim(substitute(#T-24'Project Code: &1':255(71416)T-24#, trim(tCOACrossRefResult.tcProjectCode) )) vcFieldValueMsg = vcDomainCodeMsg + '-' + tCOACrossRefResult.tcGLCode + '-' + tCOACrossRefResult.tcDivisionCode + '-' + tCOACrossRefResult.tcCostCentreCode + '-' + tCOACrossRefResult.tcProjectCode. viLocalReturnStatus = -3. <M-16 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input 'Combination' (icFieldName), input vcFieldValueMsg (icFieldValue), input 'E':U (icType), input 3 (iiSeverity), input '':U (icRowid), input 'QadFin-8714':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input '':U (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BCOACrossRef> end. /* 4- for each tCOACrossRefResult: */ assign oiReturnStatus = viLocalReturnStatus.