Pal123
23rd April 2015, 12:58
Hello,
I get an error "Printing canceled" when I try to use the session tdilc4202m000 using AFS. I am pasting the code below which I use.
stpapi.put.field("tdilc4202m000","runnumber.f",str$(10))
stpapi.put.field("tdilc4202m000","runnumber.t",str$(10))
stpapi.put.field("tdilc4202m000","koor.f","5")
stpapi.put.field("tdilc4202m000","koor.t","5")
stpapi.put.field("tdilc4202m000","orno.f",str$(orno))
stpapi.put.field("tdilc4202m000","orno.t",str$(orno))
stpapi.put.field("tdilc4202m000","item.f","")
stpapi.put.field("tdilc4202m000","item.t","ZZZZZZZZZZZZZZZZ")
stpapi.put.field("tdilc4202m000","cwar.f",cwar)
stpapi.put.field("tdilc4202m000","cwar.t",cwar)
stpapi.set.report("tdilc4202m000","rtdilc420201000","D66",err.msg)
stpapi.continue.process("tdilc4202m000",err.msg)
stpapi.end.session("tdilc4202m000")
I supply values for orno and cwar fields. I debugged the script and found when we cross "stpapi.continue.process" step, err.msg shows "Printing canceled" error. But when I run the session directly, once I press continue button, then "device" selection window opens, there when you click "cancel" button, it shows "printing canceled" message.
I do not have source code. I have to get this running without the access of source code.
Could anyone please share any ideas if you have come across this situation.
Appreciate any help/ideas.
Thank you.
bhushanchanda
23rd April 2015, 13:56
Hi,
Check this similar thread (http://www.baanboard.com/baanboard/showthread.php?t=60939). Verify if all the fields are correctly set and also check if the session has any user defaults. If yes, then clear them and try again. I guess, the thread has a solution explained. Looking at your code, (if versions are same) I feel you are missing some fields and also use a field with required domain instead of passing a value.
Note - Item has a segmented domain. So, you might need a correction there as well.
JaapJD
23rd April 2015, 15:50
Seems to me that using the "D66" device for a process that runs without a UI is causing the problem. Try a device that writes to a file.
mark_h
23rd April 2015, 16:00
It should be okay if the user is running it interactively. If they are running in batch then it might cause issues. We have some sessions that default to the screen - and I always test running to d66.
Pal123
24th April 2015, 08:00
Hi Bhushan,
Thank you for your reply. I went thru' the thread which you have attached. It looks to me that there may a problem specific to release outbound data. Because I have other sessions like generate outbound and picking list are working good.
Also I tried passing value to all the fields with the domains. Still the session gives "Printing canceled" message when it crosses "continue.process".
We use baan4c4, in erpln only segmented domains present know.
One more thing is the release outbound is used for ddc function server also, but I see the session for that is different, tdilc4202b000 and the script as tdilc4202.b. I hope this will not be a problem, when we call the session tdilc4202m000 with AFS.
Thank you.
mark_h
25th April 2015, 03:00
Are you running only the posted code in a session by itself? If not try that.
I posted my code, but I doubt it will help. When you run your session manually and put in D66 how many reports does it generate? We are on 4c4 (but A&D)and ours can generate two reports. Do you have a question on your screen - print error report?. You probably want to make that no. I recommend putting all the form fields when running AFS code. A lot of baans session when you hit the back arrow to leave the session save some defaults - and users to the same thing. By putting all the fields you eliminate that from interfering when someone runs afs code. I am not sure that will solve the issue - but sometimes sessions that create 2 reports have issues. Then you have to get one turned off some how.
A session called using AFS does not exactly act the same as the session run manually. For example you put all the fields using stpapi.put - if you had source code you would see that nothing happens in the session in the background. Then when an action like stpapi.continue occurs - the session wakes up, the check input fields get executed and the session starts processing. This can cause an issue because sometimes the baan sessions needs code in an event that is not executed on stpapi.continue - I think before.display and before.input are two events that do not get executed, but not 100% sure. So there is a slim possibility by putting all fields you hit something the fixes your problem - I do not think so, but it is something else to try.
The DDC function server session should not interfer with it. This could be as simple as needing the latest stpapi libraries or session code. Below is my code but we really do not use the report it generates. We have a lot of goofy requirements on the session so I send the report to a tmp file and it eventually gets deleted.
function extern release_outbound( domain tcmcs.str12 runnumber.f,
domain tcmcs.str12 runnumber.t,
domain tcorno run.order.f,
domain tcorno run.order.t,
domain tcpono run.oper.f,
domain tcpono run.oper.t,
domain tcitem run.item.f,
domain tcitem run.item.t,
domain tccwar run.cwar.f,
domain tccwar run.cwar.t,
domain tcmcs.str14 run.sess,
domain tcmcs.str80 run.inf1,
ref string msg())
{
msg = ""
stpapi.put.field("tdilc4202m000","runnumber.f",runnumber.f)
stpapi.put.field("tdilc4202m000","runnumber.t",runnumber.t)
stpapi.put.field("tdilc4202m000","koor.f",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4202m000","koor.t",str$(tdilc.koob.act.sfc))
stpapi.put.field("tdilc4202m000","orno.f",str$(run.order.f))
stpapi.put.field("tdilc4202m000","orno.t",str$(run.order.t))
stpapi.put.field("tdilc4202m000","opno.f",str$(run.oper.f))
stpapi.put.field("tdilc4202m000","opno.t",str$(run.oper.t))
stpapi.put.field("tdilc4202m000","prdt.t",str$(date.num()+1000))
stpapi.put.field("tdilc4202m000","ddta.f",str$(date.num()-1000))
stpapi.put.field("tdilc4202m000","ddta.t",str$(date.num()+1000))
stpapi.put.field("tdilc4202m000","item.f",run.item.f)
stpapi.put.field("tdilc4202m000","item.t",run.item.t)
stpapi.put.field("tdilc4202m000","cwar.f",run.cwar.f)
stpapi.put.field("tdilc4202m000","cwar.t",run.cwar.t)
stpapi.put.field("tdilc4202m000","gcid.f","")
stpapi.put.field("tdilc4202m000","gcid.t","ZZZZZZZZZZZZZZZZZZZZZZ")
stpapi.put.field("tdilc4202m000","pino.f","0")
stpapi.put.field("tdilc4202m000","pino.t","999999")
stpapi.put.field("tdilc4202m000","cuno.f","")
stpapi.put.field("tdilc4202m000","cuno.t","ZZZZZZ")
stpapi.put.field("tdilc4202m000","cprj.f","")
stpapi.put.field("tdilc4202m000","cprj.t","ZZZZZZ")
stpapi.put.field("tdilc4202m000","cntr.f","")
stpapi.put.field("tdilc4202m000","cntr.t","ZZZ")
stpapi.put.field("tdilc4202m000","crte.f","")
stpapi.put.field("tdilc4202m000","crte.t","ZZZZZ")
stpapi.put.field("tdilc4202m000","deliver.costitem",str$(etol(tcyesno.no)))
spool.fileout = creat.tmp.file$(bse.tmp.dir$())
stpapi.set.report("tdilc4202m000","rtdilc420201000","ASCIF",msg)
if isspace(msg) then
stpapi.continue.process("tdilc4202m000",msg)
some.msg = stpapi.get.mess.code("tdilc4202m000",msg)
endif
stpapi.end.session("tdilc4202m000")
}
Pal123
27th April 2015, 08:34
Hi Mark,
Thanks so much for your reply, and also giving the code. I am giving below the details you have asked. I ran the code with all fields also earlier, still was getting the same error "Printing Canceled". When I run the session manually, it opens up one report. I am not having the question "Print error report" in my screen. I am also not having the source code, and the event sections, I will not be able to see. I am also attaching the debugging screen in a word document.
I am giving below the code I tried, I changed the code little but by adding the values directly.
function extern release.outbound.data3()
{
domain tcmcs.str12 runnumber
domain tcpino pino
domain tcmcs.str50 some.msg
domain tckoda device
domain tcmcs.str14 msg
msg = ""
runnumber = "10"
orno = 100997
pino = 14387
stpapi.put.field("tdilc4202m000","runnumber.f",runnumber)
stpapi.put.field("tdilc4202m000","runnumber.t",runnumber)
stpapi.put.field("tdilc4202m000","koor.f",str$(tdilc.koob.act.rpl))
stpapi.put.field("tdilc4202m000","koor.t",str$(tdilc.koob.act.rpl))
stpapi.put.field("tdilc4202m000","orno.f",str$(orno))
stpapi.put.field("tdilc4202m000","orno.t",str$(orno))
stpapi.put.field("tdilc4202m000","opno.f","0")
stpapi.put.field("tdilc4202m000","opno.t","999")
stpapi.put.field("tdilc4202m000","prdt.t",str$(date.num()+1000))
stpapi.put.field("tdilc4202m000","ddta.f",str$(date.num()-1000))
stpapi.put.field("tdilc4202m000","ddta.t",str$(date.num()+1000))
stpapi.put.field("tdilc4202m000","item.f","")
stpapi.put.field("tdilc4202m000","item.t","ZZZZZZZZZZZZZZZZ")
stpapi.put.field("tdilc4202m000","cwar.f","")
stpapi.put.field("tdilc4202m000","cwar.t","ZZZ")
stpapi.put.field("tdilc4202m000","gcid.f","")
stpapi.put.field("tdilc4202m000","gcid.t","ZZZZZZZZZZZZZZZZZZZZZZ")
stpapi.put.field("tdilc4202m000","pino.f",str$(pino))
stpapi.put.field("tdilc4202m000","pino.t",str$(pino))
stpapi.put.field("tdilc4202m000","cuno.f","")
stpapi.put.field("tdilc4202m000","cuno.t","ZZZZZZ")
stpapi.put.field("tdilc4202m000","cprj.f","")
stpapi.put.field("tdilc4202m000","cprj.t","ZZZZZZ")
stpapi.put.field("tdilc4202m000","cntr.f","")
stpapi.put.field("tdilc4202m000","cntr.t","ZZZ")
stpapi.put.field("tdilc4202m000","crte.f","")
stpapi.put.field("tdilc4202m000","crte.t","ZZZZZ")
stpapi.put.field("tdilc4202m000","deliver.costitem",str$(etol(tcyesno.no)))
spool.fileout = creat.tmp.file$(bse.tmp.dir$())
stpapi.set.report("tdilc4202m000","rtdilc420201000","ASCIF",msg)
if isspace(msg) then
stpapi.continue.process("tdilc4202m000",msg)
some.msg = stpapi.get.mess.code("tdilc4202m000",msg)
endif
stpapi.end.session("tdilc4202m000")
}
Thanks again,
BaanInOhio
27th April 2015, 16:25
Is the "etol" missing below?
stpapi.put.field("tdilc4202m000","koor.f",str$(tdilc.koob.act.rpl))
stpapi.put.field("tdilc4202m000","koor.t",str$(tdilc.koob.act.rpl))
Should be...
stpapi.put.field("tdilc4202m000","koor.f",str$(etol(tdilc.koob.act.rpl)))
stpapi.put.field("tdilc4202m000","koor.t",str$(etol(tdilc.koob.act.rpl)))
mark_h
27th April 2015, 18:34
BaanInOhio - technically you are correct, but it does work with just str$. Now I am assuming tdilc.koob.act.rpl is something to do with replenishment orders.
What service pack are you all on? From looking at your code it should work. For grins and giggles you can try choice.cont twice in a row to see what happens - sometimes the first time something gets set and the second continue(or action) might work. I doubt that will solve the problem.
I know at one point in time the baan source code was merged with a warehouse tool. This resulted in a lot of changes in the ilc module with boi.call, api.mode, etc. - all of which impact some of our code. At this point I would investigate stpapi update and or a session update - maybe contact infor.
BaanInOhio
28th April 2015, 06:01
What about setting spool.fileout in the api session instead of the current session. Not sure if it transfers as an extern variable or not since I always explicitly pass it in stpapi.put.field.
Try:
stpapi.put.field("tdilc4202m000","spool.fileout", creat.tmp.file$(bse.tmp.dir$()))
Replacing:
spool.fileout = creat.tmp.file$(bse.tmp.dir$())
Pal123
28th April 2015, 08:00
BaanInOhio, Thank you for the reply, the etol submission also not working, and earlier I tried with directly supplying the enum constant as below.
stpapi.put.field("tdilc4202m000","koor.f","5")
stpapi.put.field("tdilc4202m000","koor.t","5")
It did not work either.
Hi Mark,
Thank you.
We use SP15, and I tried with 2 times of cont.process subsequently, still giving the same error.
Thanks.
mark_h
28th April 2015, 14:56
It seems it was around SP15-17 when they added a bunch of warehouse integration code. It was around that time they introduced variables like boi.call into the mix - I know one time to fix our issues we had to upgrade the porting set also. At this point I would check with infor. Without source it is impossible to debug what needs to be done to get it to work. We are on a SP in the 30's - we just did one and I am not sure of the number.
sam291091
30th April 2015, 14:00
hi Pal123,
try to use stpapi.print.report() in place of stpapi.continue.process()