howtodo
25th July 2005, 08:15
Hi,
I am trying to automate the session pspmg0202m000 thru AFS. As i tracked the AFS Log,it gets struck when calling tdilc4113s000.Please find the below
code.Find the AFS LOG also attached.
*********************
|* Main table tditw100 Receipts Confirmation(Inbound-Production Orders), Form Type 4
|******************************************************************************
|****************************** declaration section ***************************
declaration:
table ttditw100 | Receipts Confirmation(Inbound-Production Orders)
table ttditw010
table tpspmg001
extern domain tcrcno reno.f
extern domain tcrcno reno.t
extern domain tcitem item.f fixed
extern domain tcitem item.t fixed
extern domain tcbool status
extern string error.message(132)
extern string str.orno(10),str1(10)
long count
long ret1,ret2,ret3,ret4
#pragma used dll ottstpapihand
#include <bic_tt>
|****************************** form section **********************************
form.1:
init.form:
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
select tditw010.*
from tditw010
selectdo
endselect
complete.production.batch()
|****************************** field section *********************************
field.reno.f:
when.field.changes:
reno.t = reno.f
field.item.f:
when.field.changes:
item.t = item.f
|****************************** function section ******************************
functions:
function complete.production.batch()
{
db.retry.point()
select tditw100.*
from tditw100 for update
where tditw100._index1 inrange {:reno.f, :item.f}
and {:reno.t, :item.t}
and tditw100.stat=2
order by tditw100._index1
selectdo
| update set
status=false
status=complete.production.batch.detail(tditw100.item,tditw100.orno,tditw100.pdat,tditw100.oqua)
if status then
tditw100.stat=9
endif
db.update(ttditw100, db.retry)
endselect
commit.transaction()
}
function domain tcbool complete.production.batch.detail(domain tcitem item,domain tcorno orno,domain tcdate pdat,domain pspmg.qty1 oqua)
{
stpapi.handle.subproc("pspmg0202m000","pspmg0507m000","add")
stpapi.handle.subproc("pspmg0202m000","tihra1211s000","add")
stpapi.handle.subproc("pspmg0202m000","tdilc4207s000","add")
stpapi.handle.subproc("pspmg0202m000","tdilc4208s000","add")
stpapi.handle.subproc("pspmg0202m000","tdilc4113s000","add")
stpapi.put.field("pspmg0202m000","pspmg001.orno",str$(orno))
message("ORNo %d",orno)
ret3=stpapi.find("pspmg0202m000",error.message)
if ret3 then
stpapi.put.field("pspmg0202m000","comp.batch.frm",str$(etol(tcyesno.yes)))
stpapi.put.field("pspmg0202m000","cmdt.frm",str$(pdat))
ret4=stpapi.update("pspmg0202m000",true,error.message)
message("Update %d",ret4)
message("Update error message %s",error.message)
if ret4 then
stpapi.enum.answer("pspmg0202m000","pspmg010201",tcyesno.yes)
stpapi.enum.answer("pspmg0202m000","pspmgdll400101",tcyesno.yes)
stpapi.enum.answer("pspmg0202m000","pspmgdll400302",tcyesno.yes)
stpapi.set.report("pspmg0202m000","rtihra121001000","D",error.message)
stpapi.set.report("pspmg0202m000","rtdilc420102000","D",error.message)
stpapi.set.report("pspmg0202m000","rtdilc420201000","D",error.message)
stpapi.continue.process("pspmg0202m000",error.message)
stpapi.put.field("tdilc4113s000","tdilc402.item",item)
stpapi.put.field("tdilc4113s000","tdilc402.clot",str$(tditw010.clot))
stpapi.put.field("tdilc4113s000","tdilc402.date",str$(pdat))
stpapi.put.field("tdilc4113s000","tdilc402.qstr",str$(oqua))
stpapi.put.field("tdilc4113s000","tdilc402.qstc",str$(oqua))
ret3=stpapi.update("tdilc4113s000",true,error.message)
message(" Insert %s %d",error.message,ret3)
stpapi.end.session("tdilc4113s000",error.message)
stpapi.end.session("tihra1211s000",error.message)
stpapi.end.session("tdilc4207s000",error.message)
stpapi.end.session("tdilc4208s000",error.message)
stpapi.end.session("pspmg0507m000",error.message)
stpapi.end.session("pspmg0202m000",error.message)
endif
else
message("NOT FOUND %s",error.message)
stpapi.end.session("tdilc4113s000",error.message)
stpapi.end.session("pspmg0507m000",error.message)
stpapi.end.session("tihra1211s000",error.message)
stpapi.end.session("tdilc4207s000",error.message)
stpapi.end.session("tdilc4208s000",error.message)
stpapi.end.session("pspmg0202m000",error.message)
endif
return(0)
}
I am trying to automate the session pspmg0202m000 thru AFS. As i tracked the AFS Log,it gets struck when calling tdilc4113s000.Please find the below
code.Find the AFS LOG also attached.
*********************
|* Main table tditw100 Receipts Confirmation(Inbound-Production Orders), Form Type 4
|******************************************************************************
|****************************** declaration section ***************************
declaration:
table ttditw100 | Receipts Confirmation(Inbound-Production Orders)
table ttditw010
table tpspmg001
extern domain tcrcno reno.f
extern domain tcrcno reno.t
extern domain tcitem item.f fixed
extern domain tcitem item.t fixed
extern domain tcbool status
extern string error.message(132)
extern string str.orno(10),str1(10)
long count
long ret1,ret2,ret3,ret4
#pragma used dll ottstpapihand
#include <bic_tt>
|****************************** form section **********************************
form.1:
init.form:
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
select tditw010.*
from tditw010
selectdo
endselect
complete.production.batch()
|****************************** field section *********************************
field.reno.f:
when.field.changes:
reno.t = reno.f
field.item.f:
when.field.changes:
item.t = item.f
|****************************** function section ******************************
functions:
function complete.production.batch()
{
db.retry.point()
select tditw100.*
from tditw100 for update
where tditw100._index1 inrange {:reno.f, :item.f}
and {:reno.t, :item.t}
and tditw100.stat=2
order by tditw100._index1
selectdo
| update set
status=false
status=complete.production.batch.detail(tditw100.item,tditw100.orno,tditw100.pdat,tditw100.oqua)
if status then
tditw100.stat=9
endif
db.update(ttditw100, db.retry)
endselect
commit.transaction()
}
function domain tcbool complete.production.batch.detail(domain tcitem item,domain tcorno orno,domain tcdate pdat,domain pspmg.qty1 oqua)
{
stpapi.handle.subproc("pspmg0202m000","pspmg0507m000","add")
stpapi.handle.subproc("pspmg0202m000","tihra1211s000","add")
stpapi.handle.subproc("pspmg0202m000","tdilc4207s000","add")
stpapi.handle.subproc("pspmg0202m000","tdilc4208s000","add")
stpapi.handle.subproc("pspmg0202m000","tdilc4113s000","add")
stpapi.put.field("pspmg0202m000","pspmg001.orno",str$(orno))
message("ORNo %d",orno)
ret3=stpapi.find("pspmg0202m000",error.message)
if ret3 then
stpapi.put.field("pspmg0202m000","comp.batch.frm",str$(etol(tcyesno.yes)))
stpapi.put.field("pspmg0202m000","cmdt.frm",str$(pdat))
ret4=stpapi.update("pspmg0202m000",true,error.message)
message("Update %d",ret4)
message("Update error message %s",error.message)
if ret4 then
stpapi.enum.answer("pspmg0202m000","pspmg010201",tcyesno.yes)
stpapi.enum.answer("pspmg0202m000","pspmgdll400101",tcyesno.yes)
stpapi.enum.answer("pspmg0202m000","pspmgdll400302",tcyesno.yes)
stpapi.set.report("pspmg0202m000","rtihra121001000","D",error.message)
stpapi.set.report("pspmg0202m000","rtdilc420102000","D",error.message)
stpapi.set.report("pspmg0202m000","rtdilc420201000","D",error.message)
stpapi.continue.process("pspmg0202m000",error.message)
stpapi.put.field("tdilc4113s000","tdilc402.item",item)
stpapi.put.field("tdilc4113s000","tdilc402.clot",str$(tditw010.clot))
stpapi.put.field("tdilc4113s000","tdilc402.date",str$(pdat))
stpapi.put.field("tdilc4113s000","tdilc402.qstr",str$(oqua))
stpapi.put.field("tdilc4113s000","tdilc402.qstc",str$(oqua))
ret3=stpapi.update("tdilc4113s000",true,error.message)
message(" Insert %s %d",error.message,ret3)
stpapi.end.session("tdilc4113s000",error.message)
stpapi.end.session("tihra1211s000",error.message)
stpapi.end.session("tdilc4207s000",error.message)
stpapi.end.session("tdilc4208s000",error.message)
stpapi.end.session("pspmg0507m000",error.message)
stpapi.end.session("pspmg0202m000",error.message)
endif
else
message("NOT FOUND %s",error.message)
stpapi.end.session("tdilc4113s000",error.message)
stpapi.end.session("pspmg0507m000",error.message)
stpapi.end.session("tihra1211s000",error.message)
stpapi.end.session("tdilc4207s000",error.message)
stpapi.end.session("tdilc4208s000",error.message)
stpapi.end.session("pspmg0202m000",error.message)
endif
return(0)
}