Jaroslaw
25th August 2004, 19:48
Hi all,

This is my first attempt at using AFS.
Here is the code

stpapi.put.field("tdilc4905ma00", "clot.f", coil.f)
stpapi.put.field("tdilc4905ma00", "clot.t", coil.f)
stpapi.set.report("tdilc4905ma00", "rtdilc490511a00", "D", error.msg)
stpapi.continue.process("tdilc4905ma00", error.msg)
if not isspace(error.msg) then
message(error.msg)
endif
stpapi.end.session("tdilc4905ma00")

As you can see, I am just trying to print a report, thats all. Here is my problem:
Whatever I put into the "device" parameter of the stpapi.set.report function, I always get the "Device not found" message. I have even tried selecting from table ttaad300 "Device Data" and passing field ttaad300.devc, but to no avail. Also, I tried using stpapi.print.report instead of stpapi.continue.process but the result was the same.
Here is the code from session tdilc4905ma00:

choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if open.report(1, "", 1) then
read.main.table()
close.reports()
else
choice.again()
endif

Does anyone know what I could be missing?
Any comments are welcome :) .
Jaroslaw

NPRao
25th August 2004, 19:57
stpapi.set.report("tdilc4905ma00", "rtdilc490511a00", "D", error.msg)
You cannot use a Device-D-Display Browser. You have to redirect it to a file or printer.

Jaroslaw
25th August 2004, 20:16
Thanks for the quick reply NPRao

I do not think this is the problem, because I have tried sending it to regular printer aswell. For example, "MTB_IS".
Is the "device" parameter supposed to correspond to the "Device" field for a printer in session "Maintain Device Data" (ttaad3100m000) ?
If yes, then something is wrong because I have tried a bunch of printers and none of them seem to work.

Hitesh Shah
26th August 2004, 08:45
As far as i remember open.report is a function encoded in some include itccom for report handling. So u should be having the latest version of this include which can handle AFS working . This function is already used at many places where AFS is working successfully. So there is no reason why it should not work in this session if u have the latest include.

mark_h
26th August 2004, 15:20
I agree with Hitesh, you probably just need the lastest objects for stpapi. It should work just the way you have it.

Mark