Parameters
| iiMasterObjectID | input | integer | |
| iiRedundantObjectId | input | integer | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bsharedsetmerge.p)
/* Method To change the PayFormat id of the redundandt object */
/* to fetch records linked with RedundantObjectId */
<Q-61 run BankNumberByParentPayFormat (all) (Read) (NoCache)
(input iiRedundantObjectId, (ParentObjectId)
input 'GL':U, (BankNumberParentType)
input ?, (BankNumberIsDefault)
input ?, (CompanyId)
output dataset tqBankNumberByParentPayFormat) in BBankNumber>
for each tqBankNumberByParentPayFormat :
create tBankPayFormatRedundant .
buffer-copy tqBankNumberByParentPayFormat to tBankPayFormatRedundant .
end.
/* to fetch records linked with MAsterObjectId */
<Q-77 run BankNumberByParentPayFormat (all) (Read) (NoCache)
(input iiMasterObjectId, (ParentObjectId)
input 'GL':U, (BankNumberParentType)
input ?, (BankNumberIsDefault)
input ?, (CompanyId)
output dataset tqBankNumberByParentPayFormat) in BBankNumber>
for each tqBankNumberByParentPayFormat :
create tBankPayFormatMaster .
buffer-copy tqBankNumberByParentPayFormat to tBankPayFormatMaster .
end.
/* Go through all payment formats (source and target). */
for each tBankPayFormatMaster :
for each tBankPayFormatRedundant :
/* If the payment format is "the same", the one in the source entity will be removed */
if tBankPayFormatMaster.tcPayFormatTypeCode = tBankPayFormatRedundant.tcPayFormatTypeCode
then do :
vclist = vclist + ( if viBatch = 0 then "" else chr(4)) + string(tBankPayFormatRedundant.tiBankPayFormat_ID1) .
viBatch = viBatch + 1 .
assign vcStatement = 'for each DPaySel where ':U +
'DPaySel.BankPayFormat_ID = &1 ':U
vcStatement = substitute(vcStatement, tBankPayFormatRedundant.tiBankPayFormat_ID1).
<M-12 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>
if viFcReturnSuper <> 0 then assign oiReturnStatus= viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
<M-74 run WriteDirect
(input 'DPaySel':U (icTableName),
input vcStatement (icPrepare),
input 'BankPayFormat_ID':U (icFieldList),
input 'l':U (icFieldListDataTypes),
input tBankPayFormatMaster.tiBankPayFormat_ID1 (icAbsolute),
input '':U (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in Progress>
if viFcReturnSuper = -4 then assign viFcReturnSuper = 0.
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
assign vcStatement = 'for each PaySel where ':U +
'PaySel.BankPayFormat_ID = &1 ':U
vcStatement = substitute(vcStatement, tBankPayFormatRedundant.tiBankPayFormat_ID1).
<M-86 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>
if viFcReturnSuper <> 0 then assign oiReturnStatus= viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
<M-13 run WriteDirect
(input 'PaySel':U (icTableName),
input vcStatement (icPrepare),
input 'BankPayFormat_ID':U (icFieldList),
input 'l':U (icFieldListDataTypes),
input tBankPayFormatMaster.tiBankPayFormat_ID1 (icAbsolute),
input '':U (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in Progress>
if viFcReturnSuper = -4 then assign viFcReturnSuper = 0.
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
assign vcStatement = 'for each BankNumber where ':U +
'BankNumber.BankPayFormat_ID = &1 ':U
vcStatement = substitute(vcStatement, tBankPayFormatRedundant.tiBankPayFormat_ID1).
<M-66 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>
if viFcReturnSuper <> 0 then assign oiReturnStatus= viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
<M-32 run WriteDirect
(input 'BankNumber':U (icTableName),
input vcStatement (icPrepare),
input 'BankPayFormat_ID':U (icFieldList),
input 'l':U (icFieldListDataTypes),
input tBankPayFormatMaster.tiBankPayFormat_ID1 (icAbsolute),
input '':U (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in Progress>
if viFcReturnSuper = -4 then assign viFcReturnSuper = 0.
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
end .
else do :
assign vcStatement = 'for each BankPayFormat where ':U +
'BankPayFormat.BankNumber_ID = &1 ':U
vcStatement = substitute(vcStatement, tBankPayFormatRedundant.tiBankNumber_ID).
<M-82 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BSharedSetMerge>
if viFcReturnSuper <> 0 then assign oiReturnStatus= viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
<M-6 run WriteDirect
(input 'BankPayFormat':U (icTableName),
input vcStatement (icPrepare),
input 'BankNumber_ID':U (icFieldList),
input 'l':U (icFieldListDataTypes),
input tBankPayFormatMaster.tiBankNumber_ID (icAbsolute),
input '':U (icIncremental),
input {&TARGETPROCEDURE} (ihClass),
input vcUserLogin (icUserLogin),
output viFcReturnSuper (oiReturnStatus)) in Progress>
if viFcReturnSuper = -4 then assign viFcReturnSuper = 0.
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave .
end .
end.
end.
/* To delete the Redundant Pay Format Records */
if viBatch > 0
then do :
if viBankPayFormatID = 0 or viBankPayFormatID = ?
then do:
<I-62 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BBankPayFormat"}>
end. /* if viBankPayFormatID = 0 or viBankPayFormatID = ? */
else do:
<I-16 {bFcOpenInstance
&CLASS = "BBankPayFormat"}>
end. /* if viBankPayFormatID <> 0 and viBankPayFormatID <> ? */
<M-39 run DataLoad
(input ? (icRowids),
input vclist (icPkeys),
input ? (icObjectIds),
input ? (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BBankPayFormat>
if viFcReturnSuper = -4 then assign viFcReturnSuper = 0.
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper .
<M-68 run DataDelete (output viFcReturnSuper (oiReturnStatus)) in BBankPayFormat>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
<M-44 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BBankPayFormat>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
end.