tomzak
4th September 2009, 08:39
Hi @all

I'm writing a programm to change the "confirmed delivery date" in table tdpur401 via tdpur4501m200 and tdpur4101s200. My code looks like this :


stpapi.put.field( "tdpur4501m200", "tdpur401.orno", p.orno )
stpapi.put.field( "tdpur4501m200", "tdpur401.pono", str$(p.pono) )
stpapi.put.field( "tdpur4501m200", "tdpur401.sqnb", str$(p.sqnb) )
ret = stpapi.find( "tdpur4501m200" , err.mesg )
if (ret = 1) then
ret = stpapi.synchronize.dialog("tdpur4501m200", "modify" , err.mesg) )
if (ret = 1) then
stpapi.put.field( "tdpur4101s200", "tdpur401.orno", p.orno )
stpapi.put.field( "tdpur4101s200", "tdpur401.pono", str$(p.pono) )
stpapi.put.field( "tdpur4101s200", "tdpur401.sqnb", str$(p.sqnb) )
stpapi.put.field( "tdpur4101s200", "tdpur401.ddtc", str$(p.ddtc) )
ret = stpapi.update( "tdpur4501m200", 1, err.mesg ) )
stpapi.end.session( "tdpur4101s200" )
endif
endif


At the line "stpapi.end.session" I get an error in the BW-Message window (see attachment). Can anyone help me what to do to eliminate the error?

Kind regards
Thomas

mark_h
8th September 2009, 16:19
Which version of baan are you running? This looks like ln type code, so I can't help much with it. The thing I did notice is that you put orno and pono again - is this how this subsession works? When you run it manually do you put all 4 fields again? Just wondering if the error might be caused by tyring to update the key fields rather than just an update on the confirmed deliver date field.

tomzak
9th September 2009, 11:32
Hi mark_h

1.) I'm using BaanERP
2.) I read in a manual to do this after a synchronize. I comment out this lines, but the result is the same.
3.) I tried also to call session "tdpur4501m00" first, then change to the details (tdpur4501m200) and then change to tdpur4101s200 with the same result.

Kind regards
Thomas

mark_h
9th September 2009, 14:21
Sorry I can not really help with your version. I would contact support - not sure what help they will be, but your code does look correct. The only other thing I can think of would be if you owned source code for tdpur4101s200 - then you could put it in debug mode to see what is causing the error. This problem may also require new session objects or new stpapi libraries, but I just do not know.