Danny Leolux
4th January 2005, 16:05
I have tried to make a session that can print orderdocuments based on the current production planning (tisfc012). By selecting the cwoc and date the documents should be printed.

The problem is I always get "No data within selection".
What am I doing wrong? I followed earlier examples here on Baanboard but I can't seem to get it to work.

Who can help me?
(I attached the script to explain what I've tried to do)


|******************************************************************************
|* tiprdd417m000 0 VRC B40O c4 llx4
|* Productiedocumenten op afd.bezetting printen
|* dvh
|* 17-12-04 [14:14]
|******************************************************************************
|* Script Type: 4
|******************************************************************************

|****************************** DECLARATION SECTION ***************************
declaration:

table ttisfc001
table ttisfc012

extern domain tccwoc e.cwoc
extern domain tcdate e.date.f
extern domain tcdate e.date.t
extern domain tcmcs.str20 e.device
extern domain tcorno tisfc001.pdno
extern domain tccprj tisfc001.cprj

#pragma used dll ottstpapihand
|****************************** PROGRAM SECTION ***************************
|****************************** ZOOM FROM SECTION ***************************
|****************************** FORM SECTION ***************************
|****************************** CHOICE SECTION ***************************
choice.cont.process:
on.choice:
read.main.table()
|****************************** FIELD SECTION ***************************
field.e.date.f:
when.field.changes:
e.date.t = e.date.f

|****************************** MAIN TABLE SECTION ***************************
|****************************** FUNCTION SECTION ***************************
functions:

function read.main.table()
{
domain tcmcs.str100 errm
domain tcdate l.date

l.date = date.num() + 1000

select tisfc012.*, tisfc001.*
from tisfc012, tisfc001
where tisfc012._index1 inrange {:e.cwoc, :e.date.f}
and {:e.cwoc, :e.date.t}
and tisfc012.pdno refers to tisfc001
order by tisfc012._index1
selectdo
errm = ""
stpapi.put.field("tisfc0408m000", "order.sorted",
str$(tisfc.osrt.order))
stpapi.put.field("tisfc0408m000","cprj.f", "")
stpapi.put.field("tisfc0408m000","cprj.t", "ZZZZZZ")
stpapi.put.field("tisfc0408m000","pdno.f", str$(tisfc012.pdno))
stpapi.put.field("tisfc0408m000","pdno.t", str$(tisfc012.pdno))
stpapi.put.field("tisfc0408m000","opno.f", "")
stpapi.put.field("tisfc0408m000","opno.t", "999")
stpapi.put.field("tisfc0408m000","prdt.t", str$(l.date))
stpapi.put.field("tisfc0408m000", "document.sorted",
str$(tisfc.dsrt.doc.by.order))
stpapi.put.field("tisfc0408m000", "print.org",
str$(tcyesno.yes))
stpapi.put.field("tisfc0408m000", "print.dupl",
str$(tcyesno.yes))
stpapi.put.field("tisfc0408m000", "print.modi",
str$(tcyesno.yes))
stpapi.put.field("tisfc0408m000", "covn.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "roul.b", str$(tcyesno.yes))
stpapi.put.field("tisfc0408m000", "oprn.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "matl.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "matn.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "subn.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "chel.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "sawl.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "collect.sawl",
str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "cutl.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "collect.cutl",
str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "recn.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "insn.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "pcdl.b", str$(tcyesno.no))
stpapi.put.field("tisfc0408m000", "print.config",
str$(tcyesno.no))
stpapi.set.report("tisfc0408m000", "rtisfc040802001",
str$(e.device), errm)
stpapi.continue.process("tisfc0408m000", errm)
stpapi.end.session("tisfc0408m000")
endselect
}

mark_h
4th January 2005, 17:20
Try using this:

stpapi.set.report("tisfc0408m000", "rtisfc040801000",spool.device,errm)

instead of:

stpapi.set.report("tisfc0408m000", "rtisfc040802001", str$(e.device), errm)


Note that I typically use spool.device instead of anything else - keeps the domains correct. Or just to test use D66.


Mark

mark_h
4th January 2005, 17:56
Forgot to mention that the recommended way to do enumerated values is using something like str$(etol(tcyesno.no)) instead of just str$(tcyesno.no). It seems there are problems sometimes with the format you used - of course I do it the same way, but thought I would mention this.

Mark

Danny Leolux
5th January 2005, 12:37
Hi Mark,

Thank you for the suggestions. I have tried them but they didn't work.
See changed script below:
|******************************************************************************
|* tiprdd417m000 0 VRC B40O c4 llx4
|* Productiedocumenten op afd.bezetting printen
|* dvh
|* 17-12-04 [14:14]
|******************************************************************************
|* Script Type: 4
|******************************************************************************

|****************************** DECLARATION SECTION ***************************
declaration:

table ttisfc001
table ttisfc012

extern domain tccwoc e.cwoc
extern domain tcdate e.date.f
extern domain tcdate e.date.t
extern domain tcmcs.str20 e.device
extern domain tcorno tisfc001.pdno
extern domain tccprj tisfc001.cprj

#pragma used dll ottstpapihand
|****************************** PROGRAM SECTION ***************************
|****************************** ZOOM FROM SECTION ***************************
|****************************** FORM SECTION ***************************
|****************************** CHOICE SECTION ***************************
choice.cont.process:
on.choice:
read.main.table()
|****************************** FIELD SECTION ***************************
field.e.date.f:
when.field.changes:
e.date.t = e.date.f

|****************************** MAIN TABLE SECTION ***************************
|****************************** FUNCTION SECTION ***************************
functions:

function read.main.table()
{
domain tcmcs.str100 errm
domain tcdate l.date

l.date = date.num() + 1000
spool.device = e.device

select tisfc012.*, tisfc001.*
from tisfc012, tisfc001
where tisfc012._index1 inrange {:e.cwoc, :e.date.f}
and {:e.cwoc, :e.date.t}
and tisfc012.pdno refers to tisfc001
order by tisfc012._index1
selectdo
errm = ""
stpapi.put.field("tisfc0408m000", "order.sorted",
str$(tisfc.osrt.order))
stpapi.put.field("tisfc0408m000","cprj.f", "")
stpapi.put.field("tisfc0408m000","cprj.t", "ZZZZZZ")
stpapi.put.field("tisfc0408m000","pdno.f", str$(tisfc012.pdno))
stpapi.put.field("tisfc0408m000","pdno.t", str$(tisfc012.pdno))
stpapi.put.field("tisfc0408m000","opno.f", "")
stpapi.put.field("tisfc0408m000","opno.t", "999")
stpapi.put.field("tisfc0408m000","prdt.t", str$(l.date))
stpapi.put.field("tisfc0408m000", "document.sorted",
str$(etol(tisfc.dsrt.doc.by.order)))
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", "covn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "roul.b",
str$(etol(tcyesno.yes)))
stpapi.put.field("tisfc0408m000", "oprn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "matl.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "matn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "subn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "chel.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "sawl.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "collect.sawl",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "cutl.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "collect.cutl",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "recn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "insn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "pcdl.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "print.config",
str$(etol(tcyesno.no)))
stpapi.set.report("tisfc0408m000", "rtisfc040802001",
spool.device, errm)
stpapi.continue.process("tisfc0408m000", errm)
stpapi.end.session("tisfc0408m000")
endselect
}



I still always get "No data with selection".
Do you perhaps have another idea ?

Thanks in advance,
Danny

kbartelds
5th January 2005, 14:09
Please install solution 146489 for session tisfc0408m000, which solves message "no data within selection" in case of using AFS and having more reports than the covering note.

Regards,
Klaas

Danny Leolux
5th January 2005, 14:33
Hi Klaas,

This solution is not installed yet on our system.
Due to customisation in this script I cann't install this one yet.
I'll request our support partner to build this solution into our object and try it.
Thanks for the tip. I will report the results back via this Board.

Regards
Danny

mark_h
5th January 2005, 15:50
Danny,

If you have a customization on the script you should be able to debug the tisfc0408 script. You could see exactly what is causing the problem. It may be a quick and simple fix. I also still recommend using the other report(rtisfc040801000) instead of the one you selected in your second script. This is one that looks just like one I have for tdilc4201m000 - I always set the main outbound report even if I just want to print the shortages. It may not be right, but it works. Just some thoughts.

Mark

Danny Leolux
5th January 2005, 16:05
Hi Mark,

Since this customisation is made by a third party (our support partner) and we only get the objects and not the scripts from them, debugging is no option. I already tried using the main report of the session as you already suggested earlier, but that didn't change the outcome.

When the solution is delivered by our support partner and it still doesn't work I will try the main report again. Till then I'll let the matter rest.

Thank you again for the suggestions,

Danny

kbartelds
5th January 2005, 18:11
In the script the solution states:
| Also read the reportname from reportgroup 1
| otherwise AFS is not able to determine which report to print

So, to solve the problem, only installing the solution will help.

Regards,
Klaas

lbencic
14th January 2005, 22:11
Hi, I was just doing this. Mark has the clue, as does the solution #146489, but I got it to work without installing. You have to set the report as Mark provided, to report: 040801000, even though you are picking other reports with your enumerated choices. The correct report seems to print despite setting that number to what seems to be the cover note. I got it to print the material list. Maybe that will work for you.

Danny Leolux
20th January 2005, 15:54
Hi Everybody,

I already tried using the first report 040801000 but I didn't get it to work.
Yesterday I received the object containing solution #146489.

IT WORKS !!!!! :) :) :)

