schweizer
11th January 2005, 18:01
Hi,
I have a problem with saving a record in tdpur4102m000 per AFS.
Below the code.
Update is O.K. without errors but on stpapi.save it is hanging without a message or else.

stpapi.put.field("tdpur4102m000","tdpur041.orno",str$(tdsls041.****))
stpapi.put.field("tdpur4102m000","tdpur041.pono",str$(tdsls041.ppon))
stpapi.find("tdpur4102m000",err_upd)
stpapi.put.field("tdpur4102m000","tdpur041.oqua",str$(tdsls041.oqua))
stpapi.put.field("tdpur4102m000","tdpur041.ddta",str$(tdsls041.ddta))
stpapi.update("tdpur4102m000",false,err_upd)
if not isspace(err_upd) then
sls_msg = err_upd
endif
e = stpapi.save("tdpur4102m000", err_upd)
if e <> 1 then
e = stpapi.recover("tdpur4102m000", err_upd)
g_upd = false
else
g_upd = true
endif
stpapi.end.session("tdpur5106s000",err_upd)
stpapi.continue.process("tdpur4102m000",err_upd)
stpapi.end.session("tdpur4102m000",err_upd)



thanks for all help.
Regards Schweizer

mark_h
11th January 2005, 19:30
Have you tried stpapi.update("tdpur4102m000",true,err_upd)? If you do this you may not even have to do a stpapi.save. Usually I have to play with a session to find out what it takes to get the update/saves to work. Varies depending on the session, but usually just a update works.

Mark

schweizer
12th January 2005, 21:46
Hi Mark,
Thank you for the Answer.
yes, but it is the same problem with update, when it hangs at this point.
The real session, when I save, I get the Massege "insufficient stock" but I can save anyway.
I don't know, how to handle that.
If I get a Question, Baan takes the default answer and continues, but a Message ??
If I catch the Message I have to call stpapi.recover ??, but I don't want.
:confused:
Rgrds.
Schweizer

mark_h
12th January 2005, 23:26
When you do an update and get a message like "Insufficient stock" you do not have to call stpapi.recover - at least I never have. In the sessions I have run into these type messages I just skip the error routines. I do an error check like this:


if not isspace(err) and err <> "Some error" then
.... do error code...
endif


In some cases it is okay to skip error messages. I have not run into one that gives me an warning message like this and then fails to go ahead and save. Just because a stpapi command returns an error does not mean it is really an error. Like I said sometimes I just code around the messages I get returned - my favorite error is "Process gone".

Mark

lbencic
12th January 2005, 23:43
Are you sure it's not the Insufficient Inventory Menu that hangs up? I had that problem before, posted about it here but never got a great answer:
Old question (http://www.baanboard.com/baanboard/showthread.php?t=5833)

What we wanted to do was to choose 'No Action' from the Insufficient Inventory Menu.

Since then, Doug Stroud has delved into it, he also has multiple postings. I have not tested myself, but the command he sent me for handling the Insufficient Inventory menus / No Action Option in Baan IV is:


stpapi.handle.subproc("tdsls4101s000", "mtdsls000090461", "10")

Where '10' equals either the Process ID or the Menu Choice (they are the same in this case) for 'No Action' as found in Maintain Menus.

For Baan V:

stpapi.handle.subproc("tdsls4101s000", "mtdsls00009047",
"13")

Where 13 = the Menu Option (130) / 10. Thanks again Doug for getting that, would not have figured that one out in a million years.
Note, on my system that option for 'No Action' is 120, so mine would show 12 there, test out what yours should show.

Hope that helps.

lbencic
12th January 2005, 23:55
O, I'm sorry, you are working on tdpur... this applies to tdsls.

Good info to post though, so I guess I'll leave it up.

schweizer
18th January 2005, 09:36
Thanks to all,
the problem is actually solved.
On Save, baan was trying to call a session for maintaining change codes.
Now I changed the script " if api.mode......".
But where must be another way to handle that from the api script, like handle.subproc or??
Regards
Schweizer

schweizer
18th January 2005, 09:40
by the way,
what is the "Insufficient Inventory menu" in

stpapi.handle.subproc("tdsls4101s000", "mtdsls000090461", "10")

lbencic
18th January 2005, 16:22
That's when entering a sales order, if there is not enough inventory for the item/quantity you asked for, this menu will automatically pop up. You can handle it by setting a menu option choice in that 'handle.sub.proc'. In that case, if the menu comes up it should choose option 10 (no action) and continue.

lbencic
18th January 2005, 16:23
And, yes, you can handle the change code session using a handle sub proc command for that sub session, then entering the change code when the session comes under control. It takes some playing, but set up the handle sub proc of the subsession in 'add' mode, then issue commands to it. Give it a try, if you have problems post on up.

schweizer
25th January 2005, 10:34
thanks Lisa I will try it.