blanchap
23rd April 2018, 23:02
Hi,

trying to insert record in tfacp1110s000 with an AFS.

stpapi.put.field("tfgld1100m000", "tfgld100.year", str$(year.x))
stpapi.put.field("tfgld1100m000", "tfgld100.btno", btno.x)
rc = stpapi.find("tfgld1100m000", errmsg)
if rc <> 1 then
stpapi.end.session("tfgld1100m000")
end()
endif

stpapi.handle.subproc("tfgld1100m000", "tfgld1101s000", "add")
stpapi.continue.process("tfgld1100m000", errmsg)
if not isspace(errmsg) then
stpapi.end.session("tfgld1101s000")
stpapi.end.session("tfgld1100m000")
end()
endif

stpapi.put.field("tfgld1101s000", "tfgld101.year", str$(year.x))
stpapi.put.field("tfgld1101s000", "tfgld101.btno", btno.x)
stpapi.put.field("tfgld1101s000", "tfgld101.ttyp", ttyp.z)
rc = stpapi.find("tfgld1101s000", errmsg)
if rc <> 1 then
stpapi.end.session("tfgld1101s000")
stpapi.end.session("tfgld1100m000")
end()
endif

stpapi.handle.subproc("tfgld1101s000", "tfacp1110s000", "add")
stpapi.continue.process("tfgld1101s000", errmsg)
if not isspace(errmsg) then
stpapi.end.session("tfgld1110s000")
stpapi.end.session("tfgld1101s000")
stpapi.end.session("tfgld1100m000")
end()
endif

stpapi.put.field("tfacp1110s000", "tfacp200.ttyp", ttyp.z)
stpapi.put.field("tfacp1110s000", "tfacp200.docn", str$(seq.number))
stpapi.put.field("tfacp1110s000", "tfacp200.suno", str$(tdwsl750.suno))
stpapi.put.field("tfacp1110s000", "tfacp200.docd", str$(date.num()))
stpapi.put.field("tfacp1110s000", "screen.amnt", str$(tdwsl750.amnt))
stpapi.put.field("tfacp1110s000", "tfacp200.isup", tdwsl750.invn)
stpapi.put.field("tfacp1110s000", "tfacp200.vatc", "020")
stpapi.put.field("tfacp1110s000", "tfacp200.vaty", "2017")
stpapi.put.field("tfacp1110s000", "tfacp200.vatp", "11")
stpapi.put.field("tfacp1110s000", "way.bill", "1")
stpapi.put.field("tfacp1110s000", "weight", "1")
stpapi.put.field("tfacp1110s000", "unit", "LB")
rc = stpapi.insert("tfacp1110s000", true, errmsg)
if not isspace(errmsg) then
stpapi.end.session("tfacp1110s000")
stpapi.end.session("tfacp1101s000")
stpapi.end.session("tfgld1100m000")
end()
endif

ran it in debug and it's all ok until i reach the stpapi.insert
once i reach that line, it hangs. does not go anywhere. no error message.

am i missing something?

Thanks

tmannais
25th April 2018, 05:03
Maybe it has a message/question that the program needs to acknowledge first before proceeding to the next line. In this case, there is nothing handle that situation so it waits forever. That is my first guess. I suggest you check this out.

mark_h
25th April 2018, 15:29
We are on 4c4. Below is snippet of code of my code for one session.


|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

blanchap
30th April 2018, 15:11
thanks for all the info.
problem was a missing value