veyant
2nd August 2004, 08:26
Hi,

I am facing a serious problem. we have developed a Sales Order AFS for making sales order.

Now it works fine if everything is fine. But if it founds a item which doesn't have cost price structure present. It throws error while inserting item in tdsls4105s000 and hangs when it comes to stpapi.end.session("tdsls4504s000"). I tried a lot but actually it is not killing session tdsls4504s00.

given below is code.

stpapi.put.field("tdsls4105s000","tdsls041.item","ABCD")
stpapi.put.field('tdsls4105s000","tdsls041.oqua",str$(10))
stpapi.handle.sub.proc("tdsls4105s000","tdind0271s000","add")
stpapi.insert("tdsls4105s000",1,err)
stpapi.end.session("tdsls4504s000")
stpapi.end.session("tdsls4105s000")

Now it works fine if item has cost price defind. But if cost price structure of item is not present and standard cost of item is not available then it throws error 'cost price structure not found for the item' at stpapi.insert

now it comes to stpapi.end.session("tdsls4504s000") and then stpapi.end.session("tdsls4105s000") and hangs there. I checked at shell and found that tdsls4504s000 is not killed and is still active and tdsls4105s000 is ended.

now even i kill tdsls4504s000 manually from shell, control doesn't return back and it still hangs there. at the end, you have to kill all sessions.

I tried to kill tdsls4504s000 two three time by puuting tdsls4504s000 continuity but it doesn't worked.

Please help as i am stuck due to this and can't ask user to use AFS in live.

thanks
Sandy

pconde
2nd August 2004, 12:48
Hello,

i think that the best solution is to test the item in your script before starting the insert in sales order lines and see if there is a cost price structure.
AFAIK try to test the field tiitm001.ltcp (date last cost price calulation ) if this field =0 ==> don't insert this line

Regards
Philippe

thieuf
23rd September 2004, 16:42
did you try a recover like below?

if err.msg <> "" then
message(err.msg)
endif

if not isspace(err.msg) then
stpapi.recover("tdsls4101m000",err.msg)
endif

regards Thieu

lakoon
23rd September 2004, 18:39
Hi Sandy

The solution of Thieu will solf your problem

/lakoon