v_kewl
10th April 2018, 18:06
Hi Folks,
AFS code for Process hours tihra1210m000 is not working.

There is a sub session tihra1210s000 getting called from tihra1210m000, which is not getting handled. Throwing a error message "Report not found"
Do anyone have a working code in BaanIVc4?
Thanks!!


Regards,
Gaurav

mark_h
11th April 2018, 01:55
Or if you post your code someone might see something you can check. I do not have any hours accounting afs code, but might see something in your code.

v_kewl
11th April 2018, 15:52
Hi Mark,
Thanks for your reply, below is the code. I treid handling sessions in multiple ways but it was not working, below is one active now.

Error I'm getting in AFS after continue process is "No data found for report, no report is printed" but manually I get error report.

function domain tcbool process.hours(domain tcdate i.date,
domain tcemno i.emno,
domain tihra.sern i.dsrn,
ref domain tcmcs.str300m o.mess)
{
ret.val = false
domain tcmcs.str10 tmp.str1, tmp.str2, tmp.str3, tmp.str4, tmp.str5, tmp.str6
domain tcmcs.str4 o.str.wsrn, o.str.year, o.str.week, o.str.dayn
long o.wkdy, o.yrdy, o.week, o.year

num.to.week(i.date, o.wkdy, o.yrdy, o.week, o.year)

stpapi.put.field("tihra1210m000", "process.yr", str$(o.year))
stpapi.put.field("tihra1210m000", "process.wk", str$(o.week))
stpapi.put.field("tihra1210m000", "process.dy", str$(o.wkdy+1))
stpapi.put.field("tihra1210m000", "process.dt", str$(i.date))
| stpapi.put.field("tihra1210m000", "process.dt", sprintf$("%D018", i.date))
stpapi.put.field("tihra1210m000", "emno.f", str$(i.emno))
stpapi.put.field("tihra1210m000", "emno.t", str$(i.emno))

stpapi.get.field("tihra1210m000", "process.yr", tmp.str1)
stpapi.get.field("tihra1210m000", "process.wk", tmp.str2)
stpapi.get.field("tihra1210m000", "process.dy", tmp.str3)
stpapi.get.field("tihra1210m000", "process.dt", tmp.str4)
stpapi.get.field("tihra1210m000", "emno.f", tmp.str5)
stpapi.get.field("tihra1210m000", "emno.t", tmp.str6)

stpapi.handle.subproc("tihra1210m000" ,"tihra1210s000", "ignore")
stpapi.handle.subproc("tihra1210m000" ,"tihra1211s000", "ignore")
stpapi.handle.subproc("tihra1210m000" ,"tdilc4207s000", "ignore")
stpapi.handle.subproc("tihra1210m000" ,"tdilc4208s000", "ignore")
stpapi.set.report("tihra1210m000", "rtihra121001000", "D", o.mess)

stpapi.continue.process("tihra1210m000", o.mess)
| stpapi.zoom.option("tihra1210m000", 1, "tihra1210s000", o.mess)

| stpapi.set.report("tihra1210s000", "rtihra121001000", "D", o.mess)
| stpapi.put.field("tihra1210s000", "tihra100.year", str$(o.year))
| stpapi.put.field("tihra1210s000", "tihra100.week", str$(o.week))
| stpapi.put.field("tihra1210s000", "tihra100.dayn", str$(o.wkdy+1))
| stpapi.put.field("tihra1210s000", "tihra100.emno", str$(i.emno))
| stpapi.print.report("tihra1210s000", o.mess)

| stpapi.end.session("tihra1210s000")
stpapi.end.session("tihra1210m000")

return(ret.val)
}

mark_h
11th April 2018, 22:36
When you run the session manually do each of those sessions with the stpapi.handle.subproc actually kick off and do something? Require input or anything like that? From looking at the message it looks like they do something even if it is generate a report. So you might just need to define which report tihra1210s000 runs.

Ajesh
12th April 2018, 08:25
Why dont you try to find a record using stpapi.find and then use stpapi,mark and use continue process?

v_kewl
12th April 2018, 18:12
When you run the session manually do each of those sessions with the stpapi.handle.subproc actually kick off and do something? Require input or anything like that? From looking at the message it looks like they do something even if it is generate a report. So you might just need to define which report tihra1210s000 runs.

Except tihra1210s000, other sessions are backflusing session called in backgroud but I believe we don't need to handle it, even without handling all of the sub session which open in background control come back after doing something, with the same message "No data to print".
Also I tried both ways with(setting the report rtihra121001000) and without handling tihra1210s000, system come back without hung.

v_kewl
12th April 2018, 18:14
Why dont you try to find a record using stpapi.find and then use stpapi,mark and use continue process?
I tried that way through maintain hours accounting session, but system do nothing

mark_h
13th April 2018, 15:12
I was poking around looking at my system - tihra1210m000 and 1210s000 run the same script. Those 2 along with tihra1211s000 - all have the same report defined for them. It looks like all three generate the error report - what I am not sure of is if they write to the same open report. Also - I would expect "No data to print" if there were no errors. Are you sure there is an error that would come out if you ran it manually?

I am not even sure we use this session since all of our time comes in thru a 3rd party system and interface.

v_kewl
16th April 2018, 16:52
I was poking around looking at my system - tihra1210m000 and 1210s000 run the same script. Those 2 along with tihra1211s000 - all have the same report defined for them. It looks like all three generate the error report - what I am not sure of is if they write to the same open report. Also - I would expect "No data to print" if there were no errors. Are you sure there is an error that would come out if you ran it manually?

I am not even sure we use this session since all of our time comes in thru a 3rd party system and interface.

Hi Mark,
Thanks for your effort. You are correct "No data to print" message appears when there is no error to report. And in AFS scenario even there is data it displaying the same message. We logged a case with Infor and they too identified it as a bug in the session in case of AFS.

mark_h
17th April 2018, 15:12
Glad to hear they have it as a bug.