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)
}

mark_h
25th July 2005, 22:39
Check this thread (http://www.baanboard.com/baanboard/showthread.php?t=7511&page=3&highlight=tdilc4113s000) out. It might be relevant to your situation. Do you have source code? In some of the later service packs Baan started building in WMS code. In some cases the code they built in caused problems with normal stpapi code.

howtodo
26th July 2005, 07:12
Hi Mark,
Thanks for ur reply. I am using SP17. Can you please give me some examples of boi.call and g.sub.session.

Thanks

howtodo
26th July 2005, 09:37
Hi,
Can somebody guide me how to incorporate the bio.call for Backflush Material/Hours and Report Orders Completed for Baan Process(pspmg).

Thanks

mark_h
26th July 2005, 17:05
I am not sure there is a real guide to using boi.call. I was lucky in the fact that I had some source code to look at - that and using q-key I was able to by-pass problems with tdilc4113s000. You may want to contact Baan with the issues. I do know they sent me a patch for tdilc4123s000.

jordimur
26th July 2005, 18:14
Try to not close the batch before call tdilc4113
Here it is my code and it works:
function report_production_batches()
{
f0202m000.put.Production_Batch( pspmg001.orno )
f0202m000.find( )
hold.orno = f0202m000.get.Production_Batch( )
if hold.orno <> pspmg001.orno then
error.fct.msg= "Problemas en session pspmg0202m000 para O.P " & str$(pspmg001.orno)
f0202m000.end()
error.fct = 1
endif
f0202m000.put.Quantity_to_Deliver( hold.qstc )
f0202m000.handle.sub.process( "tdilc4113s000", "add" )
f0202m000.continue( error.fct.msg )
f4113s000.put.tdilc402.qstr( hold.qstr )
f4113s000.insert( 1, error.fct.msg )
f4113s000.end( )
f0202m000.end( )

}

howtodo
29th July 2005, 13:48
Thanks for the code.I managed with boi.call variable.Now i am trying to process the session pspmg0220m000 to backflush,any sample code is available for this?

Thanks