If it is a dialog task, you can set breakpoint in the method called by the task
If it is a method that you want to debug, use SWO1, and create a instance of the object and debug the methods
If it is a background task, and you are in development client, you can do the FOLLOWING. Create an INFINITE loop in the method you want to debug. GO to SM50 (processes overview) and SELECT the RELEVANT item, and select debug from option.