Hi Nicholas,
Currently I am not over my system, so I can't tell you the correct answer, but would request you to look into the following proposed solutions :
1. Check if system contains the unchanged value ( previous value ) in variable YVBAP, if yes, then you can put your piece in code inside If clause ( If YVBAP-posex_pruefe NE XVBAP-posex_pruefe ).
2. Otherwise you can also check, if there is some Exit in PBO, if yes, set unchanged value in memory and then again check for the changed variable in PAI block.
Hope it helps.
Thanking You All.