rrankinmba
11th February 2010, 02:49
My invoice api script appears to handle everything correctly for non-matched invoices. It can create multiple invoices with multiple g/l lines and by all appearances the amounts balance.
After ending each of the sessions tfgld1101m000, tfacp1110s000, and tfacp1120s000 the transactions session tfgld1101 has a new line -785 Purchase Invoice Approval and the two batch status tables are not ready for finalization. tfgld101 has a status message, "Not all documents balanced".
If I use GTM to clean the two batch status tables then the batch will finalize. It seems that I am missing something on the return to the main session.
If anyone has come across this before I'd appreciate some insight.
Thanks,
Bob
rrankinmba
11th February 2010, 18:25
I've been looking through the tables and in the tfgld102 Non-finalized transactions table the control line does not have an amount and its' background indicator = Non-processed.
It makes me think that I am missing something during the insert into tfacp1120s000.
mark_h
11th February 2010, 21:29
Well I really can not say what the problem might be, but double check all the input fields and make sure they get set correctly and the baan tables correctly reflect these values. I know there have been a couple cases where I litterally had to play with the api code to get them to work - some cases an insert alone would not work and I had to use save followed by insert to get it to work. I don't know this for a fact that this is the case, but these are the only thing I can think of - short of calling infor to get new objects.
Below is the only code I have involving tfacp1120s000 and I really can not talk about how the session works. Been years since I have looked at this, but we still use this code.
function api.create.invoice()
{
domain tcmcs.str80 hold.msg
|Active the tfacp1110s000 session.
stpapi.continue.process("tfgld1101s000", e.msg)
| Clear insert mode.
stpapi.save("tfacp1110s000",e.msg)
| Add the new record - note isup and refr must be unique on our system.
stpapi.put.field("tfacp1110s000", "tfacp200.suno", strip$(tfudi030.suno))
stpapi.put.field("tfacp1110s000", "tfacp200.isup", str$(tfudi030.isup))
stpapi.put.field("tfacp1110s000", "tfacp200.docd", str$(date.num()))
stpapi.put.field("tfacp1110s000", "tfacp200.refr", tfudi035.pref & str$(sel.refr))
stpapi.put.field("tfacp1110s000", "screen.amnt", str$(round(tfudi030.amnt, 2, 0)))
stpapi.put.field("tfacp1110s000", "tfacp200.reas", tfudi030.reas )
stpapi.handle.subproc("tfacp1110s000", "tfacp1120s000", "add")
rc = stpapi.insert("tfacp1110s000", 1, e.msg)
if not isspace(e.msg) then
stpapi.end.session("tfacp1110s000")
return
endif
|Insert the account on tfacp1120s000
stpapi.put.field("tfacp1120s000", "tfgld102.leac", tfudi030.leac)
rc = stpapi.insert("tfacp1120s000", 1, e.msg)
if not isspace(e.msg) then
stpapi.end.session("tfacp1120s000")
hold.msg = e.msg
stpapi.delete("tfacp1110s000", true, e.msg)
e.msg = hold.msg
stpapi.end.session("tfacp1110s000")
return
endif
| End the two sessions
stpapi.end.session("tfacp1120s000")
stpapi.end.session("tfacp1110s000")
}