Define $\Psi$ as the space of functions $f: [a, b] \to \mathbb{R}$ and a subspace $\Phi \in \Psi$ which include all the monotone non-decreasing continuous functions on $[a, b]$.
Define a mapping $A: \Psi \to \Psi$. What condition $A$ should have such that:
$$
\sup_{g \in \Phi} \int_{a}^{b} (A\circ g)(x) dx = \lim_{N\to\infty} \sup_{g \in \Phi} \sum_{i=1}^{N} (A \circ g)(x_i) \delta
$$
where $x_i = a + (i-1)\delta$ and $\delta = (b-a)/N$. $A \circ g$ are integrable functions. We also know that the left-hand side of the equation is finite.
Assume $A=A(y)$ is unbounded for some number $y$ then you can always choose $g$ which is always constant to make always unbounded. We have shown that $A$ must be bounded.
The case with piecewise constant $A$ is trivial.
For each interval from $I_n=[x_n,x_{n+1}]$ there is a point $x'_n$ and $a_n$ such that $a_n=\sup_{x\in I_n} A(\phi(x))=A(\phi(x'_n))$. If you sum all $a_n$ and then take limit then you get $$ \lim_{N\to\infty}\sum_{n=1}^N \sup_{x\in I_n} A(\phi(x)). $$ For each interval $I_n$ choose a point $x''_n\in I_n$ and then you have $b_n=A(\phi(x''_n))$. If you sum all $b_n$ and then take limit then you get $$ \lim_{N\to\infty}\sum_{n=1}^N A(\phi(x''_n))\leq \lim_{N\to\infty}\sum_{n=1}^N A(\phi(x''_n)). $$ To obtain $$ \lim_{N\to\infty}\sup_{x''_1,\ldots,x''_N}\sum_{n=1}^N A(\phi(x''_n)). $$ you let $x''_n\to x'_n$.