vsevilla
20th January 2003, 21:20
Hi all

I have a problem when i try insert a record the message that appear is "Command Disabled".

Baan Vc
W2000
SQLServer

I have installed the latest solution of tools.

Could you help me please

This is my code


ret.code = stpapi.synchronize.dialog("cisli2520m000","add", err)
if ret.code then
stpapi.put.field("cisli2120s000", "cisli220.sfcp", "100")
stpapi.put.field("cisli2120s000", "cisli220.scmp", "100")
stpapi.put.field("cisli2120s000", "cisli220.cofc", cofc)
stpapi.put.field("cisli2120s000", "cisli220.date", str$(work.date))
stpapi.put.field("cisli2120s000", "cisli220.refa", refa)
stpapi.put.field("cisli2120s000", "cisli220.ofbp", ofbp)
stpapi.put.field("cisli2120s000", "cisli220.itbp", ofbp)
stpapi.put.field("cisli2120s000", "cisli220.pfbp", ofbp)
stpapi.put.field("cisli2120s000", "cisli220.itoa", itoa)
stpapi.put.field("cisli2120s000", "cisli220.stoa", itoa)
stpapi.put.field("cisli2120s000", "cisli220.fcrt", "6")
stpapi.put.field("cisli2120s000", "cisli220.ratd", str$(work.date))
stpapi.put.field("cisli2120s000", "cisli220.rate", "1")
stpapi.put.field("cisli2120s000", "cisli220.ratf", "1")
stpapi.put.field("cisli2120s000", "cisli220.rtyp", "SLS")
stpapi.put.field("cisli2120s000", "cisli220.ccur", "ECU")
stpapi.put.field("cisli2120s000", "cisli220.paym", "CHD")
stpapi.put.field("cisli2120s000", "cisli220.cpay", "001")
stpapi.put.field("cisli2120s000", "cisli220.ctyn", "1")
stpapi.put.field("cisli2120s000", "cisli220.subc", "2")
ret.code = stpapi.insert("cisli2520m000", false, err)
if ret.code then
ret.code = stpapi.save("cisli2520m000",err)
if ret.code then
else
while true
field = stpapi.get.mess.code("cisli2520m000", err)
if isspace(err) then
break
endif
endwhile
ret.code = stpapi.recover("cisli2120s000",err)
err = err & " No se puede crear la Cabecera"
write.err.record()
endif
else
while true
field = stpapi.get.mess.code("cisli2520m000", err)
if isspace(err) then
break
endif
endwhile

ret.code = stpapi.recover("cisli2120s000",err)
err = err & " No se puede crear la Cabecera"
write.err.record()
endif
endif
stpapi.end.session( "cisli2520m000" )


Regards

lbencic
20th January 2003, 23:15
Can you say at which point the 'err' gets filled with that message? Also, if you could update your post to show baan code, the formatting would take:

like '' at the beginning and '' at the end.

OOoo..I can't put it in without formatting! Check the 'vB Code' help for how to format your code using the code=baan command in brackets at the top, and the /code command in brackets at the bottom.

mark_h
20th January 2003, 23:31
I added the codes statements to the post - vsevilla should be able to edit his post and see my changes.

I was just wondering if there was any code before the stpapi.synchronize.dialog box or can you just start out with this? Anyway it seems to me that I have seen this in a couple of cases - the first was we needed an updated tools set. The second was when one session did not like insert, but was more than happy with just a save. I am not sure if these apply since we are 4c3, but thought I would mention this.

Mark

vsevilla
20th January 2003, 23:31
the error appear at the insert line



