The opcode for enabling abilities is here:
http://wiki.qhimm.com/view/FF8/Field/Script/Opcodes/159_SEALEDOFFsee field 98 (testbl9) - the bosses call this field after defeating them.
For an example of this, see fehall2->boss->push (Ultimecia Castle- Hall)
The toggle to enable/disable locking are probably the LASTIN opcodes in ffbrdg1 and LASTOUT opcodes in fehall1.
I'd make sure you set field byte 334 back to its original value once you're done with it, otherwise you might get some abilities already unsealed when you enter Ultimecia Castle.
I think SEALEDOFF only removes the seal immediately and temporarily. Changing field byte 334 adds the flag to the save for save game loading and LASTIN/LASTOUT toggles.
LASTIN/LASTOUT probably set a flag in the save game and activate/deactivate seals - there's probably exe code that deals with the game loading case.
I'm not 100% sure on all that lot since I've not tested it but it should give you a good starting point.