Nicole
30th May 2008, 09:33
Hi all,

I have the following problem with AFS.

I have created a session which creates and update items in tiitm001. Afterwards I want to execute session ticpr2210m000. All actions will be done with AFS.

I execute the session ticpr2210m000 as follows:
stpapi.put.field("ticpr2210m000", "item.f", item)
stpapi.put.field("ticpr2210m000", "item.t", item)
stpapi.put.field("ticpr2210m000", "cntr.f", " ")
stpapi.put.field("ticpr2210m000", "cntr.t", " ")
stpapi.put.field("ticpr2210m000", "citg.f", " ")
stpapi.put.field("ticpr2210m000", "citg.t", " 630")
stpapi.put.field("ticpr2210m000", "calc.cd", " 1")
stpapi.put.field("ticpr2210m000", "calc.meth",
str$(etol(tcccmt.top.down)))
stpapi.put.field("ticpr2210m000", "calc.date", str$(date.num()))
stpapi.put.field("ticpr2210m000", "actualize.copr",
str$(etol(tcyesno.yes)))

stpapi.set.report("ticpr2210m000", "rticpr221001000", "D1", msg.calc)
stpapi.continue.process("ticpr2210m000", calc.err)
stpapi.get.mess.code("ticpr2210m000", msg1)

stpapi.end.session("ticpr2210m000")


The problem is that no cost price will be calculated. When I start the session ticpr2210m000 with the same ranges manually --> cost price will be calculated.
After a lot of debugging I found out that following happens in the script ticpr2220 (which will be started from script ticpr2210):
By starting session ticpr2210m000 with AFS the script ignores section "choice.print.data/on.choice" in the script ticpr2220 and executes directly section "choice.print.data/AFTER.choice".

Can somebody explain why this happens and how I can solve it?

Thanks in advance.

Nicole

mark_h
30th May 2008, 14:58
I can't explain why this happens - I think it has to do with multiple reports from multiple sessions. If you look at your code you have only set 1 report - for 2210, and I think another report needs to be set for ticpr2220. I do not know this for a fact and you can try setting a report for ticpr2220 using stpapi.set.report, but with out the session being active I do not think this will work.

Is it possible for you to just run the main session for ticpr2220m000 instead? I know in situations like this, mostly reporting, can be extremely hard to get to work.

The only other way I know would require that you change one(or both) of the baan sessions. You would have to trace your way through making sure everything is passing between the two sessions correctly. Not fun and then you would have to maintain them for SP's.

ipineda
8th October 2008, 19:48
Hi everybody, I know this thread is a bit old but somebody could still need help. I had the same problem Nicole had.
There is something strange with this session because this never executes the print.data/on.choice section.
I solved this problem using a standard DLL that has the function that does all the work for this session:
The dll is:
ticpr.dll2001

and the funtion I used is:
ticpr.dll2001.calc.cost.and.valuation.prices.standard.items

Of course I had to do validation work because in this case you don't use the validations of the session.
I hope this could be usefull for Nicole or for somebody else.

mark_h
9th October 2008, 16:55
Yes - thanks for the post. Good solutions are always welcome.