Was Jesus having the beatific vision when He said: "My God, My God, why have you forsaken Me?" I know that Jesus had the beatific vision while he stayed on earth. But at the cross, he said "My God, My God, why have you forsaken Me?" sounding like he has not having the beatific vision at that moment. Is it possible that the Father to proved Jesus' human nature by preventing Him His beatific vision on the cross?

Please answer according to the Catholic Church.
The church teaches that the three divine persons of the Trinity are one, truly united, and inseparable (CCC 252' 255' and 689, among other references). So it is not possible for Christ to be excluded from relationship with the Father. Additionally, God the Father is pure spirit and so his relationship with the eternal son would not be affected by Jesus' bodily death.

The understanding of what this verse is saying is not addressed as a doctrine, but I have heard priests preach on this more than once that Jesus is quoting Psalm 22 verse 1 here:


  Psalm 22:1 My God, my God, why have you forsaken me?Why are you so far
  from saving me,so far from my cries of anguish?


Jesus is praying, and the Jewish people would have recognized that he was quoting the Psalm, which expresses anguish but also fundamental trust in God:


  Psalm 22:3-5 Yet you are enthroned as the Holy One;you are the one
  Israel praises. In you our ancestors put their trust;they trusted and
  you delivered them. To you they cried out and were saved;in you they
  trusted and were not put to shame.


Jesus is also fulfilling what was written, in that the people and Jewish leaders are mocking him, as described in the Psalm:


  Psalm 22:7-8 All who see me mock me;they hurl insults, shaking their
  heads. “He trusts in the Lord,” they say,“let the Lord rescue him.Let
  him deliver him,since he delights in him.”


And again, that they would cast lots for his garments:


  Psalm 22:17-18 All my bones are on display;people stare and gloat over
  me. They divide my clothes among them and cast lots for my garment.


Now later I. The Psalm Jesus' trust in God and the fact that God has not turned his face away is made even more clear in the passages leading up to verse 24:


  Psalm 22:19-24 But you, Lord, do not be far from me.You are my
  strength; come quickly to help me. Deliver me from the sword,my
  precious life from the power of the dogs. Rescue me from the mouth of
  the lions;save me from the horns of the wild oxen. I will declare your
  name to my people;in the assembly I will praise you. You who fear the
  Lord, praise him!All you descendants of Jacob, honor him!Revere him,
  all you descendants of Israel! For he has not despised or scornedthe
  suffering of the afflicted one;he has not hidden his face from himbut.
  has listened to his cry for help. (emphasis mine)


As in Gethsemane, Jesus is expressing his fundamental trust in God, and that God will rescue and vindicate him. We should not understand Jesus' words to mean that he has been put at arms length or has been put out of relationship and perfect union with God.

Edit: to address whether Christ's humanity only was separated from God:

The church definitively declared in 451 at the council of Chalcedon, also referenced in CCC 467 regarding Jesus divine and human natures, that:


  We confess that the same Christ, Lord, and only-begotten Son, is to
  be acknowledged in two natures within confusion, change division, or
  separation. The distinction between the natures was never abolished by
  their union...  ... As they came together in one person (prosperon)
  and one hypostasis.


And in CCC 468:


  Thus everything in Christ's human nature is to be attributed to his
  Divine purpose...  ... Also his sufferings and even his death.


So we are taught that there is never any division between Jesus' divinity and his humanity, even such that his humanity is now expressed by his person in the unity of the Trinity (CCC 470).

If this aspect of Christ interests you, you may find the entire article in the catechism helpful, paragraphs 464-483.