Hi Loed,
It seems that the document you referred to is a little broad in the explanation, leaving quite some important details.
I found this document that you can refer.
or maybe rather than making everything from the scratch, you can just make a new implementation out of RSROA_VARIABLES_EXIT_BADI.