ranjankool
25th March 2010, 12:50
Hi All,
I was trying to write AFS for Print GPD (below is the code for that).
I have used all option available for Printing. Actually Print button is standard Print command so none of the option are working.
If any one has has done it kindly suggest the appropriate way to do.
function print.gpd(domain whinh.shpm shpm)
{
string error(1000)
spool.device="D"
stpapi.put.field("whinh9447m00l","shpm.f.l",shpm)
stpapi.put.field("whinh9447m00l","shpm.t.l",shpm)
stpapi.put.field("whinh9447m00l","worg.f.l",str$(1))
stpapi.put.field("whinh9447m00l","worg.t.l",str$(82))
stpapi.put.field("whinh9447m00l","worn.f","")
stpapi.put.field("whinh9447m00l","worn.t","ZZZZZZZZZ")
stpapi.put.field("whinh9447m00l","inv.date.l",str$(utc.num()))
| stpapi.put.field("whinh9447m00l","inv.date.l.time","")
stpapi.put.field("whinh9447m00l","reprnt.l",str$(tcyesno.no))
stpapi.set.report("whinh9447m00l", "rwhinh94470500l", spool.device, error)
stpapi.form.command("whinh9447m00l", 23, "print.data",error)
if isspace(error) then
| stpapi.print.report("whinh9447m00l", error)
| stpapi.set.report("whinh9447m00l", "rwhinh94470500l", spool.device, error)
endif
stpapi.enum.answer("whinh9447m00l", "tccoms0014", tcyesno.yes)
stpapi.end.session("whinh9447m00l", error)
}
Actually i am unable to click of standard Print command.
mark_h
25th March 2010, 15:02
First you have to answer the question before it is asked. This would usually happen on the form command.
function print.gpd(domain whinh.shpm shpm)
{
string error(1000)
spool.device="D"
stpapi.put.field("whinh9447m00l","shpm.f.l",shpm)
stpapi.put.field("whinh9447m00l","shpm.t.l",shpm)
stpapi.put.field("whinh9447m00l","worg.f.l",str$(1))
stpapi.put.field("whinh9447m00l","worg.t.l",str$(82))
stpapi.put.field("whinh9447m00l","worn.f","")
stpapi.put.field("whinh9447m00l","worn.t","ZZZZZZZZZ")
stpapi.put.field("whinh9447m00l","inv.date.l",str$(utc.num()))
stpapi.put.field("whinh9447m00l","reprnt.l",str$(tcyesno.no))
stpapi.set.report("whinh9447m00l", "rwhinh94470500l", spool.device, error)
stpapi.enum.answer("whinh9447m00l", "tccoms0014", tcyesno.yes)
stpapi.form.command("whinh9447m00l", 23, "print.data",error)
if isspace(error) then
message(error)
endif
stpapi.end.session("whinh9447m00l", error)
}
I am not familiar with the stpapi.form.command. I found this thread (http://www.baanboard.com/baanboard/showthread.php?t=49268&highlight=print.data) that says it works(well not in webtop, but not the issue here). I notice one has 23 and one has 5 - I can't tell if one or both are correct. Do you get any error or does it just not work?
ranjankool
25th March 2010, 15:36
Hi Mark,
Greetings !!!
Thnx for quick Reply.
But unfortunately now also its not working. I also tried with option 5 i.e.
stpapi.form.command("whinh9447m00l", 5, "print.data",error)
it is also not working.
As per my observation print spooler is not opening because stnd Print button is not getting clicked.
mark_h
25th March 2010, 16:51
Well - like I mentioned I don't know how to tell what number should be in there, but it looks like the right command. You might try using continue.process versus print data. Sorry, but I just am not familiar the stpapi.form.command. Do you have source code on this whinh9447m00l session? You can put it in debug mode and see what each of the commands do.
Chaitanya
28th April 2010, 14:43
Hi,
Try this
function gpd.print()
{
stpapi.put.field( "whinh9447m00l", "reprnt", str$(2))
stpapi.put.field( "whinh9447m00l", "shpm.f", ship )
stpapi.put.field( "whinh9447m00l", "shpm.t", ship )
stpapi.put.field( "whinh9447m00l", "worg.f", str$(1) )
stpapi.put.field( "whinh9447m00l", "worg.t", str$(1) )
stpapi.put.field( "whinh9447m00l", "worn.f", "" )
stpapi.put.field( "whinh9447m00l", "worn.t", "ZZZZZZZZZ" )
stpapi.set.report("whinh9447m00l","rwhinh9447120lc","D",err.msg)
message("Err %s",err.msg)
if isspace(err.msg) then
stpapi.print.report("whinh9447m00l",err.msg)
endif
stpapi.set.report("whinh9447m00l","rwhinh9447120lc","D",err.msg)
if isspace(err.msg) then
stpapi.print.report("whinh9447m00l",err.msg)
endif
stpapi.end.session("whinh9447m00l")
}
Regards,
Chaitanya
BaaNovva
29th April 2010, 17:38
You cannot use std display device as output in AFS. Direct your output to file or printer. Here I have taken an example of output to file by using file device as 'ASCIF'.
Ensure that 'print.data' is set as standard command in your session. Open print session form tab to see Default button's command type as 'Standard Command' and default button as 'print.data'. After any change, compile session, delete old AFS session and regenerate new session object and try.
function print.gpd(domain whinh.shpm shpm)
{
string error(1000)
stpapi.put.field("whinh9447m00l","shpm.f.l",shpm)
stpapi.put.field("whinh9447m00l","shpm.t.l",shpm)
stpapi.put.field("whinh9447m00l","worg.f.l","1")
stpapi.put.field("whinh9447m00l","worg.t.l","82")
stpapi.put.field("whinh9447m00l","worn.f","")
stpapi.put.field("whinh9447m00l","worn.t","ZZZZZZZZZ")
stpapi.put.field("whinh9447m00l","inv.date.l",str$(utc.num()))
stpapi.put.field("whinh9447m00l","reprnt.l",str$(tcyesno.no))
stpapi.enum.answer("whinh9447m00l", "tccoms0014", tcyesno.yes)
stpapi.put.field("whinh9447m00l", "spool.fileout", "rep_output.txt")
stpapi.set.report("whinh9447m00l", "rwhinh94470500l", "ASCIF", error)
stpapi.print.report("whinh9447m00l", error)
stpapi.end.session("whinh9447m00l", error)
}
BaaNovva
29th April 2010, 17:42
Make sure the session is "whinh9447m001" and not "whinh9447m00l" as you have mentioned earlier. I copied the same too in the last reply!.