mark_h
9th April 2012, 16:22
I do not know about this session. What we do for generating outbound is turn off all reports except the one I want. So first we run it and generate outbound advice. Then we run it and print outbound shortages. I am not sure if you can use the same technique, but basically we run it for each report we want one at a time. I posted the code so you could see that one comment about always point to the one report. So maybe you can use something along these lines.
function extern generate_outbound( domain tcmcs.str12 runnumber,
domain tcorno run.order.f,
domain tcorno run.order.t,
domain tcpono run.opno.f,
domain tcpono run.opno.t,
domain tcitem run.item.f,
domain tcitem run.item.t,
domain tccwar run.cwar.f,
domain tccwar run.cwar.t,
domain tgyenox run.advice,
ref string msg())
{
apishort= ""
export("apishort",apishort)
msg = ""
stpapi.put.field("tdilc4201m000","runnumber",runnumber)
stpapi.put.field("tdilc4201m000","koor.f",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4201m000","koor.t",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4201m000","cuno.f","")
stpapi.put.field("tdilc4201m000","cuno.t","ZZZZZZ")
stpapi.put.field("tdilc4201m000","orno.f",str$(run.order.f))
stpapi.put.field("tdilc4201m000","orno.t",str$(run.order.t))
stpapi.put.field("tdilc4201m000","opno.f",str$(run.opno.f))
stpapi.put.field("tdilc4201m000","opno.t",str$(run.opno.t))
stpapi.put.field("tdilc4201m000","prdt.t",str$(date.num()+1000))
|stpapi.put.field("tdilc4201m000","ddat.f",str$(date.num()-1000))
stpapi.put.field("tdilc4201m000","ddat.t",str$(date.num()+1000))
stpapi.put.field("tdilc4201m000","cprj.f","")
stpapi.put.field("tdilc4201m000","cprj.t","ZZZZZZ")
stpapi.put.field("tdilc4201m000","item.f",run.item.f)
stpapi.put.field("tdilc4201m000","item.t",run.item.t)
stpapi.put.field("tdilc4201m000","cwar.f",run.cwar.f)
stpapi.put.field("tdilc4201m000","cwar.t",run.cwar.t)
stpapi.put.field("tdilc4201m000","cntr.f","")
stpapi.put.field("tdilc4201m000","cntr.t","ZZZ")
stpapi.put.field("tdilc4201m000","crte.f","")
stpapi.put.field("tdilc4201m000","crte.t","ZZZZZ")
| The next 4 lines generate both the advice and shortages, if you want
| just one report then set the flags correctly, but always point the report
| to the advice report - This is the only way to get it to work.
| Advice Report
if run.advice = tgyenox.yes then
stpapi.put.field( "tdilc4201m000", "print.recom", str$(tcyesno.yes) )
else
stpapi.put.field( "tdilc4201m000", "print.recom", str$(tcyesno.no) )
endif
stpapi.put.field( "tdilc4201m000", "prnt.error.report", str$(tcyesno.yes) ) |20060804
stpapi.put.field( "tdilc4201m000", "prnt.shortage", str$(tcyesno.no) )
stpapi.put.field( "tdilc4201m000", "pr.peg.shortage", str$(tcyesno.no) )
stpapi.set.report( "tdilc4201m000","rtdilc420101000",spool.device, msg )
|Shortage Report
|stpapi.set.report( "tdilc4201m000","rtdilc420102000","D66", msg )
stpapi.continue.process("tdilc4201m000",msg)
stpapi.end.session("tdilc4201m000")
}
|******************************************************************************
|* API Code for printing outbound shortages for a production runnumber, order,
|* operation, item or warehouse. This routine is current not used 10-14-2004.
|******************************************************************************
function extern print_shortages( domain tcmcs.str12 runnumber,
domain tcorno run.order.f,
domain tcorno run.order.t,
domain tcpono run.opno.f,
domain tcpono run.opno.t,
domain tcitem run.item.f,
domain tcitem run.item.t,
domain tccwar run.cwar.f,
domain tccwar run.cwar.t,
ref string msg())
{
apishort= "shortage"
export("apishort",apishort)
msg = ""
stpapi.put.field("tdilc4201m000","runnumber",runnumber)
stpapi.put.field("tdilc4201m000","koor.f",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4201m000","koor.t",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4201m000","cuno.f","")
stpapi.put.field("tdilc4201m000","cuno.t","ZZZZZZ")
stpapi.put.field("tdilc4201m000","orno.f",str$(run.order.f))
stpapi.put.field("tdilc4201m000","orno.t",str$(run.order.t))
stpapi.put.field("tdilc4201m000","opno.f",str$(run.opno.f))
stpapi.put.field("tdilc4201m000","opno.t",str$(run.opno.t))
stpapi.put.field("tdilc4201m000","prdt.t",str$(date.num()+1000))
|stpapi.put.field("tdilc4201m000","ddat.f",str$(date.num()-1000))
stpapi.put.field("tdilc4201m000","ddat.t",str$(date.num()+1000))
stpapi.put.field("tdilc4201m000","cprj.f","")
stpapi.put.field("tdilc4201m000","cprj.t","ZZZZZZ")
stpapi.put.field("tdilc4201m000","item.f",run.item.f)
stpapi.put.field("tdilc4201m000","item.t",run.item.t)
stpapi.put.field("tdilc4201m000","cwar.f",run.cwar.f)
stpapi.put.field("tdilc4201m000","cwar.t",run.cwar.t)
stpapi.put.field("tdilc4201m000","cntr.f","")
stpapi.put.field("tdilc4201m000","cntr.t","ZZZ")
stpapi.put.field("tdilc4201m000","crte.f","")
stpapi.put.field("tdilc4201m000","crte.t","ZZZZZ")
stpapi.put.field( "tdilc4201m000", "print.recom", str$(tcyesno.no) )
stpapi.put.field( "tdilc4201m000", "prnt.error.report", str$(tcyesno.no) ) |20060804
stpapi.put.field( "tdilc4201m000", "prnt.shortage", str$(tcyesno.yes) )
stpapi.put.field( "tdilc4201m000", "pr.peg.shortage", str$(tcyesno.yes) )
| Advice Report
stpapi.set.report( "tdilc4201m000","rtdilc420101000",spool.device, msg )
|Shortage Report
|stpapi.set.report( "tdilc4201m000","rtdilc420102000","D66", msg )
stpapi.continue.process("tdilc4201m000",msg)
stpapi.end.session("tdilc4201m000")
}