kathuria
1st August 2007, 23:26
Hi,
I have written AFS on session TFCMG5503M000. I am following sequence in which we are entering data manually. It's giving error "Input Cancelled on Document Field" at the time of saving record but manuall it's working fine. I am also attaching my code. Please help me to resolve this problem.


stpapi.form.command("tfcmg5503m000", 5, "exec.user.0", err.mess)
stpapi.put.field("tfcmg5503m000", "tfcmg502.bank",bank.f)
stpapi.put.field("tfcmg5503m000", "tfcmg502.btno",str$(ebs.batch))
stpapi.put.field("tfcmg5503m000", "tfcmg502.bser",str$(tfcmg502.bser))
stpapi.put.field("tfcmg5503m000", "tfcmg502.serl","1")
ret=stpapi.find("tfcmg5503m000", err.mess)
if ret then
ret = stpapi.mark("tfcmg5503m000",err.mess)
if ret then
stpapi.handle.subproc( "tfcmg5503m000", "tfcmg5513m000", "add")
stpapi.form.command("tfcmg5503m000", 5, "exec.user.1", err.mess)
ret = stpapi.synchronize.dialog("tfcmg5513m000", "add", err.mess)
if gbcmg001.paym = "FWT" then
stpapi.put.field("tfcmg5106s000", "tfcmg503.serl",str$(etol(tfcmg.tran.unalloc.rec)))
else
stpapi.put.field("tfcmg5106s000", "tfcmg503.serl",str$(etol(tfcmg.tran.customer)))
endif
stpapi.put.field("tfcmg5106s000", "tfcmg503.docd",str$(gbcmg001.ddat))
stpapi.put.field("tfcmg5106s000", "tfcmg503.cono",str$(current.company))
if gbcmg001.paym = "FWT" then
stpapi.put.field("tfcmg5106s000", "tfcmg503.bpid",tccom115.pfbp)
else
stpapi.put.field("tfcmg5106s000", "tfcmg503.ttyp",ttyp.h)
stpapi.put.field("tfcmg5106s000", "tfcmg503.docn",str$(doc.num.h))
endif
ret = stpapi.enum.answer("tfcmg5106s000", "tfcmgs0010",tcyesno.yes)
stpapi.put.field("tfcmg5106s000", "tfcmg503.amnt",str$(inv.nett.c))
stpapi.put.field("tfcmg5106s000", "tfcmg503.disa",str$(inv.disc.c))
if tfcmg503.desc(1;3) = "PDF" then
stpapi.put.field("tfcmg5106s000", "tfcmg503.pdif",dad.desc(5;9))
else
if tfcmg503.desc(1;3) = "DAD" then
stpapi.put.field("tfcmg5106s000", "tfcmg503.pdif",dad.desc(5;9))
endif
endif
stpapi.put.field("tfcmg5106s000", "tfcmg503.pref",tfcmg502.pref)
ret = stpapi.insert("tfcmg5513m000", true, err.mess)
if ret then
stpapi.end.session("tfcmg5106s000")
else
stpapi.recover("tfcmg5106s000",err.mess)
endif
stpapi.end.session("tfcmg5513m000")
stpapi.end.session("tfcmg5503m000")

endif
endif



Regards,
Sanjay Kathuria

mark_h
2nd August 2007, 15:47
Is this baan 5? We don't have this session so I can not really look at it, but I did wonder if ret = stpapi.insert("tfcmg5513m000", true, err.mess) this is where the error occurs? Have you tried save instead of insert?

Do you have source code for these sessions? This way you can debug what is happening to the document number.