blanchap
19th October 2011, 18:36
Hi all,

i need a second set of eyes on this.

what's wrong with this picture?

function insert.tag()
{
stpapi.clear("tdwsl8100mc00")
stpapi.put.field("tdwsl8100mc00","tdwsl800.orno",str$(tag.orno))
stpapi.put.field("tdwsl8100mc00","tdwsl800.pono",str$(tag.pono))
stpapi.put.field("tdwsl8100mc00","tdwsl800.dsca",dsca)
stpapi.put.field("tdwsl8100mc00","tdwsl800.reel",lot)
stpapi.put.field("tdwsl8100mc00","tdwsl800.wghtn",str$(wghtn))
stpapi.put.field("tdwsl8100mc00","tdwsl800.wghtg",str$(wghtg))

retval1 = stpapi.insert("tdwsl8100mc00",true,error.msg)
if not retval1 then
retval2 = stpapi.recover("tdwsl8100mc00",recover.msg)
endif
stpapi.end.session("tdwsl8100mc00")
}

function print.tag()
{
pr.device = "D"
stpapi.clear("tdwsl8400mc00")
stpapi.put.field("tdwsl8400mc00","orno.f",str$(tag.orno))
stpapi.put.field("tdwsl8400mc00","orno.t",str$(tag.orno))
stpapi.put.field("tdwsl8400mc00","pono.f",str$(tag.pono))
stpapi.put.field("tdwsl8400mc00","pono.t",str$(tag.pono))

stpapi.set.report("tdwsl8400mc00", "rtdwsl840012c00", pr.device, error.msg)

if isspace(error.msg) then
stpapi.continue.process("tdwsl8400mc00", error.msg)
endif
stpapi.end.session("tdwsl8400mc00")
}

function tags()
{
stpapi.clear("tdwsl8100mc00")
stpapi.put.field("tdwsl8100mc00","tdwsl800.orno",str$(tag.orno))
stpapi.put.field("tdwsl8100mc00","tdwsl800.pono",str$(tag.pono))
ret = stpapi.find("tdwsl8100mc00", error.msg)
stpapi.end.session("tdwsl8100mc00")
if ret = 0 or ret = 2 then
insert.tag()
print.tag()
endif
}

The insert is working but the print part is not. I ran it in debug and it goes into the logic but does nothing and i do not get any error messages.

Thanks

PB

blanchap
19th October 2011, 19:26
Hi,

one thing i forgot to tell you about this is that in my Baan print session, i do a shell call to unix.

I think it's that call that does not work when i'm using stpapi.

PB

mark_h
19th October 2011, 19:46
Correct forum. Try setting spool.device to D and using spool.device in the stpapi.report. I don't think I have ever tried using a format like that. If that does not work then put your print session in debug mode, step through it. This should show what is happening in the report. I really don't think the shell command is a problem.

blanchap
20th October 2011, 16:00
Found it.

i'm sending the file to a sub directory by ftp (shell call of a unix script). Do be able to do it, i was using the brp.open command.

for some reason, AFS does not like the brp.open. :confused:

I changed my logic by using the spool.open command.

Now, everything is working.

Thanks for the hint.

regards.

PB

mark_h
20th October 2011, 18:44
Honestly I did not even think of that. I just wrote a quick one to call the below code in from another session. This worked thru afs.


choice.print.data:
on.choice:
if(rprt_open())then
effi.rate = effi.factor/100.00
if(prnt.by.mnth=tcyesno.yes) then
set_month_dates(year.f,date.f,year.t,date.t)
else
set_week_dates(year.f,date.f,year.t,date.t)
endif
on case spool.report
| 020303.start
case "rtisfc941601300":
rprt_close(2)
suspend(3000) | This prevents mutliple reports
| 20050414.st - First remove the file.
if strip$(spool.device) = "ASCIT" then
spool.fileout = toupper$(spool.fileout)
seq.unlink(spool.fileout)
endif |20050414.end

hold.f = main.f
hold.t = main.t
select a.cwoc:some.main
from tirou001 a
where a.cwoc inrange :main.f and :main.t
and a.kowc = tckowc.main.wc
selectdo
brp_id = brp.open("rtisfc941601300",spool.device,0)
main.f = some.main
main.t = some.main
select.sfc.status()
| 20060727 Call routine to get grp hours.
select.pastdue.grp.records()
brp.close(brp_id)
| Do this to keep the compiled version from generating two reports.
| Did not work - D66 gets two reports not in debug mode
| rc = shell("sleep 2",SHELL_NO_OUTPUT)
endselect


All I used for AFS code was this:

#pragma used dll ottstpapihand
stpapi.put.field("tisfc9416m000","simu.comp","701")
stpapi.set.report("tisfc9416m000", "rtisfc941601300","D66",date.title)
stpapi.continue.process("tisfc9416m000",date.title)
stpapi.end.session("tisfc9416m000")


Worked like a charm. We are also on something like SP28 with the portingset and stpapi patches that came with it.