Lock a Sales Order in V11

Hello,

I am currently trying to find a way to lock sales orders that are included in a specific table created when a user accesses sales orders (GESSOH). When I try to do this, however, X3 will not lock the sales order. I believe it is because of the logical lock X3 puts on a sales order when you click on it. I have tried custom locking in the AVANT_VERROU, AVANT_OUVRE, DEFTRANS, and BOITE actions in the SPESOH script using the following code:

For [YTB]

        SYMBOLE=func GOBJACT.SYMBOLE_VERROU("SOH",[F:YTB]YSOHNUM)
        Lock = SYMBOLE

Next

I have already done debugging; fstat = 0 after the Lock statement, and [F:YTB]YSOHNUM produces a valid sales order number.

Therefore, I am stuck and unsure how to get X3 to lock the sales order before it is accessed from the SPESOH script.

Thanks ahead of time!