# How to make the table of contents section title upper case without messing with the space between the chapter and section?

When I use this bellow to make the section text upper case:

\makeatletter
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftsectionname}
}
\makeatother


The spacing between my chapter and section is added to the same length as set by (TOC Spacing in Memoir):

\setlength{\cftbeforechapterskip}{12pt}


But if I remove these lines:

\makeatletter
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftsectionname}
}
\makeatother


The spacing between chapters and section is correct:

How to make the table of contents section title upper case without messing with the space between the chapter and section?

With this full code, you can reproduce the problem after building it two times:

\documentclass{abntex2}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

% TOC Spacing in Memoir
% https://tex.stackexchange.com/questions/60317/toc-spacing-in-memoir
\setlength{\cftbeforechapterskip}{12pt}

\makeatletter
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftsectionname}
}
\makeatother

\begin{document}

\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}

\chapter*{Foreword}

\chapter*{Abstract}

\chapter{Chapter One}
\section{Section One One}
\subsection{Section One One}

\section{Section One Two}
\subsection{Section One Two}
\section{Section One Three}
\section{Section One Four}

\chapter{Chapter One}
\section{Section One One}

\section{Section One Two}
\section{Section One Three}
\section{Section One Four}

\end{document}


I managed to fix it using a general solution for the article class I find on How to make section name uppercase in ToC?:

\documentclass{memoir}
\usepackage{textcase}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\makeatletter
\let\oldcontentsline\contentsline
\def\contentsline#1#2{%
\expandafter\ifx\csname l@#1\endcsname\l@section
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{%
\oldcontentsline{#1}{\MakeTextUppercase{#2}}%
}{%
\oldcontentsline{#1}{#2}%
}%
}
\makeatother

\begin{document}

\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}

\chapter*{Foreword}

\chapter*{Abstract}

\chapter{Chapter One}
\section{Section One One}
\subsection{Section One One}

\section{Section One Two}
\subsection{Section One Two}
\section{Section One Three}
\section{Section One Four}

\chapter{Chapter One}
\section{Section One One}

\section{Section One Two}
\section{Section One Three}
\section{Section One Four}

\end{document}


Also it was required to remove these statements from my file:

\renewcommand*{\l@chapter}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftchaptername}
}

\renewcommand*{\l@section}[2]
{%
\l@chapapp{\ABNTEXsectionfont\uppercase{#1}}{#2}{\cftsectionname}
}


They were the cause of all my problems. I am not sure why they are scrolling everything, as causing the spacing between the section and chapter to be the same as the space between chapters.

This last should be due the fact that the command is redefining the \l@section with \l@chapapp, which is just like begging for trouble and weird behaviors.