First off, attachments are completely independent from the rest of the transaction. As soon as you add the attachment, it's saved on the DB - no need to save the transaction.
If you're looking for standard source code how to add attachments to an object, set a breakpoint in CL_CRM_DOCUMENTS=>CREATE_WITH_TABLE and upload an attachment. (CL_CRM_BSP_CM_CONTROL=>CREATE_DOCUMENT contains some useful methods to fill the parameters.)
Once the attachment is saved, you can find it in the following tables:
- SKWG_BREL is the contains the link between ORDER/ITEM GUID (INSTID_A) and attachment GUID (INSTID_B)
- Transaction DMWB contains the table that holds the attachment data, for CRM Orders find it here (click on the table icon).
- In the so-found table CRMORDERLOIO, enter the GUID in field LOIO_ID and you can find the header data of the attachment.
More details can be found in this blog post on SCN: https://blogs.sap.com/2013/11/28/how-is-attachment-physically-stored-in-database-table-in-cm-framework/
- Update 2020/11/16: Regarding URL attachments (i.e. links), this blog post explains how to retrieve them: https://blogs.sap.com/2015/08/07/custom-fm-to-directly-get-the-attachment-url-value-from-sap-crm-web-ui/ They're stored as binary cluster data in table CRMURLCONT, so you have to go through the available FMs/methods to read/manipulate the data.