If it is an axis with a REP_DIST and REP_OPTION set to 1, then when the end position is “behind” the current position, add the REP_DIST to the MOVEABS target position value.
IF new_position - DPOS < 0 THEN
New_position = new_position + REP_DIST
ENDIF
MOVEABS(new_position)
If the axis is moving at the time you want to load the new moveabs, then compare with ENDMOVE.
IF new_position - ENDMOVE < 0 THEN
New_position = new_position + REP_DIST
ENDIF
MOVEABS(new_position)
Otherwise with the same logic, simply do not load the move.