Switching between edit and read only Mode with global variable GCONSULT

SOLVED

Hello everyone,

For our customer we developed a specific screen to manage plans.

In order to edit a plan the user has to press a check out button.

The user who checked out the plan can modify the plan.

In the FILTRE action we use the global Variable GCONSULT to change the screen to read only, if the user has not checked out the current plan.

We do this with seting the global Variable GCONSULT to 1.

Then no fields of the plan are editable.

The customer wants to be able to change the plan number no matter whether the plan is checked out or not. The plan number is the index field. So the customer can copy and search plans with this field. The other fields should still not be editable, if the plan is not checked out by the current user. 

In order to achieve this I tried to Raz the global variable GCONSULT and set WOK equal to 1 in the apres modif action of the plan number.

  

Unfortunately this doesn't work. The action gets called and the code is executed. But i got the error "creation is not possible"

Does anyone know how can I meet the requirement?

Thank you very much for your help.

Kind regards