This would be an example code for this problem (on anyDB, but works in HANA the same way):
Note that the requirement to print out
StoreB MatB 0
is not fulfilled with that.
And to be honest, I don't really see the reasoning behind that,
StoreB/MatB did't change. It simply doesn't occur in D-1...