Allow edit to be enable in a form method

Dear all,

In the payment journal, there is a field called payment status which is disabled completely. It has to be enabled when we select a field for the payment mode. Like If the payment mode = “check” then the payment status field has to be enabled.Orelse it has to b disabled always. For this I made initially Payment status Allow edit in the form level made to be no. Then wrote a method on modified of the payment mode field.Everything was written in form level. It’s not table form level which is as below.

Forms\LedgerjournalTransVendPaym\LedgerjournalTrans_PayMode1:modified

public boolean modified()
{
boolean ret;

ret = super();

If(ledgerJournalTrans.PaymMode == “Check”)
{
ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans, PaymentStatus)).allowEdit(true);
}
return ret;
}

When I excute it, initially the field is disabled. But on selection of payment mode the field is not enabled. Please let me know whether the above method having some error.

Thanks…