Hi,
Try to use the same bapi 'BAPI_DOCUMENT_CREATE2' to attach the files as well, just pass the attachment in the tables parameter 'DOCUMENTFILES'. There is no need to of another function module 'CVAPI_DOC_CHECKIN' for uploading.
Thanks & Regards
Bala Krishna