Hello
It looks like you are trying to reinvent the wheel.
if you want to use backflush, just set the backflush indicator.
As I pointed previously, the flag "all components" is only relevant if you jump to the goods movements screen during the confirmation.
If you cannot jump to the goods movement screen during the confirmation and if you don't want to set the backflush indicator, you need to develop something using a BAdI or BAPI.
BR
Caetano