Jothilingam
18th August 2004, 07:49
Dear Friends

I had written afs for deleting the Sales Order before Gen. OutBound. I would able to delete the lines but the header It gets hangs. even I tried deleting the apps lock but it still hangs, if any one would have solved this problem please let me know.

function extern domain tcmcs.str100 open.sales.order.header(domain tcorno orno)
{
stpapi.put.field("tdsls4101m000", "tdsls040.orno", str$(orno))
ret = stpapi.find("tdsls4101m000")
if ret = 1 then
stpapi.get.field("tdsls4101m000", "tdsls040.orno", ordno)
if lval(ordno) = orno then
stpapi.handle.subproc("tdsls4101m000","tdsls4105s000","add")
stpapi.continue.process("tdsls4101m000", w.err.msg)
endif
endif
return(w.err.msg)
}


function extern domain tcmcs.str100 delete.sales.order.lines(domain tcorno orno, domain tcpono pono)

{
|Sales Order Lines tdsls4105s000

stpapi.put.field("tdsls4105s000","tdsls041.orno", str$(orno))
stpapi.put.field("tdsls4105s000","tdsls041.pono", str$(pono))
ret = stpapi.find("tdsls4105s000")
if ret = 1 then
stpapi.mark("tdsls4105s000")
stpapi.delete("tdsls4105s000", true, w.err.msg)
stpapi.enum.answer("tdsls4105s000","ttstpq0100", tcyesno.yes)
endif
return(w.err.msg)
}

function extern domain tcmcs.str100 delete.sales.order.header(domain tcorno orno)
{
stpapi.put.field("tdsls4101m000", "tdsls040.orno", str$(orno))
ret = stpapi.find("tdsls4101m000")
if ret = 1 then

stpapi.delete("tdsls4101m000", true, w.err.msg )
stpapi.enum.answer("tdsls4101m000","ttstpq0100", tcyesno.yes)
|stpapi.continue.process("ttstps0177", w.err.msg)

endif
return(w.err.msg)

}

function extern sales.order.delete.close()
{
stpapi.end.session("tdsls4105s000")
stpapi.end.session("tdsls4101m000")
}

Regards

SriksAdi
18th August 2004, 09:27
Hi Jothi,
Can you post the AFS Log ?


Regards
Sriks

Jothilingam
18th August 2004, 10:06
Hi Srikath

Thanks
I had already checked the log file, values which are going inside the sales order is fine and correct, that why I could able to find and delete the lines, after deleting the lines, when we delete the header manually it pop ups two the mesgs with yes no and ok, I am handling that also thru afs, but the ok mesg I could able to handle thru afs.

Rgds
Jothilingam

mark_h
18th August 2004, 14:45
I would expect the answer to come before the delete - like this:

stpapi.enum.answer("tdsls4101m000","ttstpq0100", tcyesno.yes)
stpapi.delete("tdsls4101m000", true, w.err.msg )


instead of this:

stpapi.delete("tdsls4101m000", true, w.err.msg )
stpapi.enum.answer("tdsls4101m000","ttstpq0100", tcyesno.yes)


Mark