post sales order

Guys:

i want to check status whether it is released or not, if ti is ,can be post, or else, cann’t be post. the code like this on Onpush in menu item(post):

salesheader.TESTFIELD(Status,Status::Released);
IF Status=Status::Open THEN
EXIT;

the error has been pops up when we post the order with status=open,but why the item has still been shiped? and status has been from OPEN change to RELEASED,what did i missed? thans in advance.

Bill

TESTFIELD(Status,Status::Released);

You need to put the code in Codeunit 80 Sales-Post.

Teddy,thank you very much,the problem has been solved.[:P]