hredgert
16th March 2005, 16:56
I'm trying to develop a input for purchase invoices in c4 and have some questions. When startting the tfgld1101m000 it needs a form GoTo command to clear the input fields, how to manage that ?. It does not seems to work the stpapi.clear command. Also it seems that the stpapi.continue.process not exist in the c4, even though it's in the docu.

Below is the asf part of the script, any suggestions are appreciated.

if first.line then
| Here should be a form GoTo command to clear the fields (don't exist) ?
tfgld1101m000f.clear()
tfgld1101m000f.put.transaction_entry_date(in.date)
tfgld1101m000f.put.fiscal_year(in.year)
tfgld1101m000f.put.batch_reference(in.bref)
tfgld1101m000f.put.fiscal_period(in.fper)
tfgld1101m000f.put.reporting_period(in.rper)
tfgld1101m000f.put.tax_period(in.tper)
rv = tfgld1101m000f.update(0, errmess)
tfgld1101m000f.put.transaction_type_code(in.ttyp)
rv = tfgld1101m000f.insert(1, errmess)
rv = tfgld1101m000f.mark(errmess)
while true
errmess = tfgld1101m000f.get.last.message.code()
if isspace(errmess) then
break
else
log.write(errmess)
endif
endwhile
if rv = 1 then
afs.main.ok = true
tfgld1101m000f.handle.sub.process("tfacp1110s000", "add")
| Here should be a continue.process (don't exist) ?
first.line = false
else
afs.main.ok = false
log.write(errmess)
log.write(w.row)
endif
endif
if afs.main.ok then
| Here should the recs be added in tfacp1110s000
endif

Regards

H Redgert

mark_h
16th March 2005, 22:02
Actually - Just wrote this code for tfgld1101m000 yesterday. This creates a new batch for me every run:


function domain tcbool create.header()
{
long rc
long curr.tax.period
curr.tax.period = get.cur.tax.period()

| Always insert a new batch
stpapi.put.field("tfgld1101m000","tedt.df",str$(date.num()))
stpapi.put.field("tfgld1101m000","tfgld101.year",str$(year.f))
stpapi.put.field("tfgld1101m000","fprd.f",str$(peri.f))
stpapi.put.field("tfgld1101m000","rprd.f",str$(peri.f))
stpapi.put.field("tfgld1101m000","bref.f","Surrogate Burden Process")
stpapi.put.field("tfgld1101m000","vyer.f",str$(year.f))
stpapi.put.field("tfgld1101m000","vprd.f",str$(curr.tax.period))
rc = stpapi.change.view("tfgld1101m000",errmsg)

stpapi.put.field("tfgld1101m000","tfgld101.ttyp","JSB")
rc = stpapi.insert("tfgld1101m000", true, errmsg)
if rc = 0 or not isspace(errmsg) then
return(true)
endif
stpapi.get.field("tfgld1101m000","tfgld101.btno",errmsg)
batch.number = val(errmsg)
stpapi.end.session("tfgld1101m000",errmsg)
return(false)
}


Now the sub-session I will be running is tfgld1115s000 - trying to test that in my spare time today. So first make sure you have current stpapi patches. Second update your user profile so we can see what Baan version you are using - makes a difference in responses. Third not sure if this is what you are looking for - does this help?

Mark

hredgert
17th March 2005, 11:29
The batch header is created ok, now for creation of the subrecs in tfacp1110s000. I activate the subprocess and accoding the docs I shuld the post the stpapi.continue command. In my version it's do not seems to exist, so then there is only the possability to use the zoom to, but in that case the main script logig is not used correctly.

Actual version is B40_c4 service pack 12

Any ideas are appreciated

H Redgert

mark_h
17th March 2005, 14:06
First make sure you have the latest stpapi patches and session objects for your system. This works on Baan 4C4 latest service pack - not sure of the number:


sess.gld1100 = "tfgld1100m000"
sess.gld1101 = "tfgld1101s000"
sess.acp1110 = "tfacp1110s000"
rc = stpapi.browse.set(sess.gld1101, "last.set", e.msg)

| 2.3 Select Transaction button (continue option)
stpapi.handle.subproc(sess.gld1101, sess.acp1110, "add")
stpapi.continue.process(sess.gld1101, e.msg)

stpapi.save(sess.acp1110,e.msg)

| 3. tfacp1110s000 (Maintain Pur Inv)
| 3.0 Input pur inv data
stpapi.put.field(sess.acp1110, "tfacp200.ttyp", "CTR")
stpapi.put.field(sess.acp1110, "tfacp200.ninv", "22")
stpapi.put.field(sess.acp1110, "ref.po", strip$(tccom020.refa))
stpapi.put.field(sess.acp1110, "tfacp200.suno", strip$(tccom001.namb))
t.refr = sprintf$("%02d%02d%02d%02d%s", mm, dd, yyyy\100, tfgld911.serc, strip$(tccom001.nama))
stpapi.put.field(sess.acp1110, "tfacp200.isup", t.refr)
stpapi.put.field(sess.acp1110, "tfacp200.docd", sprintf$("%02d%02d%d", mm, dd, yyyy))
t.refr = sprintf$("C%-06d %02d%02d%02d%02d", tccom001.emno, mm, dd, yyyy\100, tfgld911.serc)
stpapi.put.field(sess.acp1110, "tfacp200.refr", t.refr)
stpapi.put.field(sess.acp1110, "screen.amnt", str$(round(tfgld911.amnt, 2, 0)))
stpapi.put.field(sess.acp1110, "tfacp200.reas", "5")
stpapi.put.field(sess.acp1110, "tfacp200.orno", strip$(tccom020.refa))

stpapi.get.field(sess.acp1110, "tfacp200.orno", io.fld)
stpapi.put.field(sess.acp1110, "tfacp200.orno", strip$(tccom020.refa))

| 3.1 Insert a purchase invoice
stpapi.handle.subproc(sess.acp1110, sess.acp1230, "add")
rc = stpapi.insert(sess.acp1110, 1, e.msg)
if not isspace(e.msg) then
stpapi.end.session(sess.acp1110)
return
endif


The above code actually works by calling tfgld1100m000, then tfgld1101s000, then activates tfacp1110s000. As you can see the tfgld1101s000 command does work with the stpapi.continue.

Mark