tbrault
12th August 2002, 09:17
Hi!
I want to generate a inventory order.
For this, I use the session tdinv1220m00, and a vba code.
The program start normally, it created the warehouse stocktaking inventory, but the program don't stop.
When it go on the stapi.continue.process function, the program generate the inventory order, and continue to work, without go on the next code line.
Why, can you help me? I need help please.
This my code :
'-----------------------------------
Function Generation_inventaire()
DoCmd.SetWarnings False
'--> Génération d'un ordre d'inventaire (warehouse stocktaking order)
'--> DECLARATION
'--> Declaration variable session et champ--
Dim BaanSess As String
Dim MagKeyValue1 As String
Dim MagKeyValue2 As String
'------------------------------------------
'--> Declaration valeur--------------------
Dim MagValue1 As String
Dim MagValue2 As String
Dim ErrMessage1 As String
'------------------------------------------
'--> Programme
Set baanobj = CreateObject("Baan4.Application")
'--> Champ-----
BaanSess = "tdinv1220m000"
MagKeyValue1 = "orno.f"
MagKeyValue2 = "orno.t"
'--> Valeurs communes
MagValue1 = "200"
MagValue2 = "200"
ErrMessage1 = Space(30)
'--> Valeur----
'--> recherche
baanobj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & MagKeyValue1 & Chr(34) & "," & Chr(34) & MagValue1 & Chr(34) & ")"
baanobj.ParseExecFunction "ottstpapihand", "stpapi.put.field(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & MagKeyValue2 & Chr(34) & "," & Chr(34) & MagValue2 & Chr(34) & ")"
'--> continue
baanobj.ParseExecFunction "ottstpapihand", "stpapi.continue.process(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & ErrMessage1 & Chr(34) & ")"
baanobj.ParseExecFunction "ottstpapihand", "stpapi.end.session(" & Chr(34) & BaanSess & Chr(34) & ")"
End Function
'---------------------------------------------------
mark_h
12th August 2002, 17:09
I am going to make some guesses. What you posted for tdinv1220m000 does not match what I see when glancing at our version. What version are you on? You may want to update your profile to show that.
(1) When running the session manually does it generate a report? If yes you will need to control that in your VB script. Our version does not, but thought I should ask.
(2) Do any subsessions start and stop when running it manually? You can also check after the continue in your VB script. You can go to the option dialog and do a ps. The description of the error makes it sound like something else is starting and you have not told the program how to control it. I can not be sure because we use ILC on our system.
(3) When running manually you want to check what other fields are defaulting to. You may need to set some of these in your script. Not sure but orno.f and orno.t may not be enough. So it may be doing more than what it does when you run it manually entering only orno.f and orno.t. Just somthing to check.
(4) You probably on to check the support site on Baan to see if you have the current version of this session for your system. They may have already fixed this type of problem before.
Good Luck!
Mark
tbrault
12th August 2002, 17:50
We work on Baan IV c4.
There are not report to print and i don't see a subsession start.
Manually, baan needs orno.f and orno.t only .
In fact, if i understand the problem wqith my program :when the line stapi.continue.process run, baan loop to generate the inventory order, and don't stop to loop when the inventory is ready. This is a endless loop.
On baan, i have seen a solution called "Changes to program scrip for adc (automated data collection) domains for Baan IV" (solution 159191), which work on my session. But i dont understand what is it.
Is is the good patch?:confused:
mark_h
12th August 2002, 20:35
I went to the Baan support site and read the situation and solution descriptions, but they were not helpful at all. I would contact the support site and let them recommend a patch if one was needed. If it was one object I might say backup the old one and load the new one. If it worked great, if it did not then reload the old object. But this patch has more changes in than just one.
Sorry I am not much help.
Mark
tbrault
14th August 2002, 15:45
One thing :
I see that the only sessions which have problems with vb are the sessions which close automatically after the button "continue"
Is there a patch for this?
mark_h
14th August 2002, 17:59
That was a good catch on your part, I would have never noticed that. VB is not the only thing that has problems with this. We are on 4c3 and the one function server I wrote that called a session that had execute(end.program) in it never would work. In my case I was able to get around it by developing my own session. In my case the session was tpptc9820m00c(Maintain Contract Requirements) which automatically starts Maintain Hardware Demands(tpptc9110m00c). So in my new session all I did was zoom to the Maintain Hardware Demand session.
If you own source you might want to try commenting out the execute(end.program) statement and re-compiling. Then run your VB script.
I check the support site but did not see anything about the execute(end.program).
Mark
Satish Nandeti
16th August 2002, 12:32
In AFS we don't have the handle on the sessions which close my themselves at the end of execution. But there is a work around on can think of.
Add this session (tdinv1220m000) to an intermediate session (some dummy session) as an user option, and then from the AFS code first invoke that dummy session and then execute the user option of the session tdinv1220m000, handle tdinv1220m000 as sub proc from dummy session.
After saying continue.process, end just the dummy session (because tdinv1220m000 is already closed at the end of execution)
Example :
Dummy session should have code like,
choice.user.0:
on.choice:
zoom.to$("tdinv1220m000",Z.SESSION,"inv1220","",0)
YOUR AFS code should be,
//first invoke dummy session
stpapi.put.field("tccomdummy","dummy", "dum")
stpapi.find("tccomdummy")
//handle tdinv1220m000 as sub proc & active user option
stpapi.handle.subproc("tccomdummy","tdinv1220m000","add")
stpapi.application.option("tccomdummy",1,0,error.mess)
stpapi.put.field("tdinv1220m000","orno.f","100000")
stpapi.put.field("tdinv1220m000","orno.t","100111")
stpapi.continue.process("tdinv1220m000")
//JUst close dummy session
stpapi.end.session("tccomdummy")
Hope this helps for you.
Regards,
tbrault
19th August 2002, 12:36
I'm a junior developper on Baan Iv (in fact, it's the first time that i develop directly on baan).
When I compil the code of my "dummy session", I have this :
ptdinv1223g( 45) : Warning(5) : statement not reached
ptdinv12230( 17) : Warning(3) return value of function 'zoom.to.menu' ignored
What is it?
PS : my new session is tdinv1223m000
Satish Nandeti
19th August 2002, 12:41
They are just warnings.. but anyway can you please post your dummy session script here? so, that we can look for some action on the warnings you are getting..
Regards
tbrault
19th August 2002, 12:46
yeah! What speed answer!
The only line I have in my code is this :
|****************************** CHOICE SECTION ***************************
choice.user.0:
on.choice:
zoom.to$("tdinv1220s000",Z.SESSION,"inv1220","",0)
|***************************************************
mark_h
19th August 2002, 15:48
I would ignore "statement not reached" warnings. Sometimes I get it and sometimes I don't. Early on I was told to ignore this warning and have. Never looked any further. On the zoom.to warning if you do not put something in the 4th parameter then you get this warning. Again just ignore it.
Good Luck!
Mark
tbrault
19th August 2002, 17:25
When the session and the form are created, I must restart the computer or not?
Have I to convert to runtime data dictionnary or not?
(I ask this since my program on vb open my dummy session, but the button "choice.user.1" that I call with a stapi.handle.subproc, and with a stapi.application.option don't work)
mark_h
19th August 2002, 17:35
No you should not have to convert to runtime or restart your computer. I did notice that you setup choice.user.0 and you say executing choice.user.1. You might want to make sure that these are consistent.
Mark
tbrault
21st August 2002, 09:24
Yeah, the program is ok. :D
In fact, my first program (i have delete the session I've created on baan and i have begun a new session) since I have not inserted a field in my form.
Thanks for all
Tom