I know this topic has come up a lot. I have read all the solutions proposed and none of them worked for me.
When I have more than one Master Data Line in my matrix, I am able to delete a row using the following code:
form.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
However, when there is only one row in the matrix and I want to delete it, the above method doesn't work.