king1980
12th March 2010, 13:00
Hi,
I have written AFS and i am calling this AFS on form command.
The AFS is working fine if all data is correct.
But when some data is not correct the AFS shows message for that wrong data and in same time if i click same form command it shows the synchronize dialogs is not started and session get hang.

Please suggest solution for this issue.


function extern get.order()
{

long retval1
long retval2
long ret
string error.msg(50)
string recover.msg(50)
|domain tcitem itm

ret = stpapi.synchronize.dialog("whinh4525m000", "add", error.msg)
if not ret then
message(error.msg & str$(ret))
choice.again()
endif

error.msg=""
stpapi.put.field("whinh4525m000", "whinh225.oorg", str$(etol(whinh220.oorg)))
stpapi.put.field("whinh4525m000", "whinh225.orno", whinh220.orno)
stpapi.put.field("whinh4525m000","whinh225.oset", str$(whinh220.oset))
stpapi.put.field("whinh4525m000","whinh225.pono", str$(whinh220.pono))
stpapi.put.field("whinh4525m000","whinh225.seqn", str$(whinh220.seqn))
stpapi.put.field("whinh4525m000","whinh225.clot", str$(clot))
stpapi.put.field("whinh4525m000","whinh225.qads", str$(qty.ship))
stpapi.put.field("whinh4525m000","whinh225.item",item)
stpapi.put.field("whinh4525m000","whinh225.runn", "MADHAVI")
retval1 = stpapi.insert("whinh4525m000", true, error.msg)
if not retval1 then
message(error.msg & str$(retval1))
retval2 = stpapi.recover("whinh4525m000", recover.msg)
choice.again()
else
stpapi.form.command("whinh4525m000", 5, "release.advice", error.msg)
message(error.msg )
message("Shipment Complitetd")
stpapi.end.session("whinh4525m000")
endif


}

Regards
Rajesh

manish_patel
12th March 2010, 13:40
you must end session explicitly. Please end session before executing choice.again()


if not retval1 then
message(error.msg & str$(retval1))
retval2 = stpapi.recover("whinh4525m000", recover.msg)
choice.again()
else
stpapi.form.command("whinh4525m000", 5, "release.advice", error.msg)
message(error.msg )
message("Shipment Complitetd")
stpapi.end.session("whinh4525m000")
endif




if not retval1 then
message(error.msg & str$(retval1))
retval2 = stpapi.recover("whinh4525m000", recover.msg)
stpapi.end.session("whinh4525m000")
choice.again()
else
stpapi.form.command("whinh4525m000", 5, "release.advice", error.msg)
message(error.msg )
message("Shipment Complitetd")
stpapi.end.session("whinh4525m000")
endif

king1980
12th March 2010, 13:51
Hi Manish,

I have done the chnages in the code but still it's not working, i am facing same issue

function extern get.order()
{

long retval1
long retval2
long ret
string error.msg(50)
string recover.msg(50)
|domain tcitem itm

ret = stpapi.synchronize.dialog("whinh4525m000", "add", error.msg)
if not ret then
message(error.msg & str$(ret))
stpapi.end.session("whinh4525m000")
choice.again()
endif

error.msg=""
stpapi.put.field("whinh4525m000", "whinh225.oorg", str$(etol(whinh220.oorg)))
stpapi.put.field("whinh4525m000", "whinh225.orno", whinh220.orno)
stpapi.put.field("whinh4525m000","whinh225.oset", str$(whinh220.oset))
stpapi.put.field("whinh4525m000","whinh225.pono", str$(whinh220.pono))
stpapi.put.field("whinh4525m000","whinh225.seqn", str$(whinh220.seqn))
stpapi.put.field("whinh4525m000","whinh225.clot", str$(clot))
stpapi.put.field("whinh4525m000","whinh225.qads", str$(qty.ship))
stpapi.put.field("whinh4525m000","whinh225.item",item)
stpapi.put.field("whinh4525m000","whinh225.runn", "MADHAVI")
retval1 = stpapi.insert("whinh4525m000", true, error.msg)
if not retval1 then
message(error.msg & str$(retval1))
retval2 = stpapi.recover("whinh4525m000", recover.msg)
stpapi.end.session("whinh4525m000")
choice.again()
else
stpapi.form.command("whinh4525m000", 5, "release.advice", error.msg)
message(error.msg )
message("Shipment Complitetd")
stpapi.end.session("whinh4525m000")
choice.again()
endif


}


Regards
king1980

manish_patel
12th March 2010, 14:23
Please check this thread
http://www.baanboard.com/baanboard/showthread.php?t=25556&highlight=whinh4525m000

mark_h
12th March 2010, 15:48
Yes - check your processes in the background. Make sure all sessions get closed in the reverse order they are started. In some cases, not sure if this is one - I do error checking before starting the stpapi code. If you can check for the error before starting the stpapi code I would do that.