Andy..
13th August 2008, 12:47
Hi, i've been working on issue material API and have come across a situation where i cant overwrite the lot field if there is already a value in there by default. The std session allows this but however many times i write a new value in there the old lot number remains. I've tried
ret=stpapi.update( "ticst0101s000", do.update, error )
at various points with do.update=true and false and it keeps giving me the error reporting there is not enough stock of the old lot number 'Shortage of 1.333 ton for lot (oldlotnum) of item (item) in (warehouse)'

Slightly odd situation now is that after the update i check
stpapi.get.field( "ticst0101s000", "ticst001.clot", value )

value=the new and correct lot number, but if i then try and update it gives the shortage error for the old lot number?!

mark_h
13th August 2008, 15:46
Well on 4c4 I do not see lot on our session. Just wondering if you tried using stpapi.save versus stpapi.update? I know on at least one session I had to do a save versus an update. Then on another session I had to do a save followed by an update. Not sure what would work on baan 5. Maybe saving the record and then re-adding it with the new lot. Not graceful, but maybe an option.

mark_h
13th August 2008, 15:57
Broke my own rule - I should have searched first. See if lakoons post helps in this thread here (http://www.baanboard.com/baanboard/showthread.php?t=51850&highlight=ticst0101s000). Looks like he does an update on the main session.

Andy..
14th August 2008, 16:25
I had to set more fields than in that example.

When you run the session in certain combinations and get an error/warning it resets lot and/or qty to previous values! The solution was to set qty=0 then set lot, then update, then set qty to desired value and update again - code looks messy and horrible but it does now work! Thanks for your help, Andy