SOLVED: The problem actually was the size calculation.
On GUI_DOWNLOAD, I was calculating wrongly myself.
On CL_DOCUMENT_BCS->ADD_ATTACHMENT, the standard method called COUNT_DOC_SIZE is wrong!
The solution is to always use DOCUMENT_DATA-DOC_SIZE returned by SO_DOCUMENT_READ_API1, instead of calculating. Of course, COUNT_DOC_SIZE should be corrected, but I found no note.