mjpedreira1
3rd November 2009, 13:32
Hello,
I have next code. I can insert records in tfgld1101m000 session. But, when I execute Continue button with the function , the result is "Session not available" message. I need insert records into tfacp1110s000 subsession. I don´t know If I have a bad code...
Thanks,
María
function main()
{
extern string err.msg(60), recover.msg(60), sesion(13),tabla(8)
extern domain tcboolerrores
domain tcmcs.int ret
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","HGT")
stpapi.put.field("tfgld1101m000","tfgld101.tedt", str$(date.to.num(2009,11,03)))
if stpapi.insert("tfgld1101m000",1,err.msg) = 0 then
message("%s",err.msg)
else
stpapi.continue.process("tfgld1101m000", err.msg)
stpapi.put.field("tfacp1110s000","tfacp200.suno","HG0687")
stpapi.put.field("tfacp1110s000","tfacp200.amat","50")
stpapi.put.field("tfacp1110s000","tfacp200.cvat","00EN00")
stpapi.put.field("tfacp1110s000","tfacp200.refr","Prueba AFS")
stpapi.put.field("tfacp1110s000","tfacp200.isup","facturaSUNO")
stpapi.put.field("tfacp1110s000","tfacp200.docd",str$(date.to.num(2009,11,03)))
stpapi.put.field("tfacp1110s000","tfacp200.dved",str$(date.to.num(2009,11,03)))
if not stpapi.insert("tfgld1110s000",1,err.msg) then
stpapi.recover("tfgld1110s000",recover.msg)
message("%s",err.msg)
endif
stpapi.end.session("tfacp1110s000")
stpapi.end.session("tfgld1101m000")
endif
stpapi.end.session("tfgld1101m000")
}
kbartelds
3rd November 2009, 13:48
Hello,
Before using the continue.process you will have to add the subsession to the main session:
stpapi.handle.subproc("tfgld1101m000,"tfacp1110s000",add)
Since multiple records could be present in tfgld1101m000, possible a mark should be executed.
Regards,
Klaas
mjpedreira1
3rd November 2009, 14:17
Hi,
I call the function but I think I'm writing it in a wrong place. i get the same error...
if stpapi.insert("tfgld1101m000",1,err.msg) = 0 then
message("%s",err.msg)
else
stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add")
stpapi.put.field("tfacp1110s000","tfacp200.suno","HG0687") | Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.amat","50") | Importe
stpapi.put.field("tfacp1110s000","tfacp200.cvat","00EN00") | IVA exento
stpapi.put.field("tfacp1110s000","tfacp200.refr","Prueba AFS") | Referencia
stpapi.put.field("tfacp1110s000","tfacp200.isup","facturaSUNO") | Núm. factura Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.docd",str$(date.to.num(2009,11,03))) | Fecha documento
stpapi.put.field("tfacp1110s000","tfacp200.dved",str$(date.to.num(2009,11,03))) | Fecha vencimiento
stpapi.continue.process("tfacp1110s000", err.msg)
if not stpapi.insert("tfgld1110s000",1,err.msg) then
stpapi.recover("tfgld1110s000",recover.msg)
message("%s",err.msg)
endif
stpapi.end.session("tfacp1110s000")
stpapi.end.session("tfgld1101m000")
endif
mark_h
3rd November 2009, 15:05
Yes it looks like it is the wrong spot. Put it before the insert on tfgld1101m000.
kbartelds
3rd November 2009, 16:42
the correct sequence seems to me:
put fields of tfgld1101m000 and insert
handle.subproc("tfgld1101m000",tfacp1110s000",add)
mark occurrence in tfgld1101m000
stpapi.continue.process("tfgld1101m000",err.mess) (not tfacp1110s000)
put fields of tfacp1110s000 and insert
end both sessions
and of course the error handling.
Regards,
Klaas
mjpedreira1
3rd November 2009, 17:17
Sorry but I have not yet achieved... but I think I´m near...
- I don´t know how I have to mark an occurrence in tfgld1101m000
- I´ve changed the instruction stpapi.continue.process("tfgld1101m000", err.msg) instead tfacp1110s000
- I tried to put the line stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add") before the insert in tfgld1101m000 but I have the message "session is not available" again.
Thanks a lot,
María
kbartelds
4th November 2009, 09:53
Marking can be done by:
retval = stpapi.mark("tfgld1101m000",err.mess)
don't forget the recover in case marking does not succeed
Regards,
Klaas
mark_h
4th November 2009, 14:41
I have found that stpapi.mark does not always work in some cases you have to a browse or a find to the record. In our case we know the record is the only one of the batch. So here is a piece of our code and keep in mind it may not work for you.
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", str$(tfgld011.dsrn))
stpapi.put.field(sess.acp1110, "ref.po", strip$(tccom020.refa))
stpapi.put.field(sess.acp1110, "tfacp200.suno", strip$(tcudi005.suno)) | 20070518.end
rc = string.scan(tccom001.nama,"%s,%s",firsthalf,lasthalf)
lastname = shiftl$(firsthalf(1;8))
rc = string.scan(shiftl$(lasthalf),"%s %s",firstname,middileinit)
firstinit = firstname(1;1)
t.refr = sprintf$("%02d%02d%02d%04d%s%s%s", mm, dd, tfgld911.serc,inv.count, firstinit, middileinit,lastname)
stpapi.put.field(sess.acp1110, "tfacp200.isup", t.refr)
stpapi.put.field(sess.acp1110, "tfacp200.docd", str$(date.t))
t.refr = sprintf$("C%02d%02d%02d%-06d%s", mm, dd, tfgld911.serc, tccom001.emno, strip$(tccom001.nama))
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
mjpedreira1
4th November 2009, 17:24
I tried with the 2 ideas but I think I´m writing a wrong code...
Option 1:
#pragma used dll ottstpapihand
function main()
{
|table ttscmn040 | Tabla de datos temporales Hojas de gasto - Exportación desde la Intranet
|Variables generales gestión del AFS
extern string err.msg(60), recover.msg(60), sesion(13),tabla(8)
extern domain tcbool errores
|Variables del programa
extern domain tccuno cl
domain tcmcs.int ret
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","HGT") | Tipo de asiento
stpapi.put.field("tfgld1101m000","tfgld101.tedt", str$(date.to.num(2009,11,03))) | Fecha de introducción del asiento
if stpapi.insert("tfgld1101m000",1,err.msg) = 0 then
message("%s",err.msg)
else
stpapi.browse.set("tfgld1101m000", "last.set", err.msg)
stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add")
stpapi.continue.process("tfgld1101m000", err.msg)
stpapi.put.field("tfacp1110s000","tfacp200.suno","HG0687") | Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.amat","50") | Importe
stpapi.put.field("tfacp1110s000","tfacp200.cvat","00EN00") | IVA exento
stpapi.put.field("tfacp1110s000","tfacp200.refr","Prueba AFS") | Referencia
stpapi.put.field("tfacp1110s000","tfacp200.isup","facturaSUNO") | Núm. factura Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.docd",str$(date.to.num(2009,11,03))) | Fecha documento
stpapi.put.field("tfacp1110s000","tfacp200.dved",str$(date.to.num(2009,11,03))) | Fecha vencimiento
if not stpapi.insert("tfgld1110s000",1,err.msg) then
stpapi.recover("tfgld1110s000",recover.msg)
message("%s",err.msg)
endif
stpapi.end.session("tfacp1110s000")
stpapi.end.session("tfgld1101m000")
endif
stpapi.end.session("tfgld1101m000")
}
Option 2:
#pragma used dll ottstpapihand
function main()
{
|table ttscmn040 | Tabla de datos temporales Hojas de gasto - Exportación desde la Intranet
|Variables generales gestión del AFS
extern string err.msg(60), recover.msg(60), sesion(13),tabla(8)
extern domain tcbool errores
|Variables del programa
extern domain tccuno cl
domain tcmcs.int ret
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","HGT") | Tipo de asiento
||stpapi.put.field("tfgld1101m000","tfgld101.tedt", str$(date.to.num(2009,11,03))) | Fecha de introducción del asiento
if stpapi.insert("tfgld1101m000",1,err.msg) = 0 then
message("%s",err.msg)
else
stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add")
stpapi.mark("tfgld1101m000", err.msg)
stpapi.continue.process("tfgld1101m000", err.msg)
stpapi.put.field("tfacp1110s000","tfacp200.suno","HG0687") | Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.amat","50") | Importe
stpapi.put.field("tfacp1110s000","tfacp200.cvat","00EN00") | IVA exento
stpapi.put.field("tfacp1110s000","tfacp200.refr","Prueba AFS") | Referencia
stpapi.put.field("tfacp1110s000","tfacp200.isup","facturaSUNO") | Núm. factura Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.docd",str$(date.to.num(2009,11,03))) | Fecha documento
stpapi.put.field("tfacp1110s000","tfacp200.dved",str$(date.to.num(2009,11,03))) | Fecha vencimiento
if not stpapi.insert("tfgld1110s000",1,err.msg) then
stpapi.recover("tfgld1110s000",recover.msg)
message("%s",err.msg)
endif
stpapi.end.session("tfacp1110s000")
stpapi.end.session("tfgld1101m000")
endif
stpapi.end.session("tfgld1101m000")
}
mark_h
5th November 2009, 19:23
Do you always get session unavailable? It could be that you need new stpapi libraries or even new session code. In debug mode on the top set of code when stpapi.continue.process("tfgld1101m000", err.msg) gets executed does tfacp1110s000 get started? Check the processes you have running in the background. Does the create batch work?
mjpedreira1
18th November 2009, 14:41
Hello,
I was reading the code again and I´ve seen that I call the function tfgld1110s000 instead tfacp1110s000... It was the error.
But, another question. If I have to execute the cont.process twice (then I have 3 sessions opened at the same time), how I have to use the stpapi.handle.subproc function?
I type my code.
Thanks in advanced,
María
function main()
{
|table ttscmn040 | Tabla de datos temporales Hojas de gasto - Exportación desde la Intranet
|Variables generales gestión del AFS
extern string err.msg(60), recover.msg(60), sesion(13),tabla(8)
extern domain tcbool errores
|Variables del programa
extern domain tccuno cl
domain tcmcs.int ret
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","HGT") | Tipo de asiento
||stpapi.put.field("tfgld1101m000","tfgld101.tedt", str$(date.to.num(2009,11,03))) | Fecha de introducción del asiento
if stpapi.insert("tfgld1101m000",1,err.msg) = 0 then
message("%s",err.msg)
else
stpapi.handle.subproc("tfgld1101m000","tfacp1110s000","add")
stpapi.mark("tfgld1101m000", err.msg)
stpapi.continue.process("tfgld1101m000", err.msg)
stpapi.put.field("tfacp1110s000","tfacp200.suno","HG0687") | Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.amat","50") | Importe
stpapi.put.field("tfacp1110s000","tfacp200.cvat","00EN00") | IVA exento
stpapi.put.field("tfacp1110s000","tfacp200.refr","Prueba AFS miércoeles") | Referencia
stpapi.put.field("tfacp1110s000","tfacp200.isup","facturaSUNO") | Núm. factura Proveedor
stpapi.put.field("tfacp1110s000","tfacp200.docd",str$(date.to.num(2009,11,03))) | Fecha documento
stpapi.put.field("tfacp1110s000","tfacp200.dved",str$(date.to.num(2009,11,03))) | Fecha vencimiento
stpapi.put.field("tfacp1110s000","tfacp200.vatc"," 1") | País IVA
stpapi.put.field("tfacp1110s000","tfacp200.cvat","00NE00") | Código IVA
stpapi.put.field("tfacp1110s000","tfacp200.vaty","2009") | Año IVA
stpapi.put.field("tfacp1110s000","tfacp200.vatp","01") | Período IVA
stpapi.put.field("tfacp1110s000","screeen.amnt","75") | Importe
stpapi.put.field("tfacp1110s000","screeen.vata","2") | Importe IVA
if not stpapi.insert("tfacp1110s000",1,err.msg) then
stpapi.recover("tfacp1110s000",recover.msg)
message("%s",err.msg)
endif
stpapi.handle.subproc("tfacp1110s000","tfacp1120s000","add")
stpapi.continue.process("tfacp1110s000", err.msg)
stpapi.put.field("tfacp1120s000","tfgld102.leac","629200687") | Cuenta contable
stpapi.put.field("tfacp1120s000","tfgld102.dim1","C00004") | Dimensión 1
stpapi.put.field("tfacp1120s000","tfgld102.dim2","III000") | Dimensión 2
stpapi.put.field("tfacp1120s000","tfgld102.dim3","") | Dimensión 3
stpapi.put.field("tfacp1120s000","tfgld102.dim4","") | Dimensión 4
stpapi.put.field("tfacp1120s000","tfgld102.dim5","") | Dimensión 5
stpapi.put.field("tfacp1120s000","tfgld102.ccty"," 1") | País IVA
| stpapi.put.field("tfacp1120s000","tfgld102.cvat","") | Código IVA
stpapi.put.field("tfacp1120s000","amount","89.6") | Importe neto
stpapi.put.field("tfacp1120s000","tfgld102.vamt","25") | Importe IVA
stpapi.put.field("tfacp1120s000","tfgld102.dbcr","2") | Debe/Haber
stpapi.put.field("tfacp1120s000","tfgld102.qty1","") | Cantidad 1
stpapi.put.field("tfacp1120s000","tfgld102.qty2","") | Cantidad 2
stpapi.put.field("tfacp1120s000","tfgld102.refr","Referencia tercera AFS") | Referencia
if not stpapi.insert("tfacp1120s000",1,err.msg) then
stpapi.recover("tfacp1120s000",recover.msg)
message("%s",err.msg)
endif
stpapi.end.session("tfacp1120s000")
stpapi.end.session("tfacp1110s000")
endif
stpapi.end.session("tfgld1101m000")
}
mark_h
18th November 2009, 15:46
But, another question. If I have to execute the cont.process twice (then I have 3 sessions opened at the same time), how I have to use the stpapi.handle.subproc function?
What session do you have to hit continue twice in? I have not seen a session like that - usually something happens with just a continue and the sessions open 1 at a time. You can only really process in one session at a time. What you can do is try defining the three subproc's before calling the continue command. That might work, but without knowing the sessions there is no guarantee.
mjpedreira1
18th November 2009, 16:48
The process that I have to automate includes the following sessions:
tfgld1101m000 (Maintain Transactions)-> tfacp1110s000 (Register Purchase Invoices) -> tfacp1120s000 (Maintain Transactions Purchase Invoices)
The descriptions are aproximations, because I work with spanish language :confused:
Thanks,
María
mjpedreira1
18th November 2009, 18:21
I executed my afs in debug mode. The log generated is:
6dll->serv (getxml)
6dll->serv (starttfgld1101m000100)
8serv<-4gl (api.child.startedtfgld1101m0006)
8serv<-4gl (init.ready)
tfgld1101m000(8)-RUNNING:
LOGGING STARTED
18/11/2009
>tfgld1101m000(8) put.field:tfgld101.ttyp HGT
>tfgld1101m000 insert
6dll->serv (add.set+save8)
tfgld1101m000(8)-RUNNING:add.set+save
8serv<-4gl (add.set+save01)
tfgld1101m000(8)-RUNNING:
<tfgld1101m000
>tfgld1101m000 handle.subproc tfacp1110s000 add
6dll->serv (handle.subsessiontfacp1110s00028)
>tfgld1101m000 mark
6dll->serv (mark.occur8)
tfgld1101m000(8)-RUNNING:mark.occur
8serv<-4gl (mark.occur0)
tfgld1101m000(8)-RUNNING:
<tfgld1101m000 mark successful
>tfgld1101m000 continue.process
6dll->serv (cont.process8)
tfgld1101m000(8)-RUNNING:cont.process
9serv<-4gl (api.child.startedtfacp1110s0008)
9serv<-4gl (init.ready)
tfacp1110s000(9)-RUNNING:
<tfgld1101m000
>tfacp1110s000(9) put.field:tfacp200.suno HG0687
>tfacp1110s000(9) put.field:tfacp200.amat 50
>tfacp1110s000(9) put.field:tfacp200.cvat 00EN00
>tfacp1110s000(9) put.field:tfacp200.refr Prueba AFS miércoeles
>tfacp1110s000(9) put.field:tfacp200.isup facturaSUNO
>tfacp1110s000(9) put.field:tfacp200.docd 733714
>tfacp1110s000(9) put.field:tfacp200.dved 733714
>tfacp1110s000(9) put.field:tfacp200.vatc 1
>tfacp1110s000(9) put.field:tfacp200.cvat 00NE00
>tfacp1110s000(9) put.field:tfacp200.vaty 2009
>tfacp1110s000(9) put.field:tfacp200.vatp 01
>tfacp1110s000(9) put.field:screen.amnt 75
>tfacp1110s000(9) put.field:screeen.vata 2
>tfacp1110s000 insert
6dll->serv (add.set+save9)
tfacp1110s000(9)-RUNNING:add.set+save
10serv<-4gl (api.child.startedtfacp1120s0009)
10serv<-4gl (init.ready)
tfacp1120s000(10)-RUNNING:
<tfacp1110s000
>tfacp1110s000 handle.subproc tfacp1120s000 add
6dll->serv (handle.subsessiontfacp1120s00029)
>tfacp1110s000 continue.process
tfacp1110s000waiting for prev cont.proc
tfacp1110s000waiting timed out
6dll->serv (cont.process9)
tfacp1110s000(9)-RUNNING:cont.process
mark_h
18th November 2009, 18:41
Here is what I see from looking at your afs.log:
if not stpapi.insert("tfacp1110s000",1,err.msg) then
stpapi.recover("tfacp1110s000",recover.msg)
message("%s",err.msg)
endif
stpapi.handle.subproc("tfacp1110s000","tfacp1120s000","add")
stpapi.continue.process("tfacp1110s000", err.msg)
In the above code when you do the insert on tfacp1110s00 it is starting tfacp1120s000, so in that case you can try this:
stpapi.handle.subproc("tfacp1110s000","tfacp1120s000","add")
if not stpapi.insert("tfacp1110s000",1,err.msg) then
stpapi.recover("tfacp1110s000",recover.msg)
message("%s",err.msg)
endif
| stpapi.continue.process("tfacp1110s000", err.msg)
| Continue not needed since tfacp1120s000 is already running so just start
| putting the fields on tfacp1120s000.
stpapi.put.field("tfacp1120s000","tfgld102.leac","629200687") stpapi.put.field("tfacp1120s000","tfgld102.dim1","C00004") stpapi.put.field("tfacp1120s000","tfgld102.dim2","III000")
Try that. In the meantime I will look to see if I have code that includes tfacp1120s000.
mark_h
18th November 2009, 18:47
Okay - what I posted before is what my code looks like. See below:
function api.create.invoice()
{
domain tcmcs.str80 hold.msg
|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
| End the two sessions
stpapi.end.session("tfacp1120s000")
stpapi.end.session("tfacp1110s000")
}
Of course on tfacp1120s000 I only input the ledger account.
mjpedreira1
18th November 2009, 19:41
Hello Mark,
the first code run well. I comment the second stpapi.continue.process and the invoice was created ok. I´m going to prove it more...
A last thing (I hope :) ). The session tfgld1101m000 has 2 posibilities:
a) Insert a new date with a new tfgld101.btno (icon: >|<)
b) Use a tfgld101.btno created and insert a new register witha a new type (icon: add)
I did my development with the option b)
How I can create a record with option a)? I'm trying with next code:
stpapi.put.field("tfgld1101m000","tedt.f",str$(date.to.num(2009,11,18)))
stpapi.put.field("tfgld1101m000","tfgld101.year","2009")
stpapi.put.field("tfgld1101m000","tfgld101.ttyp","HGT")
if stpapi.insert("tfgld1101m000",1,err.msg) = 0 then
message("%s",err.msg)
endif
Thanks,
María
mark_h
18th November 2009, 21:05
Here is most of my code to do that. What I do is read from a table and write transactions from the table. As it reads the transactions it writes a history table and error messages go into the main table. The routine you need is the api..create.batch.
Function process.selected.date()
{
sel.date = tfudi030.date
sel.ttyp = tfudi030.ttyp
| Added just because the user might get cute and try to process a Transaction
| type thru the session that it is not designed for.
if sel.ttyp<>"APG" and sel.ttyp<>"APD" then
message("Transaction type not defined by program.")
return
endif
| Create batch - note subroutine leaves the two tfgld sessions open
if api.create.batch() then
stpapi.end.session("tfgld1101s000")
stpapi.end.session("tfgld1100m000")
return
endif
|Start processing the data selected.
select a.srno:sel.srno
from tfudi030 a
where a._index1 = {:sel.date, :sel.ttyp}
selectdo
db.retry.point()
select tfudi030.*
from tfudi030 for update
where tfudi030._index1 = {:sel.date, :sel.ttyp, :sel.srno}
as set with 1 rows
selectdo
| 20080207.st Reverse the oncase statement since get.max.refr needs tiudi035.pref
| to already be set.
| Did a case statement because they might add transaction types later.
on case sel.ttyp
case "APG":
tfudi035.pref = "G"
break
case "APD":
tfudi035.pref = "D"
break
endcase
sel.refr = get.max.refr() | 20080207.en
api.create.invoice()
if isspace(e.msg) then
tfudi035.date = sel.date
tfudi035.ttyp = tfudi030.ttyp
tfudi035.srno = get.max.srno()
tfudi035.suno = tfudi030.suno
tfudi035.isup = tfudi030.isup
tfudi035.reas = tfudi030.reas
tfudi035.leac = tfudi030.leac
tfudi035.amnt = tfudi030.amnt
tfudi035.refr = sel.refr
tfudi035.dtep = date.num()
tfudi035.btno = sel.btno
tfudi035.user = logname$
db.insert(ttfudi035)
db.delete(ttfudi030,db.retry)
else
tfudi030.err = e.msg
db.update(ttfudi030,db.retry)
endif
endselect
commit.transaction()
endselect
stpapi.end.session("tfgld1101s000")
stpapi.end.session("tfgld1100m000")
}
function domain tcorno get.max.srno()
{
domain tcorno max.srno
max.srno = 0
select max(a.srno):max.srno
from tfudi035 a
where a._index1 = {:sel.date, :sel.ttyp}
selectdo
endselect
max.srno = max.srno + 1
return(max.srno)
}
| Reference number must be unique
function domain tcorno get.max.refr()
{
domain tcorno max.refr
select max(a.refr):max.refr
from tfudi035 a
where a.pref = :tfudi035.pref
selectdo
selectempty
max.refr = 9999
endselect
max.refr = max.refr + 1
return(max.refr)
}
function api.create.invoice()
{
domain tcmcs.str80 hold.msg
|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
| End the two sessions
stpapi.end.session("tfacp1120s000")
stpapi.end.session("tfacp1110s000")
}
function long api.create.batch()
{
| tfgld1100m000 (Maintain Transactions)
| Put data and create batch
stpapi.put.field("tfgld1100m000", "tfgld100.tedt", str$(date.num()))
stpapi.put.field("tfgld1100m000", "tfgld100.bref", sprintf$("Garnishments %D(%02m/%02d/%02y)", date.num()))
rc = stpapi.insert("tfgld1100m000", 1, e.msg)
if not isspace(e.msg) then
message("Unable to create transaction type.")
return(true)
endif
| Get the batch created.
stpapi.get.field("tfgld1100m000","tfgld100.btno",e.msg)
sel.btno = val(strip$(e.msg))
| Activate tfgld1101s000 subsession
stpapi.handle.subproc("tfgld1100m000", "tfgld1101s000", "add")
stpapi.continue.process("tfgld1100m000", e.msg)
| Clear the input mode the session starts in
stpapi.save("tfgld1101s000",e.msg)
| Put the transaction type
stpapi.put.field("tfgld1101s000", "tfgld101.ttyp", strip$(tfudi030.ttyp))
rc = stpapi.insert("tfgld1101s000", 1, e.msg)
if not isspace(e.msg) then
message("Unable to create transaction type.")
return(true)
endif
return(false)
}
mjpedreira1
20th November 2009, 11:08
Hi Mark,
I think the complete AFS is running well. I´m using now, in first place, the session tfgld1100m000 instead tfgld1101m000. I didn´t know that session.
Now I´m working in the register of errors.
Thanks a lot,
María
mjpedreira1
26th November 2009, 12:27
Hello,
I have an AFS session working well but, there is a behaviour that I don´t understand...
When I detect a record with an error, I want to save it in the tfcmn041 table:
{...
if error then
registrar.borrar.errores(t_idhg)
endif
...
}
function registrar.borrar.errores(domain tcmcs.str11 t_idhg)
{
db.retry.point()
select tfcmn040.*
from tfcmn040 for update
where tfcmn040.idhg = :t_idhg
selectdo
insertar.error.tfcmn041("Error en la hoja " & str$(t_idhg) )
db.delete(ttfcmn040,db.retry)
endselect
commit.transaction()
}
function insertar.error.tfcmn041(domain tcstr.200 mensaje)
{
stpapi.put.field("tfcmncm041m00", "tfcmn041.idin", str$(tfcmn040.idin))
stpapi.put.field("tfcmncm041m00", "tfcmn041.idhg", str$(tfcmn040.idhg))
stpapi.put.field("tfcmncm041m00", "tfcmn041.emno", str$(tfcmn040.emno))
stpapi.put.field("tfcmncm041m00", "tfcmn041.cprj", str$(tfcmn040.cprj))
stpapi.put.field("tfcmncm041m00", "tfcmn041.desc", str$(tfcmn040.desc))
stpapi.put.field("tfcmncm041m00", "tfcmn041.amnt", str$(tfcmn040.amnt))
stpapi.put.field("tfcmncm041m00", "tfcmn041.suno", str$(tfcmn040.suno))
stpapi.put.field("tfcmncm041m00", "tfcmn041.ninv", str$(tfcmn040.ninv))
stpapi.put.field("tfcmncm041m00", "tfcmn041.refe", str$(tfcmn040.refe))
stpapi.put.field("tfcmncm041m00", "tfcmn041.qan1", str$(tfcmn040.qan1))
stpapi.put.field("tfcmncm041m00", "tfcmn041.qan2", str$(tfcmn040.qan2))
stpapi.put.field("tfcmncm041m00", "tfcmn041.date", str$(date.num()))
stpapi.put.field("tfcmncm041m00", "tfcmn041.erro", mensaje)
stpapi.put.field("tfcmncm041m00", "tfcmn041.time", calcular.hora())
if not stpapi.insert("tfcmncm041m00",1,err.msg) = 1 then
stpapi.recover("tfcmncm041m00",recover.msg)
endif
stpapi.end.session("tfcmncm041m00")
}
If I execute the session in debug mode, the records are saved in tfcmn041. But If I compile the program without debug mode, then the function registrar.borrar.errores() seems not be executed, because the records are not inserted in the tfcmn041 table ¿?
Thanks,
María
mark_h
27th November 2009, 14:33
Try putting in a suspend statement after the stpapi.end.session. That usually works - it gives the session time to close and cleanup before continuing in the current session.
mjpedreira1
21st April 2010, 14:48
Hello,
I had open this thread for a development that it´s finish. The AFS session run well in a test server. Today I implement the session in the production server and the AFS session hangs in session tfacp1120s000, executing next code.... I debug the session but I don´t understand why the code stops in that instruction ¿? See the last lines at this code..
Thanks in advanced!
form.1:
init.form:
if zoomfield$ = "tfacp2110" then
|* Maintain corrections purchase invoices
tfacp200.ttyp = main.tinv
tfacp200.ninv = main.ninv
tfacp200.line = main.line
tfacp200.tdoc = main.tdoc
tfacp200.docn = main.corr
tfacp200.lino = main.lino
payments.found = false
db.eq(ttfacp200)
else
tfacp200.ttyp = main.ttyp
tfacp200.ninv = main.docn
tfacp200.line = 0
tfacp200.tdoc = ""
tfacp200.docn = 0
tfacp200.lino = 0
db.eq(ttfacp200)
if tfcmg000.avat = tcyesno.yes then
read.payments()
else
payments.found = false
endif
endif
if db.error(ttfacp200) then
mess("tfacpt2001",1)
|* Invoice not found
end()
endif
if not isspace(tfacp200.cpay) then
tcmcs013.cpay = tfacp200.cpay
db.eq(ttcmcs013)
endif
if zoomfield$ = "tfacp1110" then
|* Maintain purchase invoices
if tfacp200.appr <> tfacp.matc.no then
mess("tfacps0146",1)
|* Invoice must be matched with orders
end()
endif
main.vyer = tfacp200.vaty
main.vprd = tfacp200.vatp
main.rate = tfacp200.rate
|#euro.46340.sn
main.ratf = tfacp200.ratf
main.docd = tfacp200.docd
|#euro.46340.en
endif
tccom020.suno = tfacp200.suno
if db.eq(ttccom020) then
mess("tccomt0201",1)
|* Supplier not found
end()
endif
tfgld011.ttyp = main.ttyp
if db.eq(ttfgld011) then
mess("tfgldt0111",1)
|* Transaction type not found
end()
endif
calculate.amounts()
tfgld102.cono = get.compnr()
tfgld102.year = main.year
tfgld102.btno = main.btno
tfgld102.ttyp = main.ttyp
tfgld102.docn = main.docn
set.max(tfgld102.lino)
tfgld102.serl = 0
tfgld102.srno = 0
store.occ.max()
tfgld102.lino = 0
tfgld102.serl = 0
tfgld102.srno = 0
store.occ.min()
execute(find.data)
select tccom999.*
from tccom999
as set with 1 rows
selectdo
endselect
if not filled.occ then
execute(start.set)
if not filled.occ then
execute(add.set) endif
endif
mark_h
21st April 2010, 15:46
Well I do not know why the execute(add.set) would cause the session to lock up. Have you compared the session code between production and development for tfacp1120s000? The only time I have seen this problem is when (1) the libraries and tools patches were different between dev and test and (2) the session itself was different between dev and prod. I can't say for sure that is the case, but something you can check on.
manish_patel
21st April 2010, 15:51
If the session runs through AFS, starting choices automatically (e.g. starting the add.set when no records are present) can result in undesired results.
Hence it is better to skip Execute(…) function when session runs in API-mode.
if not api.mode then
if not filled.occ then
execute(start.set)
if not filled.occ then
execute(add.set)
endif
endif
endif
Yes, still question remain unanswered - Why it is not working in production server?
mjpedreira1
21st April 2010, 17:36
I compared dev script with production script and they are identical.
I modify the instruction execute(add.set) in the production script with api.mode condition, but now the session hangs in another place.
How I could to know all the libraries related?
I´m very surprised ¿?
Thanks,
María
mark_h
21st April 2010, 22:09
I was thinking of the stpapi libraries - not all libraries. A little typo. I usually have our BaaN admin just callup baan and get the latest. Then when everything tests out he applies them to production. I have never really tried to compare two systems - in my case the app admin is suppose to keep things in sync.
mjpedreira1
23rd April 2010, 15:48
Here is a new trace. Hoping you can see something strange!
>tail afs.log
LOGGING STARTED
23/04/2010
8->get.fields
8<-get.fields0tfgld100.tedt1tfgld100.year1tfgld006.ydsc0tfgld100.btno1tfgld100.bref1fyer.f0tfgld003.psep0tfgld100.fprd1ryer.f0tfgld003.psep0tfgld100.rprd1tfgld100.vyer1tfgld003.psep0tfgld100.vprd1tfgld100.stat0tfgld100.user0
>tfgld1100m000 put.field:tfgld100.tedt 733885
>tfgld1100m000 put.field:tfgld100.bref Nueva HGT 04/23/10
>tfgld1100m000 insert
8->add.set+save
8<-add.set+save0
<tfgld1100m000
>tfgld1100m000 get.field:tfgld100.btno
<tfgld1100m000 get.field:tfgld100.btno=1603
>tfgld1100m000 handle.subproc tfgld1101s000 add
>tfgld1100m000 continue.process
8->cont.process
9<-api.child.startedtfgld1101s0008
9->get.fields
9<-get.fields0tedt.f1tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f1fyer.f0tfgld003.psep0fprd.f1ryer.f0tfgld003.psep0rprd.f1vyer.f1tfgld003.psep0vprd.f1actual.occ0tfgld101.ttyp1tfgld011.desc0tfgld101.stat0tfgld101.amnt1tedt.f0tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f0fyer.f0tfgld003.psep0fprd.f0ryer.f0tfgld003.psep0rprd.f0vyer.f0tfgld003.psep0vprd.f0tfgld101.ttyp1tfgld101.user0tfgld101.emsg0
<tfgld1100m000
>tfgld1101s000 save
9->update.db
9<-update.db0
<tfgld1101s000
>tfgld1101s000 put.field:tfgld101.ttyp HGT
>tfgld1101s000 insert
9->add.set+save
9<-add.set+save0
<tfgld1101s000
>tfgld1101s000 handle.subproc tfacp1110s000 add
>tfgld1101s000 continue.process
9->cont.process
10<-api.child.startedtfacp1110s0009
10->get.fields
10<-get.fields0tfacp200.year1tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.suno1tccom020.nama0tfacp200.docd1tfacp200.ccur1ratf.f0ccur10tfacp200.rate1ccur20screen.amnt1fixed.ratf0euro.f0fixed.rate0cemu.f0user.ccur0screen.amth0tfacp200.spot1tfacp200.vatc1tfacp200.cvat1tfacp200.vaty1tfgld003.psep0tfacp200.vatp1screen.vata1user.ccur0screen.vath0tfacp200.isup1tfacp200.refr1tfacp200.bloc1tfacp002.desc0tfacp200.bdat1tfacp200.bref1tfacp003.desc0tfacp200.loco1tccom000.nama0tfacp200.proj1tfacp200.recd1tfacp200.orno1tfacp200.disp1tfacp200.bank0tfacp200.year1text.yn0tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.cpay1tcmcs013.dsca0tfacp200.dued1schedule0tfacp200.ccrs1tcmcs011.dsca0tfacp200.paym1tfcmg003.desc0tfacp200.bank1tccom025.bano0tfacp200.reas1tfcmg002.desc0tfacp200.otyp1tfacp200.oinv1tfacp200.appr1tfacp200.subc1tfacp200.lvat1tfacp200.stap0tfacp200.tapr0tfacp200.dapr0
<tfgld1101s000
>tfacp1110s000 save
10->update.db
10<-update.db0
<tfacp1110s000
>tfacp1110s000 put.field:tfacp200.suno HG0695
>tfacp1110s000 put.field:tfacp200.amat 5.15
>tfacp1110s000 put.field:tfacp200.amnt 5.15
>tfacp1110s000 put.field:tfacp200.cvat 00NE00
>tfacp1110s000 put.field:tfacp200.isup 30000000360
>tfacp1110s000 put.field:tfacp200.docd 733885
>tfacp1110s000 put.field:tfacp200.refr 13/04/2010-16/04/2010
>tfacp1110s000 put.field:tfacp200.vatc 1
>tfacp1110s000 put.field:screen.amnt 5.15
>tfacp1110s000 insert
10->add.set+save
11<-api.child.startedtfacp1120s00010
(baanexpl)/home/mpl>clear
(baanexpl)/home/mpl>tail -200 afs.log
LOGGING STARTED
23/04/2010
8->get.fields
8<-get.fields0tfgld100.tedt1tfgld100.year1tfgld006.ydsc0tfgld100.btno1tfgld100.bref1fyer.f0tfgld003.psep0tfgld100.fprd1ryer.f0tfgld003.psep0tfgld100.rprd1tfgld100.vyer1tfgld003.psep0tfgld100.vprd1tfgld100.stat0tfgld100.user0
>tfgld1100m000 put.field:tfgld100.tedt 733885
>tfgld1100m000 put.field:tfgld100.bref Nueva HGT 04/23/10
>tfgld1100m000 insert
8->add.set+save
8<-add.set+save0
<tfgld1100m000
>tfgld1100m000 get.field:tfgld100.btno
<tfgld1100m000 get.field:tfgld100.btno=1603
>tfgld1100m000 handle.subproc tfgld1101s000 add
>tfgld1100m000 continue.process
8->cont.process
9<-api.child.startedtfgld1101s0008
9->get.fields
9<-get.fields0tedt.f1tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f1fyer.f0tfgld003.psep0fprd.f1ryer.f0tfgld003.psep0rprd.f1vyer.f1tfgld003.psep0vprd.f1actual.occ0tfgld101.ttyp1tfgld011.desc0tfgld101.stat0tfgld101.amnt1tedt.f0tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f0fyer.f0tfgld003.psep0fprd.f0ryer.f0tfgld003.psep0rprd.f0vyer.f0tfgld003.psep0vprd.f0tfgld101.ttyp1tfgld101.user0tfgld101.emsg0
<tfgld1100m000
>tfgld1101s000 save
9->update.db
9<-update.db0
<tfgld1101s000
>tfgld1101s000 put.field:tfgld101.ttyp HGT
>tfgld1101s000 insert
9->add.set+save
9<-add.set+save0
<tfgld1101s000
>tfgld1101s000 handle.subproc tfacp1110s000 add
>tfgld1101s000 continue.process
9->cont.process
10<-api.child.startedtfacp1110s0009
10->get.fields
10<-get.fields0tfacp200.year1tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.suno1tccom020.nama0tfacp200.docd1tfacp200.ccur1ratf.f0ccur10tfacp200.rate1ccur20screen.amnt1fixed.ratf0euro.f0fixed.rate0cemu.f0user.ccur0screen.amth0tfacp200.spot1tfacp200.vatc1tfacp200.cvat1tfacp200.vaty1tfgld003.psep0tfacp200.vatp1screen.vata1user.ccur0screen.vath0tfacp200.isup1tfacp200.refr1tfacp200.bloc1tfacp002.desc0tfacp200.bdat1tfacp200.bref1tfacp003.desc0tfacp200.loco1tccom000.nama0tfacp200.proj1tfacp200.recd1tfacp200.orno1tfacp200.disp1tfacp200.bank0tfacp200.year1text.yn0tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.cpay1tcmcs013.dsca0tfacp200.dued1schedule0tfacp200.ccrs1tcmcs011.dsca0tfacp200.paym1tfcmg003.desc0tfacp200.bank1tccom025.bano0tfacp200.reas1tfcmg002.desc0tfacp200.otyp1tfacp200.oinv1tfacp200.appr1tfacp200.subc1tfacp200.lvat1tfacp200.stap0tfacp200.tapr0tfacp200.dapr0
<tfgld1101s000
>tfacp1110s000 save
10->update.db
10<-update.db0
<tfacp1110s000
>tfacp1110s000 put.field:tfacp200.suno HG0695
>tfacp1110s000 put.field:tfacp200.amat 5.15
>tfacp1110s000 put.field:tfacp200.amnt 5.15
>tfacp1110s000 put.field:tfacp200.cvat 00NE00
>tfacp1110s000 put.field:tfacp200.isup 30000000360
>tfacp1110s000 put.field:tfacp200.docd 733885
>tfacp1110s000 put.field:tfacp200.refr 13/04/2010-16/04/2010
>tfacp1110s000 put.field:tfacp200.vatc 1
>tfacp1110s000 put.field:screen.amnt 5.15
>tfacp1110s000 insert
10->add.set+save
11<-api.child.startedtfacp1120s00010
(baanexpl)/home/mpl>ls
.profile afs.log dbs.log procesos2_web traza_DN ttpcmn010900.S
.sh_history afs.log_v0 gastos procesos_web ttccom001900.S ttpcmn011900.S
0416ttfcmn040900.S datos_DN pepito.txt trace ttfacr204900.S usu
(baanexpl)/home/mpl>tail -200 afs.log
LOGGING STARTED
23/04/2010
8->get.fields
8<-get.fields0tfgld100.tedt1tfgld100.year1tfgld006.ydsc0tfgld100.btno1tfgld100.bref1fyer.f0tfgld003.psep0tfgld100.fprd1ryer.f0tfgld003.psep0tfgld100.rprd1tfgld100.vyer1tfgld003.psep0tfgld100.vprd1tfgld100.stat0tfgld100.user0
>tfgld1100m000 put.field:tfgld100.tedt 733885
>tfgld1100m000 put.field:tfgld100.bref Nueva HGT 04/23/10
>tfgld1100m000 insert
8->add.set+save
8<-add.set+save0
<tfgld1100m000
>tfgld1100m000 get.field:tfgld100.btno
<tfgld1100m000 get.field:tfgld100.btno=1603
>tfgld1100m000 handle.subproc tfgld1101s000 add
>tfgld1100m000 continue.process
8->cont.process
9<-api.child.startedtfgld1101s0008
9->get.fields
9<-get.fields0tedt.f1tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f1fyer.f0tfgld003.psep0fprd.f1ryer.f0tfgld003.psep0rprd.f1vyer.f1tfgld003.psep0vprd.f1actual.occ0tfgld101.ttyp1tfgld011.desc0tfgld101.stat0tfgld101.amnt1tedt.f0tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f0fyer.f0tfgld003.psep0fprd.f0ryer.f0tfgld003.psep0rprd.f0vyer.f0tfgld003.psep0vprd.f0tfgld101.ttyp1tfgld101.user0tfgld101.emsg0
<tfgld1100m000
>tfgld1101s000 save
9->update.db
9<-update.db0
<tfgld1101s000
>tfgld1101s000 put.field:tfgld101.ttyp HGT
>tfgld1101s000 insert
9->add.set+save
9<-add.set+save0
<tfgld1101s000
>tfgld1101s000 handle.subproc tfacp1110s000 add
>tfgld1101s000 continue.process
9->cont.process
10<-api.child.startedtfacp1110s0009
10->get.fields
10<-get.fields0tfacp200.year1tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.suno1tccom020.nama0tfacp200.docd1tfacp200.ccur1ratf.f0ccur10tfacp200.rate1ccur20screen.amnt1fixed.ratf0euro.f0fixed.rate0cemu.f0user.ccur0screen.amth0tfacp200.spot1tfacp200.vatc1tfacp200.cvat1tfacp200.vaty1tfgld003.psep0tfacp200.vatp1screen.vata1user.ccur0screen.vath0tfacp200.isup1tfacp200.refr1tfacp200.bloc1tfacp002.desc0tfacp200.bdat1tfacp200.bref1tfacp003.desc0tfacp200.loco1tccom000.nama0tfacp200.proj1tfacp200.recd1tfacp200.orno1tfacp200.disp1tfacp200.bank0tfacp200.year1text.yn0tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.cpay1tcmcs013.dsca0tfacp200.dued1schedule0tfacp200.ccrs1tcmcs011.dsca0tfacp200.paym1tfcmg003.desc0tfacp200.bank1tccom025.bano0tfacp200.reas1tfcmg002.desc0tfacp200.otyp1tfacp200.oinv1tfacp200.appr1tfacp200.subc1tfacp200.lvat1tfacp200.stap0tfacp200.tapr0tfacp200.dapr0
<tfgld1101s000
>tfacp1110s000 save
10->update.db
10<-update.db0
<tfacp1110s000
>tfacp1110s000 put.field:tfacp200.suno HG0695
>tfacp1110s000 put.field:tfacp200.amat 5.15
>tfacp1110s000 put.field:tfacp200.amnt 5.15
>tfacp1110s000 put.field:tfacp200.cvat 00NE00
>tfacp1110s000 put.field:tfacp200.isup 30000000360
>tfacp1110s000 put.field:tfacp200.docd 733885
>tfacp1110s000 put.field:tfacp200.refr 13/04/2010-16/04/2010
>tfacp1110s000 put.field:tfacp200.vatc 1
>tfacp1110s000 put.field:screen.amnt 5.15
>tfacp1110s000 insert
10->add.set+save
11<-api.child.startedtfacp1120s00010
(baanexpl)/home/mpl>pg -200 afs.log
LOGGING STARTED
23/04/2010
8->get.fields
8<-get.fields0tfgld100.tedt1tfgld100.year1tfgld006.ydsc0tfgld100.btno1tfgld100.bref1fyer.f0tfgld003.psep0tfgld100.fprd1ryer.f0tfgld003.psep0tfgld100.rprd1tfgld100.vyer1tfgld003.psep0tfgld100.vprd1tfgld100.stat0tfgld100.user0
>tfgld1100m000 put.field:tfgld100.tedt 733885
>tfgld1100m000 put.field:tfgld100.bref Nueva HGT 04/23/10
>tfgld1100m000 insert
8->add.set+save
8<-add.set+save0
<tfgld1100m000
>tfgld1100m000 get.field:tfgld100.btno
<tfgld1100m000 get.field:tfgld100.btno=1603
>tfgld1100m000 handle.subproc tfgld1101s000 add
>tfgld1100m000 continue.process
8->cont.process
9<-api.child.startedtfgld1101s0008
9->get.fields
9<-get.fields0tedt.f1tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f1fyer.f0tfgld003.psep0fprd.f1ryer.f0tfgld003.psep0rprd.f1vyer.f1tfgld003.psep0vprd.f1actual.occ0tfgld101.ttyp1tfgld011.desc0tfgld101.stat0tfgld101.amnt1tedt.f0tfgld101.year1tfgld006.ydsc0tfgld101.btno1bref.f0fyer.f0tfgld003.psep0fprd.f0ryer.f0tfgld003.psep0rprd.f0vyer.f0tfgld003.psep0vprd.f0tfgld101.ttyp1tfgld101.user0tfgld101.emsg0
<tfgld1100m000
>tfgld1101s000 save
9->update.db
9<-update.db0
<tfgld1101s000
>tfgld1101s000 put.field:tfgld101.ttyp HGT
>tfgld1101s000 insert
9->add.set+save
9<-add.set+save0
<tfgld1101s000
>tfgld1101s000 handle.subproc tfacp1110s000 add
>tfgld1101s000 continue.process
9->cont.process
10<-api.child.startedtfacp1110s0009
10->get.fields
10<-get.fields0tfacp200.year1tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.suno1tccom020.nama0tfacp200.docd1tfacp200.ccur1ratf.f0ccur10tfacp200.rate1ccur20screen.amnt1fixed.ratf0euro.f0fixed.rate0cemu.f0user.ccur0screen.amth0tfacp200.spot1tfacp200.vatc1tfacp200.cvat1tfacp200.vaty1tfgld003.psep0tfacp200.vatp1screen.vata1user.ccur0screen.vath0tfacp200.isup1tfacp200.refr1tfacp200.bloc1tfacp002.desc0tfacp200.bdat1tfacp200.bref1tfacp003.desc0tfacp200.loco1tccom000.nama0tfacp200.proj1tfacp200.recd1tfacp200.orno1tfacp200.disp1tfacp200.bank0tfacp200.year1text.yn0tfacp200.btno1tfacp200.ttyp0tfacp200.ninv1tfacp200.line1tfacp200.tdoc1tfacp200.docn1tfacp200.lino1tfacp200.cpay1tcmcs013.dsca0tfacp200.dued1schedule0tfacp200.ccrs1tcmcs011.dsca0tfacp200.paym1tfcmg003.desc0tfacp200.bank1tccom025.bano0tfacp200.reas1tfcmg002.desc0tfacp200.otyp1tfacp200.oinv1tfacp200.appr1tfacp200.subc1tfacp200.lvat1tfacp200.stap0tfacp200.tapr0tfacp200.dapr0
<tfgld1101s000
>tfacp1110s000 save
10->update.db
10<-update.db0
<tfacp1110s000
>tfacp1110s000 put.field:tfacp200.suno HG0695
>tfacp1110s000 put.field:tfacp200.amat 5.15
>tfacp1110s000 put.field:tfacp200.amnt 5.15
>tfacp1110s000 put.field:tfacp200.cvat 00NE00
>tfacp1110s000 put.field:tfacp200.isup 30000000360
>tfacp1110s000 put.field:tfacp200.docd 733885
>tfacp1110s000 put.field:tfacp200.refr 13/04/2010-16/04/2010
>tfacp1110s000 put.field:tfacp200.vatc 1
>tfacp1110s000 put.field:screen.amnt 5.15
>tfacp1110s000 insert
10->add.set+save
11<-api.child.startedtfacp1120s00010
(baanexpl)/home/mpl>
mark_h
26th April 2010, 15:19
From that trace it almost looks like it works. Is it still hanging?
BaaNovva
29th April 2010, 18:00
How To Debug Afs By Generating Afs Logs ?
mark_h
29th April 2010, 19:58
In your bwc file you use -- -set AFSLOG=1. This creates the AFS log. Then as you look at the log file it will(sometimes) point to where the problem might be. I don't think you can completely solve a problem with the AFS log, but it will usually give you something to start looking at.
BaaNovva
30th April 2010, 11:25
Good reply there. Thank you!, Mark.