Are you able to change it manually from ML81N?
Do you get a error message or any other message that SAP switched it back?
I can't comment on the coding but you can set a breakpoint at the BAPI, trigger SES through ML81N, change the value in debug mode and compare error messages.