How to Set the Actor rotation to Yaw in C++?

yes, this worked and just needed a little modification due to the engine syntax, I am using the old one v4.20, the most stable and not buggy.

GetControllerRotation is undefined for me, and GetControlRotation did the job.

SetActorRotation(FRotator(0, GetControlRotation().Yaw, 0));

Thank You for sharing the knowledge and helping me in my study process.