Microscopic approach to real and imaginary part of the heavy ion potential