rrankinmba
9th February 2010, 23:35
My script is not inserting a record in tfacp1120s000. The error is "Ledger account not allowed". I've been kicking this one around for too long so any help would be appreciated.

function domain tcbool add.transaction()
{
stpapi.get.field("tfacp1110s000", "tfacp200.ninv", save.ninv)
stpapi.get.field("tfacp1110s000", "tfacp200.lino", save.line)

stpapi.put.field("tfacp1110s000","tfacp200.ttyp", whntr500.ttyp)
stpapi.put.field("tfacp1110s000","tfacp200.appr", save.ninv)
stpapi.put.field("tfacp1110s000","tfacp200.ddue",str$(whntr500.docd))
stpapi.put.field("tfacp1110s000","tfacp200.ifbp",whntr500.ifbp)
stpapi.put.field("tfacp1110s000","tfacp200.isup",whntr500.isup)
retval = stpapi.find("tfacp1110s000", err.msg)

if retval <> 1 then
return(false)
endif

retval = stpapi.mark("tfacp1110s000", err.msg)

if retval <> 1 then
return(false)
endif

stpapi.handle.subproc("tfacp1110s000","tfacp1120s000","add")
stpapi.form.command("tfacp1110s000",5,"exec.cont.process",err.msg)

stpapi.put.field("tfacp1120s000","tfgld102.cono",str$(whntr500.comp))
stpapi.put.field("tfacp1120s000","tfgld102.year",str$(whntr500.year))
stpapi.put.field("tfacp1120s000","tfgld102.btno", save.btno)
stpapi.put.field("tfacp1120s000","tfgld102.ttyp",whntr500.ttyp)
stpapi.put.field("tfacp1120s000","tfgld102.docn", save.ninv)
stpapi.put.field("tfacp1120s000","tfgld102.line", save.line)
stpapi.put.field("tfacp1120s000","tfgld102.tcom",str$(whntr500.comp))

stpapi.put.field("tfacp1120s000","tfgld102.ccty",whntr500.ccty)
stpapi.put.field("tfacp1120s000","amount",str$(whntr500.amnt))
stpapi.put.field("tfacp1120s000","tfgld102.dbcr",str$(whntr500.dbcr))
stpapi.put.field("tfacp1120s000","tfgld102.vamt",str$(whntr500.vamnt))

stpapi.put.field("tfacp1120s000","tfgld102.ddue",whntr500.leac)
if check.dim1() then
stpapi.put.field("tfacp1120s000","tfgld102.dim1",whntr500.dim1)
stpapi.put.field("tfacp1120s000","tfgld102.dim2",whntr500.dim2)
endif
stpapi.put.field("tfacp1120s000","tfgld102.dim3",whntr500.dim3)
stpapi.put.field("tfacp1120s000","tfgld102.dim4",whntr500.dim4)

retval = stpapi.insert("tfacp1120s000",0,err.msg)

if retval <> 1 then
return(false)
endif

return(true)
}

rrankinmba
10th February 2010, 00:16
The posted script had stpapi.insert( ,0, ). I was trying one suggestion on the board which was to make the insert false and follow it with a save.

rrankinmba
10th February 2010, 00:33
Amazing how you can over look something for the better part of a day.
stpapi.put.field("tfacp1120s000","tfgld102.ddue",whntr500.leac)

Amit_Jain
10th February 2010, 08:15
check this line

stpapi.put.field("tfacp1120s000","tfgld102.ddue",whntr500.leac)

it should be

stpapi.put.field("tfacp1120s000","tfgld102.leac",whntr500.leac)

rrankinmba
10th February 2010, 16:11
Amit ... thanks for the reply. I spent over half a day making other changes until this simple mistake solve the problem.
Not that I am done by any means. It just keeps getting better.