Here is a little example to illustrate my problem:
\documentclass[fontsize=12pt, paper=a4]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\usepackage{scrpage2}
\clearscrheadfoot
\pagestyle{scrheadings}
\ihead{\leftmark}
\ohead{\rightmark}
\cfoot{\pagemark}
\automark[subsection]{chapter}
\begin{document}
\chapter{Test}
\Blindtext
\section{Sec}
\Blindtext
\subsection{SubSec}
\Blindtext
\chapter{Test2}
\Blindtext
\section{Sec2}
\Blindtext
\subsection{SubSec2}
\Blindtext
\end{document}
As you can see I would like to have chapter and subsection in the heading of each page. But on pages 2 and 6, where no subsection is available, the chapter appears twice in the head. On pages 3, 4, 7 and 8 everything is OK.
I would like to suppress the \rightmark for the subsection, when there is no subsection available. How can I do this?