ret.code = stpapi.synchronize.dialog("cisli2520m000","add", err)
if ret.code then
stpapi.clear("cisli2120s000")
stpapi.get.field("cisli2120s000", "cisli220.msid", field)
stpapi.put.field("cisli2120s000", "cisli220.sfcp", "100")
stpapi.put.field("cisli2120s000", "cisli220.scmp", "100")
stpapi.put.field("cisli2120s000", "cisli220.msid", "11")
stpapi.put.field("cisli2120s000", "cisli220.cofc", cofc)
stpapi.put.field("cisli2120s000", "cisli220.date", str$(work.date))
stpapi.put.field("cisli2120s000", "cisli220.refa", refa)
stpapi.put.field("cisli2120s000", "cisli220.ofbp", ofbp)
stpapi.put.field("cisli2120s000", "cisli220.itbp", ofbp)
stpapi.put.field("cisli2120s000", "cisli220.pfbp", ofbp)
stpapi.put.field("cisli2120s000", "cisli220.itoa", itoa)
stpapi.put.field("cisli2120s000", "cisli220.stoa", itoa)
stpapi.put.field("cisli2120s000", "cisli220.fcrt", "6")
stpapi.put.field("cisli2120s000", "cisli220.ratd", str$(work.date))
stpapi.put.field("cisli2120s000", "cisli220.rate", "1")
stpapi.put.field("cisli2120s000", "cisli220.ratf", "1")
stpapi.put.field("cisli2120s000", "cisli220.rtyp", "SLS")
stpapi.put.field("cisli2120s000", "cisli220.ccur", "ECU")
stpapi.put.field("cisli2120s000", "cisli220.paym", "CHD")
stpapi.put.field("cisli2120s000", "cisli220.cpay", "001")
stpapi.put.field("cisli2120s000", "cisli220.ctyn", "1")
stpapi.put.field("cisli2120s000", "cisli220.subc", "2")
ret.code = stpapi.insert("cisli2520m000", false, err)
if ret.code then
ret.code = stpapi.save("cisli2520m000",err)
if ret.code then
else
while true
field = stpapi.get.mess.code("cisli2520m000", err)
if isspace(err) then
break
endif
endwhile
ret.code = stpapi.recover("cisli2120s000",err)
err = err & " No se puede crear la Cabecera"
write.err.record()
endif
else
while true
field = stpapi.get.mess.code("cisli2520m000", err)
if isspace(err) then
break
endif
endwhile

ret.code = stpapi.recover("cisli2120s000",err)
err = err & " No se puede crear la Cabecera"
write.err.record()
endif
endif
endif
stpapi.end.session( "cisli2520m000" )

lbencic
20th January 2003, 23:36
I don't see the 'stpapi.clear' command in my manual...perhaps it's been 'disabled'. Or maybe it's new and I don't have it documented yet. Try without it.

vsevilla
20th January 2003, 23:48
Hi

I cann't any code before stpapi.synchronize.dialog, and i was trying only with stpapi.save and not work.

vsevilla
20th January 2003, 23:50
i delete the stpapi.clear line, i have the latest solutions of tools.
not working yet

lbencic
20th January 2003, 23:56
I think I see. Issue the insert, save and related commands to the sub session, not the main. I think you are issueing the insert command to the display session, where it's disabled.

Make sure to end the sub session, and then the main.

Paul P
21st January 2003, 03:38
Dear all,

During quick scanning, the only thing missing from the original code is closing cisli2120s000. This must be done before closing cisli2520m000. It is OK, Mark, to start coding with synchronization since cisli2520m000 is a type 2 session (no group). Also, lbencic, vsevilla is correct in performing the insert and save to the main session, while recover to the subsession. This is the way it's supposed to be done according to manual

The only thing to observe now is the behaviour of cisli2520m000 & cisli2120s000 combo. I'm not so familiar with these 2, so I'll explore it later when I have free time

Rgds,
Paul

lbencic
21st January 2003, 17:49
Paul & All -
100% correct, my bad, you need to issue the insert to the main session in Baan V. Hey..it does look like he's following the example from the Developer's Guide for Baan V updates, which does not issue the stpapi.end.session to the single occurance session either :rolleyes:

Still, he gets the error on the insert, so I don't think the close is the whole problem...right?

Do you have source to debug the cisli2520 / cisli2120 sessions? As Paul mentioned, sometime the problem is in the source itself, and the sessions may not be api friendly.

vsevilla
21st January 2003, 20:16
Hi

I don't have the source code, but i think that the variable update.status does not equal to ADD.SET or something like that.

If somebody have the source code please help me!!

maxime
5th February 2003, 19:46
According to me, the problem area is:

stpapi.put.field("cisli2120s000", "cisli220.sfcp", "100").
stpapi.put.field("cisli2120s000", "cisli220.msid", "11")


The cisli200.sfcp and cisli220.msid should should be stpapi.get.field("cisli2120s000"....).

Please check this out.

Maxime.

mostrightfuture
30th June 2004, 15:59
hi vsevilla and others,

vsevilla, I am facing the same problem, how u resolved that. Please tell me briefly.

Also maxime, what do you mean that is should be the stpapi.get.field() instead of stpapi.put.field(), I mean we have to put the field in the session not to get those fields from the session.

Thanks in Advance
Mahmood

vsevilla
30th June 2004, 17:39
Hello Mahmood

Really i don't know where is the problem, may be the header session are not AFS compliant

To solve the problem, i did a mix program. to create de header i used the standard development.

and for the the lines i did a AFS function.

regards

Vinicio

mostrightfuture
30th June 2004, 17:46
hi vsevilla,

Thanks for quick reply. Please if you find some time then check my post. May be u can give any suggestion. Here is the link

Link to My Post... (http://www.baanboard.com/baanboard/showthread.php?p=60124#post60124)

Thanks in advance
Mahmood