I have completed several 5.7 swaps in the 2002 DR trucks. It is not very complicated. As for the transmission, the 2002 Ram's used the RFE as well. There is not a single physical difference between the 45RFE and the 545RFE. The difference is in the software in the TCM. In the 45RFE programming 4th gear is obtained by applying the O/D Clutch and the 4C clutch. In the 545RFE 5th gear is obtained by applying the O/D Clutch and the 2C clutch.
The 4.7 and 5.7 torque converters have different stall speeds. If you were to use the 4.7 converter with a 5.7 installed the motor will feel a little down on power down low due to the stall speed difference.
Now, to run the 2004 5.7 in the 2002 truck, your going to need the engine wiring harness from the 2004 model along with the 2004 PCM. You will need to have to VIN flashed to the 2004 PCM so you don't end up with a VIN Mismatch in the ABS. Also, you will need to check to see if the 2004 has a SKIM key (grey key) or no SKIM at all (black key).
You will also need to add a pair of oxygen sensors to the exhaust because the 2004 5.7 engine wiring harness has provisions for two Upstream and two Downstream oxygen sensors. If you get the y-pipe from the 2004 5.7 truck you will have the sensor bungs already and will only need to purchase the four oxygen sensors. Make sure to use 2004+ oxygen sensors and do not try to reuse the 2002 oxygen sensors with the 5.7 PCM. The sensors are different and will create some issues.
The easiest way is to avoid SKIM all together but it really depends if the 2002 model has it already. If the 2002 model does not have SKIM then your path is alot easier. If the 2002 does not have SKIM then you would need a 2004 PCM without SKIM.
Make sure you verify what each truck has before you spend the cash.