KiranKrishna
4th November 2022, 19:46
Hi,
Required DLL for Batch finalization in transactions session (tfgld1101m000) to automated the process.
Thanks & Regards,
Kiran Krishna.
mark_h
4th November 2022, 21:16
Not sure I get the questions - but going to move it to tools. Are you looking for a name of a DLL? You can get some information just running bic_info6.2 (your version could be different) on the object.
KiranKrishna
5th November 2022, 05:47
Hi,
Thanks Mark.
I didn't know the batch finalization dll. Either update the dll or process to know the dll for the batch finalization.
Regards,
Kiran Krishna.
vahdani
16th November 2022, 02:29
Hi Kiran,
as far as I know there is no DLL for for batch finalization. A long long time ago I had to find a way to do the same and I did this by calling the finalizing session in my program! Here is the relevant code. I hope this can work for you!
table ttfgld100 | Batches
function extern domain tcbool txglddll0001.finalize.batch(
domain tfgld.year i.year, |Fin. Year
domain tfgld.btno i.btno,|Batch
ref domain tctext o.emsg) |Error message
{
string dummy.str(10)
domain tcmcs.str13 save.prog.name$
extern domain tfgld.date tedt.f
extern domain tfgld.prod fprd.f
extern domain tfgld.prod rprd.f
g.emsg = ""
|check and finalize batch
select tfgld100.*
from tfgld100
where tfgld100._index1 = {:i.year, :i.btno}
selectdo
if not((tfgld100.tstt = tfgld.tstt.free or
tfgld100.tstt = tfgld.tstt.errors) and
tfgld100.stat = tfgld.bstt.ready) then
g.emsg = "Batch-Status is not correct!"
endif
selectempty
g.emsg = "Batch does not exist!"
endselect
if isspace(g.emsg) then
if not all.batch.lines.ready() then
g.emsg = "Not all batch lines are ready!"
endif
endif
if isspace(g.emsg) then
if errors.exist() then
g.emsg = "Batch is not error free!"
endif
endif
if isspace(g.emsg) then
if get.session.permission("tfcmg1210m000") = 0 then
g.emsg = "No allowance for journalization!"
g.emsg = ""
endif
endif
if tfgld100.itbc <> tcyesno.yes then
|make batch modifiable in order to finalize!
db.retry.point()
select *
from tfgld100 for update
where year = :tfgld100.year
and btno = :tfgld100.btno
selectdo
tfgld100.itbc = tcyesno.yes
db.update(ttfgld100, db.retry)
endselect
commit.transaction()
endif
if isspace(g.emsg) then
|Pretend we are tfgld1101m000!!!
save.prog.name$ = prog.name$
prog.name$ = "tfgld1101m000"
tedt.f = tfgld100.tedt
fprd.f = tfgld100.fprd
rprd.f = tfgld100.rprd
tfgld101.year = tfgld100.year
tfgld101.btno = tfgld100.btno
dummy.str = start.session(MODAL,"tfgld1210m000","tfgld1101m000","")
|* Global Selection of Batches for Finalization
prog.name$ = save.prog.name$
|now check result!!
select tfgld100.*
from tfgld100
where tfgld100._index1 = {:i.year, :i.btno}
selectdo
if tfgld100.tstt <> tfgld.tstt.terminated then
g.emsg = "Batch could not be journalized!"
endif
endselect
endif
o.emsg = g.emsg
return(isspace(o.emsg))
}
function domain tcbool errors.exist()
{
domain tcbool rec.found
rec.found = false
select tfgld105.mesn
from tfgld105
where tfgld105._index1 = { :tfgld101.year, :tfgld101.btno }
as set with 1 rows
selectdo
rec.found = true
endselect
return(rec.found)
}
function domain tcbool all.batch.lines.ready()
{
domain tcbool all.ready
all.ready = true
select tfgld101.ttyp, tfgld101.stat
from tfgld101
where tfgld101._index1 = { :tfgld100.year, :tfgld100.btno }
and not (tfgld101.stat = tfgld.bstt.ready
or tfgld101.stat = tfgld.bstt.errors
or tfgld101.stat = tfgld.bstt.open.free)
as set with 1 rows
selectdo
all.ready = false
endselect
return(all.ready)
}