Kingsto88
24th August 2005, 12:38
Hi experts,

I am trying to generate outbound using API.

Could someone advise me on how to solve this error message when
i run my api program.

Thanks and regards

mark_h
24th August 2005, 15:26
Post your code so we can see it. Remember to be on the latest patch of stpapi and the session objects.

Kingsto88
26th August 2005, 04:09
Hi Mark,

I got this script from the baanboard and now the error message is
'Printing canceled'
Any ideas why?

declaration:

table ttdilc103 | Warehouse Order Transfers by Lot and Location
table ttcmcs003 | Warehouses
table ttcmcs001 | Units
table ttdilc101


extern domain tccprj cprj.f fixed
extern domain tccprj cprj.t fixed
extern domain tcitem item.f fixed
extern domain tcitem item.t fixed
extern domain tccuni cntr.f fixed
extern domain tccuni cntr.t fixed
extern domain tccwar cwar.f fixed
extern domain tccwar cwar.t fixed
extern domain tcdate idat.f
extern domain tcdate idat.t
extern domain tcpono sera.f
extern domain tcpono sera.t
extern domain tcsern serb.f
extern domain tcsern serb.t
extern domain tcdsca cwar.dsca
extern domain tcdsca sufr.dsca
extern domain tcdsca cwto.dsca
extern domain tcdsca suto.dsca
extern domain tccwar ln.cwar
extern domain tdilc.loca ln.oldloc,ln.newloc
extern domain tcitem ln.item, var.item
extern domain tcmcs.str15 ln.pric
extern domain tcpric var.pric
extern domain tcmcs.str50 msg

#pragma used dll ottstpapihand

|****************************** form section **********************************

form.1:
init.form:
get.screen.defaults()

|****************************** choice section ********************************

choice.cont.process:
on.choice:
|read.text()
execute(print.data)

choice.print.data:
on.choice:
update.table()

|****************************** field section *********************************

field.cprj.f:
when.field.changes:
cprj.t = cprj.f

field.item.f:
when.field.changes:
item.t = item.f

field.cntr.f:
when.field.changes:
cntr.t = cntr.f

field.cwar.f:
when.field.changes:
cwar.t = cwar.f

before.zoom:
tcmcs003.cwar = cwar.f

field.cwar.t:
before.zoom:
tcmcs003.cwar = cwar.t

field.idat.f:
when.field.changes:
idat.t = idat.f

field.sera.f:
when.field.changes:
sera.t = sera.f

field.serb.f:
when.field.changes:
serb.t = serb.f


|****************************** function section ******************************

functions:

function update.table()
{
long ret
string tmp.orno(6)
stpapi.put.field("tdilc4201m000","runnumber","LISA")
stpapi.put.field("tdilc4201m000","koor.f",str$(tdilc.koob.act.sls))
stpapi.put.field("tdilc4201m000","koor.t",str$(tdilc.koob.act.sls))
stpapi.put.field("tdilc4201m000","orno.f","104876")
stpapi.put.field("tdilc4201m000","orno.t","104876")
stpapi.put.field("tdilc4201m000","cuno.f","")
stpapi.put.field("tdilc4201m000","cuno.t","ZZZZZZ")
stpapi.put.field("tdilc4201m000","opno.f","0")
stpapi.put.field("tdilc4201m000","opno.t","999")
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","")
stpapi.put.field("tdilc4201m000","item.t","ZZZZZZZZZZZZZZZZ")
stpapi.put.field("tdilc4201m000","cwar.f","")
stpapi.put.field("tdilc4201m000","cwar.t","ZZZ")
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.shortage", str$(tcyesno.no) )
stpapi.put.field( "tdilc4201m000", "pr.peg.shortage", str$(tcyesno.no) )
stpapi.set.report( "tdilc4201m000","rtdilc420101000",spool.device, msg )
if isspace(msg) then
stpapi.print.report("tdilc4201m000",msg)
message("%s",msg)
endif
stpapi.end.session("tdilc4201m000")

}

Kingsto88
26th August 2005, 05:49
hi mark,

I solved the problem by commenting out,
stpapi.put.field( "tdilc4201m000", "pr.peg.shortage", str$(tcyesno.no) ).

There is no such field on my screen.

I also replaced spool.device with "ASCIF" and fileout name.
Now it is working,

thanks and regards,

mark_h
26th August 2005, 15:36
Glad to see you got it working. That code is from our A&D extension. We have peg data all over the place.