My hope is: Your question was already answered.
If not:
Is it possible as shown in your picture? Nope, no way.
Why?
You need flowing current to generate an electromagnetic field.
Therefor you need a closed electric circuit.
Other options?
Yes. You need two parallel wires in wich the current flows in the same direction.
Each wire builds it own electromagnetic field. (Look:
"Right-Hand-Rule".)
The effect is visible
here.
Question now answered?