${if(len((select max(substr(crtim,1,2)) from SAPBI.ZKBS  where to_char(crdat, 'YYYY-MM-DD') = (select current_date "current_date" from dummy)  ))==0,
      "and to_char(a.crdat, 'YYYY-MM-DD') = (select current_date "current_date" from dummy)
      and substr(a.crtim,1,2) =  
      (select max(substr(crtim,1,2)) from SAPBI.ZKBS 
       where to_char(crdat, 'YYYY-MM-DD') = (select current_date "current_date" from dummy)
      ) ",
      "and to_char(a.crdat, 'YYYY-MM-DD') = (select add_days(current_date,-1) "current_date" from dummy)
      and substr(a.crtim,1,2) =  
      (select max(substr(crtim,1,2)) from SAPBI.ZKBS 
       where to_char(crdat, 'YYYY-MM-DD') = (select add_days(current_date,-1) "current_date" from dummy)
      )")}