How to modify Payment Block settings in MIRO transaction programmatically?

I’m working on a project where I need to update the Payment Block field in the MIRO transaction. I’ve been looking through the SAP documentation, but I can’t find a clear way to do this programmatically. Does anyone know if there’s a BAPI or function module that can handle this? Or maybe some code snippet that could help?

Here’s what I’m trying to achieve:

* Pseudo-code for what I'm looking for
DATA: lv_invoice_doc TYPE belnr_d.

CALL FUNCTION 'UPDATE_PAYMENT_BLOCK'
  EXPORTING
    iv_invoice_document = lv_invoice_doc
    iv_block_status     = 'A'  * 'A' for blocked, ' ' for unblocked
  EXCEPTIONS
    update_failed       = 1
    OTHERS              = 2.

IF sy-subrc <> 0.
  * Handle error
ENDIF.

Any help or guidance would be greatly appreciated. Thanks in advance!