baan.tools
10th September 2007, 13:11
Sorry for late reply... The problem which i was getting was sloved and i am getting another error mentioned at the end of my code...
Please find below the code
stpapi.put.field("tfgld1101m000","tedt.f",str$(date.num()))
stpapi.put.field("tfgld1101m000","tfgld101.year",str$(2007))
stpapi.put.field( "tfgld1101m000", "tfgld101.btno", str$(00))
stpapi.put.field("tfgld1101m000","bref.f",str$("Test"))
stpapi.put.field("tfgld1101m000","fprd.f",str$(09))
stpapi.put.field("tfgld1101m000","rprd.f",str$(03))
stpapi.put.field("tfgld1101m000","vyer.f",str$(2007))
stpapi.put.field("tfgld1101m000","vprd.f",str$(09))
rc = stpapi.change.view("tfgld1101m000",errmsg)
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","O99")
rc = stpapi.insert("tfgld1101m000", true, errmsg)
stpapi.get.field("tfgld1101m000","tfgld101.btno",errmsg)
batch.number = val(errmsg)
stpapi.end.session("tfgld1101m000",errmsg)
rc = stpapi.browse.set("tfgld1101m000", "last.set", w.err.msg)
stpapi.put.field("tfgld1101m000", "tfgld101.year", str$(2007))
stpapi.put.field("tfgld1101m000", "tfgld101.btno", str$(batch.number))
stpapi.put.field("tfgld1101m000", "tfgld101.ttyp", str$("O99"))
ret = stpapi.find("tfgld1101m000", error.msg)
if rc <> 0 then
rc = stpapi.mark("tfgld1101m000", w.err.msg)
endif
if rc <> 0 then
stpapi.form.command("tfgld1101m000", 5, "exec.cont.process",error.msg)
endif
if isspace(w.err.msg) then
stpapi.put.field("tfgld1114s000", "tfgld102.docn", str$(123456))
stpapi.put.field("tfgld1114s000", "dcdt.f", str$(date.num()))
stpapi.put.field("tfgld1114s000", "ccur.f", str$("EUR"))
stpapi.put.field("tfgld1114s000", "tfgld102.tcom", str$(360))
stpapi.put.field("tfgld1114s000", "tfgld102.leac", str$("70199999"))
stpapi.put.field("tfgld1114s000", "form.amnt", str$(50))
stpapi.put.field("tfgld1114s000", "dbcr", str$(etol(tfgld.dbcr.debit)))
stpapi.put.field("tfgld1114s000", "refr", str$("Interface Payee"))
rc = stpapi.insert("tfgld1114s000",true, e.msg)
if rc = 0 then
rc = stpapi.recover("tfgld1114s000", w.err.msg)
endif
endif
stpapi.end.session("tfgld1114s000",e.msg)
stpapi.end.session("tfgld1101m000",e.msg)
Here i am getting another error The indicator of counted double for the account general is not authorized here when saving the session tfgld1114s000.
Please help me regarding this..
mojo1980
29th November 2007, 20:53
Hi,
I'm trying to do a very similar thing, and I'm running into a problem. I'm using baanIV. When running the script with debug mode, when reaching stpapi.continue.process, it gets stuck at that point.
Any idea what's going on?
Thanks
if rc <> 0 then │
│ 0068: |stpapi.form.command("tfgld1101m000", 5, "exec.│
│ 0069: stpapi.continue.process("tfgld1101m000", error.│
│ 0070: endif
mojo1980
30th November 2007, 15:11
Hi, I actually found some code in another thread, it works, but now I'm trying to create more than 1 transaction withnin the same Batch. The message error (code in RED) gives me: Batch/Transaction Type Already used.
If I change view, I get a new batch number. And that's not what I want.
Sorry if I don't use all the correct terms, I'm a newbie with baan.
Thanks for help.
CODE
| Switch the view
if stpapi.change.view("tfgld1101m000", error.msg) > 0 then
stpapi.put.field("tfgld1101m000", "tfgld101.ttyp" , "JIN")
stpapi.put.field("tfgld1101m000", "tfgld101.amnt" , str$(0.00))
| Insert Transaction
ret = stpapi.insert("tfgld1101m000", 1, error.msg)
if not ret then
message("Insert Error for PM1 = %s ", error.msg)
ret2 = stpapi.recover("tfgld1101m000", error.msg)
endif
ret = stpapi.save("tfgld1101m000", error.msg)
if not ret then
message("Save Error for PM1 = %s ", error.msg)
ret2 = stpapi.recover("tfgld1101m000", error.msg)
endif
stpapi.put.field("tfgld1101m000", "tfgld101.ttyp" , "JEM")
stpapi.put.field("tfgld1101m000", "tfgld101.amnt" , str$(0.00))
ret = stpapi.insert("tfgld1101m000", 1, error.msg)
if not ret then
message("Insert Error for PM1 = %s ", error.msg)
ret2 = stpapi.recover("tfgld1101m000", error.msg)
endif
ret = stpapi.save("tfgld1101m000", error.msg)
if not ret then
message("Save Error for PM1 = %s ", error.msg)
ret2 = stpapi.recover("tfgld1101m000", error.msg)
endif
endif
RET = stpapi.browse.set("tfgld1101m000", "last.set")
ret = stpapi.mark("tfgld1101m000", error.msg)
stpapi.handle.subproc("tfgld1101m000", "tfgld1103s000", "add")
stpapi.continue.process("tfgld1101m000", error.msg)
if stpapi.change.view("tfgld1103s000", error.msg) > 0 then
stpapi.put.field("tfgld1103s000", "tfgld102.ttyp", str$("JIN"))
stpapi.put.field("tfgld1103s000", "tfgld102.docn", str$(28))
stpapi.put.field("tfgld1103s000", "ccur.d", str$("CAD"))
stpapi.put.field("tfgld1103s000", "ccty.f", str$("CAN"))
stpapi.put.field("tfgld1103s000", "dcdt.f", str$(date.num()))
stpapi.put.field("tfgld1103s000", "rate.f", str$(1.000000))
stpapi.put.field("tfgld1103s000", "vyer.f",str$(2008))
stpapi.put.field("tfgld1103s000", "vprd.f",str$(08))
stpapi.put.field("tfgld1103s000", "tfgld102.lino", str$(1))
stpapi.put.field("tfgld1103s000", "tfgld102.tcom", str$(300))
stpapi.put.field("tfgld1103s000", "tfgld102.leac", str$(1234567))
stpapi.put.field("tfgld1103s000", "tfgld102.dim2", str$("1234"))
stpapi.put.field("tfgld1103s000", "form.amnt", str$(150.00))
stpapi.put.field("tfgld1103s000", "tfgld102.dbcr", str$(etol(tfgld.dbcr.debit)))
stpapi.put.field("tfgld1103s000", "tfgld102.refr", str$("TESTER"))
rc = stpapi.insert("tfgld1103s000", 1, e.msg)
if rc = 0 then
rc = stpapi.recover("tfgld1103s000", w.err.msg)
endif
stpapi.put.field("tfgld1103s000", "tfgld102.ttyp", str$("JIN"))
stpapi.put.field("tfgld1103s000", "tfgld102.docn", str$(28))
stpapi.put.field("tfgld1103s000", "ccur.d", str$("CAD"))
stpapi.put.field("tfgld1103s000", "ccty.f", str$("CAN"))
stpapi.put.field("tfgld1103s000", "dcdt.f", str$(date.num()))
stpapi.put.field("tfgld1103s000", "rate.f", str$(1.000000))
stpapi.put.field("tfgld1103s000", "vyer.f",str$(2008))
stpapi.put.field("tfgld1103s000", "vprd.f",str$(08))
stpapi.put.field("tfgld1103s000", "tfgld102.lino", str$(2))
stpapi.put.field("tfgld1103s000", "tfgld102.tcom", str$(300))
stpapi.put.field("tfgld1103s000", "tfgld102.leac", str$(1234567))
stpapi.put.field("tfgld1103s000", "tfgld102.dim2", str$("1234"))
stpapi.put.field("tfgld1103s000", "form.amnt", str$(150.00))
stpapi.put.field("tfgld1103s000", "tfgld102.dbcr", str$(etol(tfgld.dbcr.credit)))
stpapi.put.field("tfgld1103s000", "tfgld102.refr", str$("TESTER"))
rc = stpapi.insert("tfgld1103s000", 1, e.msg)
endif
stpapi.end.session("tfgld1103s000")
RET = stpapi.browse.set("tfgld1101m000", "first.set")
ret = stpapi.mark("tfgld1101m000", error.msg)
stpapi.handle.subproc("tfgld1101m000", "tfgld1103s000", "add")
stpapi.continue.process("tfgld1101m000", error.msg)
if stpapi.change.view("tfgld1103s000", error.msg) > 0 then
stpapi.put.field("tfgld1103s000", "tfgld102.ttyp", str$("JIN"))
stpapi.put.field("tfgld1103s000", "tfgld102.docn", str$(28))
stpapi.put.field("tfgld1103s000", "ccur.d", str$("CAD"))
stpapi.put.field("tfgld1103s000", "ccty.f", str$("CAN"))
stpapi.put.field("tfgld1103s000", "dcdt.f", str$(date.num()))
stpapi.put.field("tfgld1103s000", "rate.f", str$(1.000000))
stpapi.put.field("tfgld1103s000", "vyer.f",str$(2008))
stpapi.put.field("tfgld1103s000", "vprd.f",str$(08))
stpapi.put.field("tfgld1103s000", "tfgld102.lino", str$(1))
stpapi.put.field("tfgld1103s000", "tfgld102.tcom", str$(300))
stpapi.put.field("tfgld1103s000", "tfgld102.leac", str$(1234567))
stpapi.put.field("tfgld1103s000", "tfgld102.dim2", str$("1234"))
stpapi.put.field("tfgld1103s000", "form.amnt", str$(90.00))
stpapi.put.field("tfgld1103s000", "tfgld102.dbcr", str$(etol(tfgld.dbcr.debit)))
stpapi.put.field("tfgld1103s000", "tfgld102.refr", str$("TESTER"))
rc = stpapi.insert("tfgld1103s000", 1, e.msg)
if rc = 0 then
rc = stpapi.recover("tfgld1103s000", w.err.msg)
endif
stpapi.put.field("tfgld1103s000", "tfgld102.ttyp", str$("JIN"))
stpapi.put.field("tfgld1103s000", "tfgld102.docn", str$(28))
stpapi.put.field("tfgld1103s000", "ccur.d", str$("CAD"))
stpapi.put.field("tfgld1103s000", "ccty.f", str$("CAN"))
stpapi.put.field("tfgld1103s000", "dcdt.f", str$(date.num()))
stpapi.put.field("tfgld1103s000", "rate.f", str$(1.000000))
stpapi.put.field("tfgld1103s000", "vyer.f",str$(2008))
stpapi.put.field("tfgld1103s000", "vprd.f",str$(08))
stpapi.put.field("tfgld1103s000", "tfgld102.lino", str$(2))
stpapi.put.field("tfgld1103s000", "tfgld102.tcom", str$(300))
stpapi.put.field("tfgld1103s000", "tfgld102.leac", str$(1234567))
stpapi.put.field("tfgld1103s000", "tfgld102.dim2", str$("1234"))
stpapi.put.field("tfgld1103s000", "form.amnt", str$(90.00))
stpapi.put.field("tfgld1103s000", "tfgld102.dbcr", str$(etol(tfgld.dbcr.credit)))
stpapi.put.field("tfgld1103s000", "tfgld102.refr", str$("TESTER"))
rc = stpapi.insert("tfgld1103s000", 1, e.msg)
if rc = 0 then
rc = stpapi.recover("tfgld1103s000", w.err.msg)
endif
endif
stpapi.end.session("tfgld1103s000")
stpapi.end.session("tfgld1101m000")