See the final (and working) version of my program script:
|****************************** DECLARATION SECTION ***************************
declaration:

table ttisfc012

extern domain tccwoc e.cwoc
extern domain tcdate e.date.f
extern domain tcdate e.date.t
extern domain tcmcs.str20 e.device

#pragma used dll ottstpapihand
|****************************** PROGRAM SECTION ***************************
|****************************** ZOOM FROM SECTION ***************************
|****************************** FORM SECTION ***************************
|****************************** CHOICE SECTION ***************************
choice.cont.process:
on.choice:
read.main.table()
|****************************** FIELD SECTION ***************************
field.e.date.f:
when.field.changes:
e.date.t = e.date.f

|****************************** MAIN TABLE SECTION ***************************
|****************************** FUNCTION SECTION ***************************
functions:

function read.main.table()
{
domain tcmcs.str100 errm
domain tcdate l.date

l.date = date.num() + 1000
spool.device = e.device

select tisfc012.*
from tisfc012
where tisfc012._index1 inrange {:e.cwoc, :e.date.f}
and {:e.cwoc, :e.date.t}
order by tisfc012._index1
selectdo
errm = ""
stpapi.put.field("tisfc0408m000", "order.sorted",
str$(tisfc.osrt.order))
stpapi.put.field("tisfc0408m000","cprj.f", "")
stpapi.put.field("tisfc0408m000","cprj.t", "ZZZZZZ")
stpapi.put.field("tisfc0408m000","pdno.f", str$(tisfc012.pdno))
stpapi.put.field("tisfc0408m000","pdno.t", str$(tisfc012.pdno))
stpapi.put.field("tisfc0408m000","opno.f", "")
stpapi.put.field("tisfc0408m000","opno.t", "999")
stpapi.put.field("tisfc0408m000","prdt.t", str$(l.date))
stpapi.put.field("tisfc0408m000", "document.sorted",
str$(etol(tisfc.dsrt.doc.by.order)))
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", "covn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "roul.b",
str$(etol(tcyesno.yes)))
stpapi.put.field("tisfc0408m000", "oprn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "matl.b",
str$(etol(tcyesno.yes)))
stpapi.put.field("tisfc0408m000", "matn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "subn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "chel.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "sawl.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "collect.sawl",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "cutl.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "collect.cutl",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "recn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "insn.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "pcdl.b",
str$(etol(tcyesno.no)))
stpapi.put.field("tisfc0408m000", "print.config",
str$(etol(tcyesno.no)))
stpapi.set.report("tisfc0408m000", "rtisfc040801000",
spool.device, errm)
stpapi.continue.process("tisfc0408m000", errm)
stpapi.end.session("tisfc0408m000")
endselect
}


Thanks everybody,
Danny

mark_h
20th January 2005, 16:35
Glad to see you got it working. I just checked our test company and our test service pack companies - it works in both companies. The solution 146489 is only installed in the new service pack company. Just goes to show how much fun this can be!!!!!!

Mark