Hi friends,
I will write my question in 2 posts due to the length limitation.
In my program i create different attachments like this:
CONCATENATE 'UPC' ordendpago INTO is_object-objkey
SEPARATED BY space.
* Indicamos el tipo de objeto URL
is_object-objtype = 'FMPSO'.
rel_doc-objkey = document_id.
rel_doc-objtype = 'MESSAGE'.
* Creamos la relación entre la op y el objeto enlazado
CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
EXPORTING
obj_rolea = is_object
obj_roleb = rel_doc
relationtype = 'URL'
EXCEPTIONS
no_model = 1
internal_error = 2
unknown = 3
OTHERS = 4.