SetActionActive() is used to enable/disable actions specified in ACTION or COMMAND clauses:
CALL DIALOG.SetActionActive(action, boolean)
action is a string (lower case is a must) which defines the action influenced by the method. The action can be identified fully or partially. If the last is the case, the missing information is automatically filled depending on the context:
dialog_name is a string containing the name of a singular dialog or a sub-dialog. field_name is a string identifying the field used in an INFIELD clause of an ON ACTION block.
If the method does not find the action specified in the action argument a run-time error will occur. If SetActionActive() is used within a sub-dialog, the identifier of this sub-dialog can be omitted.
In a singular interaction statements like INPUT, the field-specific actions can be referenced by field_name.action_name if the dialog definition did not contain the NAME attribute.
boolean attribute specifies whether the action can be invoked. The attribute should be represented as 1 (TRUE, the action is enabled) or 0 (FALSE, the action is disabled). The form elements, such as buttons, become inactive when the actions bound to them are disabled.
There is some specifics about using variables with ui.Dialog methods.
You can learn about them here.
You can use SetActionActive() in an INFIELD block in order to disable or enable an action when a cursor goes to a specified field. In order to simplify the actions management, you can create a separate function which analyses the context and activates/deactivates the actions available on the current stage.