sharma
11th September 2006, 09:25
Hi friends,
I am writing afs script for session tfgld4201m000 Post integration Transaction to finance . This session runs for about 50 Baan Companies through this afs script. While this session runs another session tfgld1211s000 automaticaly runs and ask for a device option , because we have set the Integration Parameter Transaction Real Time to Finance = No and Imediately start finalization process = Yes . while I run this afs session maually then I have to choose device manually for each company. Then it works fine, But while I am runing this session through JOB it hangs may be wating for device option because it do not generate any error log.
Please advice how can I handle this situation.
Thanks
SS
mark_h
11th September 2006, 19:40
Let me see if I understand - when you run your AFS session by hand it will ask for the device once for each company - correct? If so is it possible that you could change your AFS session so that when in runs in batch it pulls the device from a table. We did this so that (a) the batch does not have to be changed except for a range value and (b) the user (or us) could maintain which printers get the report and (c) the users(or us) could set which reports get printed for each site. We did this for outbound - I think one site wants the shortage report and other sites don't. Just a recommendation.
sharma
12th September 2006, 06:00
Yes Sir My problem is same as u understand , how can i change my afs session . I am posting some part of the script. Please advise how can I solve the problem.
Thanks
function proceed()
{
extern long dd,tdd
extern long mm,tmm
extern long yy,tyy
dd = val(sprintf$("%D(%2d)",dt.f))
mm = val(sprintf$("%D(%2m)",dt.f))
yy = val(sprintf$("%D(%04Y)",dt.f))
extern long x.date.f
x.date.f =date.to.num(yy,mm,dd)
tdd = val(sprintf$("%D(%2d)",dt.t))
tmm = val(sprintf$("%D(%2m)",dt.t))
tyy = val(sprintf$("%D(%04Y)",dt.t))
extern long x.date.t
x.date.t =date.to.num(tyy,tmm,tdd)
x.ocom.f =0
x.ocom.t =999
x.tror.f =tctror.pur
x.tror.t =tctror.rg23a.pay.cess
x.fitr.f =tcfitr.on.order
x.fitr.t =tcfitr.pur
error.msg =" "
stpapi.put.field("tfgld4201m000","ocom.f",str$(x.ocom.f))
stpapi.put.field("tfgld4201m000","ocom.t",str$(x.ocom.t))
stpapi.put.field("tfgld4201m000","tror.f",str$(etol(x.tror.f)))
stpapi.put.field("tfgld4201m000","tror.t",str$(etol(x.tror.t)))
stpapi.put.field("tfgld4201m000","fitr.f",str$(etol(x.fitr.f)))
stpapi.put.field("tfgld4201m000","fitr.t",str$(etol(x.fitr.t)))
stpapi.put.field("tfgld4201m000","crdt.f",str$(x.date.f))
stpapi.put.field("tfgld4201m000","crdt.t",str$(x.date.t))
stpapi.put.field("tfgld4201m000","trdt.f",str$(x.date.f))
stpapi.put.field("tfgld4201m000","trdt.t",str$(x.date.t))
if isspace(error.msg) then
stpapi.continue.process("tfgld4201m000",error.msg)
endif
if not isspace(error.msg) then
stpapi.get.mess.code("tfgld4201m000")
endif
if not isspace(error.msg) then
message(" %s " ,error.msg)
stpapi.recover("tfgld4201m000",error.msg)
endif
stpapi.end.session("tfgld4201m000")
}
mark_h
14th September 2006, 14:58
I am confused - I do not see where you set the report or the output device. I am not familiar with tfgld4201m000 - I was expecting something like this?
stpapi.set.report("ticpr2210m000","rticpr221001000",spool.device,msg)
stpapi.continue.process("ticpr2210m000",msg)
When you run your afs manually where do you set the device in your program?
sharma
15th September 2006, 11:03
Sir,
Thanks for ur reply.
In ur example the session ticpr2201m000 contains a report ticpr221001000 but in my case there is no any report atteched in the session tfgld4201m000. If i set the inegration parameter real time to finance = No and imediatly start finalization process= yes , then another session automaticaly starts and send a report tfgld121111000 . I had tried to add this report with session tfgld4201m000 according to the example but it is not working and still asking for device selection. Please suggest .
thanks
kathuria
15th September 2006, 13:06
Dear Sharma,
You can use SPOOL commands to avoide the selection of device. I am giving example for that.
Syntax
long spool.open( string reportname(15), string device(14), long mode )
Description
This opens a specified spooler device.
Arguments
reportname
device If you specify a report name in the reportname argument, it is stored in the predefined variable spool.report, and the current date and time are stored in the predefined variables spool.date and spool.time. The settings for the predefined variables spool.fontnumber, spool.paper.type, and spool.left.mrg are taken from the default settings for the specified report.If you specify a device name in the device argument, it is stored in the predefined variable spool.device. The settings for the predefined variables spool.paper.type, spool.left.mrg, spool.fileout, and spool.pg.length are taken from the default settings for the specified device. If both reportname and device are specified, the defaults for the predefined variables are taken from the default settings for the specified report. The device name is stored in spool.device. If both reportname and device are empty (""), the predefined variables retain their values from the previous spool action.
mode This determines whether or not a window is displayed where the user can change the device settings:0 no window displayed
1 window displayed with a Cancel button
2 window displayed without a Cancel button
Note
To use several spoolers simultaneously, first open all the spoolers. Then set the predefined variable spool.id to the relevant spooler ID before each spoolline() function call.
Return values
0 spooler cannot be opened
>0 ID of opened spooler this is also available in spool.id
Context
3GL function library.
Example 1
long spooler
spooler = spool.open("","",1)
spooler = spool.open("rtccom040101000","D",0)
Example 2
long spooler1, spooler2
spooler1 = spool.open("", "", 1)
spooler2 = spool.open("", "1", 0)
spool.pr.line = "Hello spooler1"
spool.id = spooler1
spool.line()
spool.pr.line = "Hello spooler2"
spool.id = spooler2
spool.line()
spool.id = spooler1
spool.close() | close spooler 1
spool.id = spooler2
spool.close() | close spooler 2[/B]
Regards,
Sanjay Kathuria
mark_h
15th September 2006, 15:26
Sir,
Thanks for ur reply.
In ur example the session ticpr2201m000 contains a report ticpr221001000 but in my case there is no any report atteched in the session tfgld4201m000. If i set the inegration parameter real time to finance = No and imediatly start finalization process= yes , then another session automaticaly starts and send a report tfgld121111000 . I had tried to add this report with session tfgld4201m000 according to the example but it is not working and still asking for device selection. Please suggest .
thanks
I would expect to see something like this in your code:
stpapi.handle.subproc("tfgld4201m000","tfgld4211s000","add")
stpapi.set.report("tfgld4211s000","rtfgld121111000",spool.device,msg)
stpapi.continue.process("tfgld4201m000",error.msg)
Assuming that tfgld4211s000 is the subsession that is automatically called from tfgld4201m000. I have had problems with these types of sessions before so this does not mean this will work. In the above case you could set spool.device to a printer just to see if it worked.
sharma
18th September 2006, 08:07
Sir,
I already tried according the example
stpapi.handle.subprog("tfgld4201m000",tfgld1211s000","add")
stpapi.set.report......
But it is throughing another error End date not defined for fiscal year. It means . It is not getting parameter values.
Thanks
mark_h
18th September 2006, 15:08
If you own source code you could debug the problem - other than that I would probably report this to baan. It could be like you said that tfgld1211s000 is not getting everything it needs. I would report it to baan.
kiran kumar
25th July 2011, 10:46
Hi Sharma,
Did you get any solution for this? If you have kindly update the solution. I am also facing the same problem.
Thanks and Regards,
Kiran Kumar Kolluri
Mail:kiran.kolluri82@gmail.com