VishalMistry
9th November 2015, 06:22
Hi all,

While running session tdpur4401m000, we are selecting Notepad as Device,
at that time the default textfile name coming is filename.txt.
Is it possible to bring the purchase order number being selected for printing ?

In the Notepad device data, in Arguemnt ASCII:NOTEPAD.EXE %s is given while in Path TEXTFILE.TXT is given. is it possible to pass-on purchase order number given in purchase order From field ? or is it possible to set this value manually through calling stpapi calls for session tdpur4401m000.

Please guide.

Vishal

mark_h
9th November 2015, 17:52
You can try setting spool.fileout before the device is asked for, but I am not sure if the device data would over-write it. I do it in afs all the time below is just an example. One thing to note I export the spool.fileout and import it into the print po session. I have not tried other methods to get the spool.* variables across - like stpapi.put for spool.fileout on the session. That might work. In the below case I just print the file to a file on the baan server, but if I wanted I could use server2client to move it the users desktop.


spool.device = "ASCIF"
spool.fileout = strip$(file.dir) & strip$(str$(tdexi305.orno))&"-PO"
export("spool.fileout",spool.fileout)
print.po.report()
|get.buyer.printer()
|if not isspace(spool.device) then
| print.po.report()
|endif
}
function print.po.report()
{
stpapi.put.field( "tdpur4401m000", "tdpur999.send", str$(tdpur.dist.vendor) )
stpapi.put.field( "tdpur4401m000", "selection", str$(tcyesno.no) )
stpapi.put.field( "tdpur4401m000", "suno.f", " " )
stpapi.put.field( "tdpur4401m000", "suno.t", "ZZZZZZ" )
stpapi.put.field( "tdpur4401m000", "orno.f",str$(tdexi305.orno))
stpapi.put.field( "tdpur4401m000", "orno.t",str$(tdexi305.orno))
stpapi.put.field( "tdpur4401m000", "comp.f", str$(0) )
stpapi.put.field( "tdpur4401m000", "comp.t", str$(999) )
stpapi.put.field( "tdpur4401m000", "tdpur999.dpas", str$(tcyesno.yes) )
stpapi.put.field( "tdpur4401m000", "prnt.pric", str$(tcyesno.yes) )
stpapi.put.field( "tdpur4401m000", "printed", str$(tdsls.kofl.all) )
stpapi.put.field( "tdpur4401m000", "quan.to.print", str$(tdsls.koqu.ordered.quan) )
stpapi.put.field( "tdpur4401m000", "prnt.options", str$(tcyesno.yes) )
stpapi.put.field( "tdpur4401m000", "prnt.deladro", str$(tcyesno.no) )
stpapi.put.field( "tdpur4401m000", "chgflag", str$(tcyesno.no) )
stpapi.put.field( "tdpur4401m000", "chgordnum", str$(0) )
stpapi.put.field( "tdpur4401m000", "chgorddte", str$(0) )
stpapi.set.report("tdpur4401m000","rtdpur440101000",spool.device, msg)
stpapi.continue.process( "tdpur4401m000", msg)
if(strip$(msg)<>"") then
message("Err. Print PO:%s PO:%d", msg, tdexi305.orno)
endif
stpapi.end.session( "tdpur4401m000" )
suspend(500)
}

VishalMistry
10th November 2015, 07:15
Hi Mark,

Thanks for your guidance. I am setting order number as file name but when the report in notepad is generated, it is still as TEXTFILE.TXT,

export("spool.fileout",orno)
stpapi.print.report("tdpur4401m000", error.msg)
stpapi.end.session( "tdpur4401m000", error.msg)

Any clue ? Am I missing anything :)

Vishal

VishalMistry
10th November 2015, 07:27
Hi Mark,

I got it. Actually i had to set spool.fileout global variable.

Thans a lot,
Vishal