petguego
5th January 2006, 23:12
Hello friends, I have a doubt with the function stpapi.get.mess.code(), in the manual appears that this function has 2 arguments "string stpapi.get.mess.code(string session [, ref string err.mesg ])", but in the compiler it accepts single one to me. I am occupying it of the following way:
function extern void fsls4102m000.ingresar.detalle.ov(
const domain tcseak seab.p,
const domain tcqsl1 oqua.p,
const domain tcpric pric.p,
const domain tccwar cwar.p)
{
domain tcmcs.str100 err.msg
domain tcdsca error.code
stpapi.put.field("tdsls4102s000", "codbarr.o", seab.p)
stpapi.put.field("tdsls4102s000", "tdsls041.oqua", str$(oqua.p))
error.code = stpapi.get.mess.code("tdsls4102s000") <--Here I obtain the error that corresponds when there is no stock, shows a message and despues shows menu
if error.code = "tdsls11086" then
stpapi.zoom.option("tdsls4102s000", 1, "tdsls4801s000", err.msg)
endif
stpapi.put.field("tdsls4102s000", "tdsls041.pric", str$(pric.p))
stpapi.put.field("tdsls4102s000", "tdsls041.cwar", cwar.p)
stpapi.insert("tdsls4102s000", true, err.msg)
|stpapi.save("tdsls4102s000", err.msg)
}
The problem is that in the indicated point it does not give back no error and when the function is executed stpapi.insert the program is hung, please to indicate if this good to me programmed the instructions stpapi.get.mess.code and stpapi.zoom.option
Thanks
Atte
PGG
lbencic
5th January 2006, 23:27
This is a fun problem. Here's a related post to try. I never got it working, but had a work around before the more interesting suggestions came onto the post.
Link for Sales Order Lines api discussion (http://www.baanboard.com/baanboard/showthread.php?t=5833&highlight=api+tdsls4102)
Good luck
petguego
5th January 2006, 23:34
Lnk is for BaaN V and I work with BaaN IV, do not throw error to me in the session, remain in delay, Thanks
lbencic
5th January 2006, 23:48
The last 1/2 of the post - Francesco's version, is Baan IV and he appears to have it working, and there is extensive discussion on how to handle the Insufficient Inventory error, which is a common problem in Baan IV and V. The error is not an error, it's a message, and directly you go into the field level zoom and you are hung. So there is not a place to get the message before handling the zoom. You need to just handle the zoom directly, and the message is ignored, you may be able to retrieve it still if you get the menu zoom working right first. If you do not get the menu zoom working right, it will hang before you can retrieve any messages.
mark_h
6th January 2006, 00:11
This is actual code in my production environment and should work on 4c4.
error_code = stpapi.get.mess.code("tdilc4113s000",msg)
if strip$(error_code) = "tdilc40062" then
msg = ""
endif
You may want to make sure you have the lastest stpapi objects and tools version if this does not work. This session was developed under 4c3 and converted to 4c4. This piece of code worked in both versions. For your problem I do not think this will work - basically you put two fields and then check for an error. There was no action on the session itself (save, update, insert) so I have to defer to Lisa and Francesco's posts on how to use these sales sessions(we do not use this module).
Holger R
10th January 2006, 09:47
Hello Petguego,
all the messges of the sessions are in a stack. You can get them after the insert call, because the check.fields are executed after a cont.process or update db.
You can get all the messages, when you make a while loop until the error message is empty. The latest message is the first.
The right call is "stpapi.get.mess.code(string session, ref string error message)
Greetings,
Holger
petguego
13th January 2006, 01:59
I have another doubt, which happens is that the instruction stpapi.end.session does not work with the session tdsls4102s000 to me, in program is left patch, since I can make to solve this?
Thanks
Peter
Holger R
13th January 2006, 11:39
Do you checked the afs-log if there are sessions started from tdsls4102s000 which you don't handle with the afs commands?
Holger
petguego
13th January 2006, 14:27
Yes, I verified that the program executes 3 sessions: tdsls4101m000, tdsls402s000 and tdsls4503s000, I execute to commando stpapi.end.session for these three sessions but the program when finalizing is hung the session tdsls402s000. Thank you very much
Holger R
16th January 2006, 19:23
Do you made a stpapi.handle.subproc for the session tdsls4503s000 before executing tdsls4102s000? You need a handle for sub sessions to send stpapi - commands to them.
Greetings,
Holger
petguego
19th January 2006, 15:25
I am not using the session directly tdsls4503s000, but like the active one, treatment to close it. My real problem is that not like handling in the program the message that gives the system when there is no stock, and the other is that when closing the session tdsls412s000 elprograma is left patch.
Thank you very much
petguego
Hitesh Shah
19th January 2006, 15:54
petguego,
We too used to get a menu prompting action on insert of lines in sales order.
We inserted following code before stpapi.insert , and the menu was hadled proeprly.
stpapi.handle.subproc("tdsls4102s000","mtdsls000090451","10")
U dont need to close tdsls4503s000 .It's closed automatically with close of tdssl4102s000 .
The 2nd problem is still not clear . Can u elaborate.
veyant
3rd March 2006, 14:12
Actually, if stock is not aavilable then it pops up with the menu option and there are 2 types of menus. on the basis of some values, it will popup a menu with 10 items or it will popup a new with 12 items and in both menu's you willbe having "No Action" at respective 10th or 12th position.
As hitesh suggested but "10" in third argument and if doesn't work then try for "12" as third argument.
thanks