rrankinmba
26th January 2010, 23:43
I'm familiar with calling one session from another session in BaanIV and had a bit of an opportunity to work with DAL in LN.
Now I am in a BaanV environment and need to call the invoicing sessions - tfgld1101m000 and tfacp1110s000. None of the tables have DALs.
I understand that the same call to the sessions (i.e. stpapi.put.field ...) work in BaanV. If that is right then how are the declarations written.
Thanks.
sameer.don
27th January 2010, 10:09
are you asking for syntax of stpapi function?
_Ralph_
27th January 2010, 13:47
Make a search in this forum: http://www.baanboard.com/baanboard/forumdisplay.php?f=59
rrankinmba
27th January 2010, 16:20
Thanks for the help ... I am familiar with the scripting ...
I have searched and haven't found the declaration syntax.
BaanIV #pragma used dll ottstpapihand
I can see that object in the shell, but should it be declared. If so how or should I be referencing something else in the declarations?
rrankinmba
27th January 2010, 16:39
Ahh ... I see the error in my ways ...
I moved the declaration into the function instead of a the program level.
Thanks all.
rrankinmba
28th January 2010, 20:53
My script is getting an error "Record already exists" whenever I use the insert. I assume that the problem is no new batch number.
I've see lots of posted script but have not been successful. Any/all help would be appreciated.
stpapi.synchronize.dialog("tfgld1101m000", "add", err.msg)
stpapi.put.field("tfgld1101m000","tedf.f", str$(whntr500.docd))
stpapi.put.field("tfgld1101m000","fprd.f", str$(whntr500.year))
stpapi.put.field("tfgld1101m000","bref.f", whntr500.bref)
stpapi.put.field("tfgld1101m000","fprd.f", str$(whntr500.fprd))
stpapi.put.field("tfgld1101m000","vaty.f", str$(whntr500.vaty))
stpapi.put.field("tfgld1101m000","vatp.f", str$(whntr500.vatp))
stpapi.put.field("tfgld1101m000","tfgld101.ttyp", whntr500.ttyp)
retval = stpapi.insert("tfgld1101m000", 1, err.msg)
mark_h
29th January 2010, 18:49
Not familiar with V, but why the sync dialog? We use tfgld1100m000 and tfgld1101s000 to create the batch and transaction. See below - not sure how different these sessions are in baan v.
num.to.date(date.num(), c.yyyy, c.mm, c.dd)
c.btno = get.next.btno(c.yyyy)
c.fprd = get.cur.fiscal.period()
c.rprd = get.cur.report.period()
c.vprd = get.cur.tax.period()
sess.gld1100 = "tfgld1100m000"
sess.gld1101 = "tfgld1101s000"
| 1. tfgld1100m000 (Maintain Transactions)
| 1.0 Input Batch data
stpapi.put.field(sess.gld1100, "tfgld100.tedt", str$(date.num()))
stpapi.put.field(sess.gld1100, "tfgld100.year", str$(c.yyyy))
stpapi.put.field(sess.gld1100, "tfgld100.btno", str$(c.btno))
stpapi.put.field(sess.gld1100, "tfgld100.bref", sprintf$("Contractor Labor (%02d/%02d/%02d)", mm,dd,yyyy\100))
stpapi.put.field(sess.gld1100, "tfgld100.fprd", str$(c.fprd))
stpapi.put.field(sess.gld1100, "tfgld100.rprd", str$(c.rprd))
stpapi.put.field(sess.gld1100, "tfgld100.vyer", str$(c.yyyy))
stpapi.put.field(sess.gld1100, "tfgld100.vprd", str$(c.vprd))
| 1.1 Insert a batch record
rc = stpapi.insert(sess.gld1100, 1, e.msg)
if not isspace(e.msg) then
stpapi.end.session(sess.gld1100)
return
endif
save.year = c.yyyy | used to update the contractor pro forma header
save.btno = c.btno
stpapi.get.field(sess.gld1100, "tfgld100.tedt", io.fld)
io.date = lval(io.fld)
str.date = num.to.date$(io.date, 2)
| Start Session tfgld1101s000 ... Insert CTR transaction holder
stpapi.handle.subproc(sess.gld1100, sess.gld1101, "add")
| 1.2 Select Continue button
stpapi.continue.process(sess.gld1100, e.msg)
| stpapi.get.field(sess.gld1101,"tedt.f",io.fld)
| stpapi.get.field(sess.gld1101,"tfgld101.year",io.fld)
| stpapi.get.field(sess.gld1101,"tfgld101.btno",io.fld)
| stpapi.get.field(sess.gld1101,"fyer.f",io.fld)
| stpapi.get.field(sess.gld1101,"fprd.f",io.fld)
| stpapi.get.field(sess.gld1101,"ryer.t",io.fld)
| stpapi.get.field(sess.gld1101,"rprd.t",io.fld)
| stpapi.get.field(sess.gld1101,"vyer.f",io.fld)
| stpapi.get.field(sess.gld1101,"vprd.f",io.fld)
|
stpapi.save(sess.gld1101,e.msg)
| 2. tfgld1101s000 (Maintain Transactions)
| 2.0 Input Batch transaction type
stpapi.put.field(sess.gld1101, "tfgld101.ttyp", "CTR")
| 2.1 Insert a CTR transaction into that batch
rc = stpapi.insert(sess.gld1101, 1, e.msg)
if not isspace(e.msg) then
stpapi.end.session(sess.gld1101)
stpapi.end.session(sess.gld1100)
return
endif
}
rrankinmba
29th January 2010, 19:41
Mark ... thanks for the reply.
I've gotten past tfgld1100m000 and am now working on the subsession tfacp1110s000. The trick is getting the multi-occurrence record in tfgld1100m000 marked in order that the exec.cont.process command is available. ("Command disabled" error) There are a few examples on the board of both the error and invoicing. Here's my code.
stpapi.put.field("tfgld1101m000", "tedt.f", str$(whntr500.docd))
stpapi.put.field("tfgld1101m000", "tfgld101.year", str$(whntr500.year))
retval = stpapi.change.view("tfgld1101m000", err.msg)
stpapi.put.field("tfgld1101m000","tfgld101.ttyp", whntr500.ttyp)
retval = stpapi.insert("tfgld1101m000", 1, err.msg)
if retval <> 1 then
stpapi.recover("tfgld1101m000", err.msg)
stpapi.end.session("tfgld1101m000")
whntr500.emsg = err.msg
db.update(twhntr500,db.retry)
commit.transaction()
continue
else
retval = stpapi.save("tfgld1101m000", err.msg)
retval = tpapi.browse.set("tfgld1101m000","last.set")
stpapi.get.field("tfgld1101m000", "tfgld101.btno",str.btno)
stpapi.get.field("tfgld1101m000", "tfgld101.ttyp",curr.typ)
stpapi.mark("tfgld1101m000", err.msg)
|stpapi.form.command("tfgld1101m000",5,"exec.cont.process",err.msg)
stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add")
stpapi.continue.process("tfgld1101m000", err.msg)
stpapi.put.field("tfacp1110s000","tfacp200.ifbp",whntr500.ifbp)
stpapi.put.field("tfacp1110s000","tfacp200.isup",whntr500.isup)
stpapi.put.field("tfacp1110s000","tfacp200.amnt",str$(whntr500.amnt))
retval = stpapi.insert("tfacp1110s000",1,err.msg)