select erpa06.*,
       if(erpa05.p01 IS NULL, '', erpa05.p01) as vpmet
from erpa06
LEFT JOIN erpa05 ON erpa06.pmet=erpa05.nr01
where erpa06.pmod={p_butmod} 
   && erpa06.p00={p_butgrp} 
   && erpa06.p011={peg_termkat}
   && erpa06.p020>0
   && erpa06.p020<={pos_buts}
order by erpa06.p020;