Let $R$ be a ring or an algebra. Suppose $B\subseteq R$ satisfies the property $BR \subseteq B$ and $RB\subseteq B$. Is there a general theory of subsets with this property in a ring (resp. algebra) akin to the theory of ideals?
Note: One can simply forget the additive structure (resp. vector space structure) and consider $R$ as a semigroup with multiplication. In that case, $B$ is a semigroup ideal of $R$. I wonder whether there is a theory that takes into account the addition (resp. the vector space structure) of $R$, as well?
For example, let's say $B$ generates the ring, resp. $B$ spans the algebra. What more can be said about $B$, beyond what the semigroup theory provides?
Any references would be well appreciated.