http://help.sap.com/saphelp_470/helpdata/EN/fc/eb3d35358411d1829f0000e829fbfe/content.htm
According to the above link if we specifiy the length of string while transferring, the string will be truncated.
So could you try this.
OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.
* Remove spaces.
CONDENSE mydata.
* Find the length of the string
len = strlen( mydata ).
* Truncate the rest of the string
TRANSFER: mydata TO FNAME LENGTH len,
CLOSE DATASET FNAME.