Yes, it seem correct. However, are you sure this would be faster than the inbuilt function? I'd find that quite surprising.
Also, this should be faster:
function my_abs(num as integer)
if num < 0 then num = -num
endfunction num
I haven't made any speedtests and don't know whether a few mathematical operations are slower than a single if evaluation. But it might be possible that this is even faster:
function my_abs(num as integer)
num = num*((num > 0)*2-1)
endfunction num
But still, I doubt any of those are faster than just calling DBPro's abs(). Have you checked, or is it just an assumption?