select erpa89.nr01 as nr01,
       erpa89.p01 as p01, 
       p07.p03 as vp01,
       erpa89.p02 as p02, 
       erpa89.p03 as p03, 
       ifnull(us0.p100, ' ') as vp03, 
       erpa89.p04 as p04, 
       ifnull(f03.pp01, ' ') as vp04, 
       erpa89.p05 as p05, 
       erpa89.remfuser as remfuser, 
       erpa89.remfdate as remfdate, 
       erpa89.remftime as remftime 
       
FROM erpa89
LEFT JOIN f03 ON f03.p01=erpa89.p04
LEFT JOIN us0 ON us0.p01=erpa89.p03
LEFT JOIN p07 ON p07.p01=erpa89.p01

WHERE erpa89.p01='{peg_lockar[1]}'
  &&  erpa89.p02={peg_lockar[2]};