I made a simple program with pysaprfc that calls function module RPY_PROGRAM_READ to download ABAP sources. (I want to track development progress with a source control management tool.)
Unfortunately pysaprfc (apparently) trims leading spaces so that source code indentation gets lost completely.
If I run RPY_PROGRAM_READ in SE37, leading spaces are retained.
If I run RPY_PROGRAM_READ with startrfc from the RFC SDK, leading spaces are retained, too.