Pieter van de L
22nd July 2004, 17:11
Hi all,

I have written a code in afs to print orderdocuments, but nothing is comming out of it.
In the afs.log file the message No data found for selection; hence no action taken is generated.

Can anyone please tell me waht is wrong

function do.main()
{
print.order.documents()
}

function print.order.documents()
{
domain tcdate date.f
domain tcdate date.t

date.f = 1072970332
date.t = utc.num() + 43200000

hold.pdno.f = pdno.f
hold.pdno.t = pdno.t

string o.mess(256)
string o.mess1(256)
string o.mess2(256)
long ret.val
stpapi.put.field( "tisfc0408m000", "k.of.sel", str$(etol(tisfc.kosl.manufact)))
stpapi.put.field( "tisfc0408m000", "pdno.f", pdno.f )
stpapi.put.field( "tisfc0408m000", "pdno.t", pdno.t )
stpapi.put.field( "tisfc0408m000", "cprj.f", "" )
stpapi.put.field( "tisfc0408m000", "cprj.t", "ZZZZZZZZZ" )
stpapi.put.field( "tisfc0408m000", "opno.f", str$(0) )
stpapi.put.field( "tisfc0408m000", "opno.t", str$(999) )
| stpapi.put.field( "tisfc0408m000", "m.prod.date.f", str$(date.f) )
stpapi.put.field( "tisfc0408m000", "m.prod.date.t", str$(date.t) )
stpapi.put.field( "tisfc0408m000", "citg.f", "" )
stpapi.put.field( "tisfc0408m000", "citg.t", "ZZZZZZ" )
stpapi.put.field( "tisfc0408m000", "cwar.f", "" )
stpapi.put.field( "tisfc0408m000", "cwar.t", "ZZZZZZ" )
stpapi.put.field( "tisfc0408m000", "plid.f", "" )
stpapi.put.field( "tisfc0408m000", "plid.t", "ZZZZZZ" )
stpapi.put.field( "tisfc0408m000", "cpln.f", "" )
stpapi.put.field( "tisfc0408m000", "cpln.t", "ZZZZZZ" )
stpapi.put.field( "tisfc0408m000", "cpcl.f", "" )
stpapi.put.field( "tisfc0408m000", "cpcl.t", "ZZZZZZ" )
stpapi.put.field( "tisfc0408m000", "csel.f", "" )
stpapi.put.field( "tisfc0408m000", "csel.t", "ZZZ" )
stpapi.put.field( "tisfc0408m000", "order.sorted", str$(etol(tisfc.osrt.order)) )
stpapi.put.field( "tisfc0408m000", "document.sorted", str$(etol(tisfc.dsrt.doc.by.order)) )
| stpapi.put.field( "tisfc0408m000", "key.line", value )
| stpapi.put.field( "tisfc0408m000", "key.buffer", value )
| stpapi.put.field( "tisfc0408m000", "sgmt.stdt.f", str$(value) )
| stpapi.put.field( "tisfc0408m000", "sgmt.stdt.t", str$(value) )
| stpapi.put.field( "tisfc0408m000", "line.ref.date", str$(value) )
| stpapi.put.field( "tisfc0408m000", "asln.f", value )
| stpapi.put.field( "tisfc0408m000", "bffr.f", value )
| stpapi.put.field( "tisfc0408m000", "lstn.f", value )
| stpapi.put.field( "tisfc0408m000", "asln.t", value )
| stpapi.put.field( "tisfc0408m000", "bffr.t", value )
| stpapi.put.field( "tisfc0408m000", "lstn.t", value )
stpapi.put.field( "tisfc0408m000", "print.org", str$(etol(tcyesno.yes)))
stpapi.put.field( "tisfc0408m000", "print.dupl", str$(etol(tcyesno.yes)))
stpapi.put.field( "tisfc0408m000", "print.modi", str$(etol(tcyesno.yes)))
stpapi.put.field( "tisfc0408m000", "print.entpr", str$(etol(tcyesno.yes)))
stpapi.put.field( "tisfc0408m000", "entpr.unit", "HANSEN")
| stpapi.put.field( "tisfc0408m000", "print.atks", str$(value) )
| stpapi.put.field( "tisfc0408m000", "print.planned", str$(value) )
| stpapi.put.field( "tisfc0408m000", "print.wo.oprn", str$(value) )
stpapi.put.field( "tisfc0408m000", "covn.b", str$(etol(tcyesno.yes)))
stpapi.put.field( "tisfc0408m000", "collect.sawl", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "roul.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "cutl.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "oprn.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "collect.cutl", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "matl.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "recn.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "matn.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "insn.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "subn.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "arou.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "chel.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "amat.b", str$(etol(tcyesno.no)))
stpapi.put.field( "tisfc0408m000", "sawl.b", str$(etol(tcyesno.no)))

stpapi.set.report("tisfc0408m000", "rtisfc040801000","PRT44", o.mess1)
stpapi.form.command("tisfc0408m000", 5 , "print.order.documents", o.mess2)
stpapi.end.session("tisfc0408m000")


}


Regards,

Pieter

mark_h
22nd July 2004, 19:55
I see a few things right of the top of my head that could cause it - first is pdno.f and pdno.t string values? The second thing I see is the dates - since I am on Baan 4 I do not have a clue what those numbers represent. I typically do the dates by using date.num()-5000, I figure about 5 years is enough. Not sure how this would look
stpapi.put.field("tdpur4410m000","date.t",str$(date.num()+5000))
in baan 5.

Mark

Pieter van de L
23rd July 2004, 10:32
Mark,

The date's represent the utc value seconds since 01-01-1970
The format you suggest also works within BaanV. but do not give the disered results.
It could be that the problem is the AS400 platform.

I will test more and let you now the result.

Pieter,

Pieter van de L
23rd July 2004, 17:06
In the standard script the reportgroup is set. when called from api the group is not filled correctly. We have to adjust the script.

mark_h
23rd July 2004, 17:17
I would have thought the error "no data found" was data related and not code related. The code I used was just about like yours and I did not have that problem. That is one of the things that make these things so hard to debug at times.

Mark

Pieter van de L
1st September 2004, 09:52
Hi all,

Within BaanERP 5.0c several sessions will not work with AFS. I had a problem with printing orderdocuments. The solution for the session tisfc0408m000 is to always open the report for reportgroup 14. Baan has made a solution for this session but if you don't want to install this then this is a nice workaround.

Another solution is to recomplie the session, several session with a certain date only work after recompiling. Installing a new portinset is not enough.