I have Three managed bean: One session scoped (S) and Two view scoped (A,B). I want to use A's functionality in both S and B. but the problem is that injecting view scoped bean in session scoped one is impossible.
The scope of the object referenced by expression #{a}, view, is shorter than the referring managed beans (s) scope of session
I don't want to duplicate A's functionality. any idea?
This just indicates a design problem in your model. This suggests that view scoped bean class A is having "too much" code logic and that its code should be refactored into a different, reusable class which in turn can be used by both session scoped bean class S and view scoped bean class A. Law of Demeter and such. Perhaps it represents business service code which actually needs to be in an EJB?
In any case, you could achieve the requirement by passing view scoped bean A as method argument of an action method of session scoped bean S.
<h:commandXxx ... action="#{sessionScopedBean.doSomething(viewScopedBean)}" />
But this is also a design smell. You need to make absolutely sure that you choose the right scope for the data/state the bean holds. See also How to choose the right bean scope?