MWE

\documentclass[11pt,a4paper]{exam}

\begin{document}
First Page
\newpage

The content of lhead is \macrol.

The content of rhead is  \macror.

\end{document}


My purpose is to call \lhead or \rhead from anywhere in the text with a macro.

Thanks.

• I'm sorry but I don't understand what you want. There's no problem to put a macro inside the \lhead command. How do you want the choice to be made? – Alan Munn Dec 3 '17 at 22:23
• I apologize for not telling you exactly. I edited the problem and added new image. Can you check? – Özgür Dec 3 '17 at 22:32
• I'm sorry but I still don't understand. Do you want to define a macro that saves the value of \lhead and \rhead which can then be used in the document. – Alan Munn Dec 4 '17 at 0:06
• I want to write that I'm sorry again. No I do not want to define a macro without saving the \lhead and \rhead values ​​that can be used later on the document. I want to define a macro but this macro will be to read the contents of \lhead and \rhead. – Özgür Dec 4 '17 at 4:59

Here's a simple way to do what you want:

\documentclass[11pt,a4paper]{exam}