I have a requirement to create attachments via RFC so they are attached to a quality notification.
I am going to use:
CALL METHOD cl_binary_relation=>create_link
EXPORTING
is_object_a = ls_object_a
is_object_b = ls_object_b
ip_reltype = 'ATTA'.
* wa_folder_content-doc_id = im_instid_b.
CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
EXPORTING
document_id = wa_folder_content-doc_id
IMPORTING
document_data = folder_content
TABLES
contents_hex = contents_hex
object_header = object_header
object_content = object_content
* attachment_list = attachment_list
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
DESCRIBE TABLE contents_hex LINES lin.
input_length = lin * sy-tleng.
ENDIF.
I require IS_OBJECT_B which is also the document_id I pass to the document insert.
Now normally I could retrieve the instid_b using SRGBTBREL. This works for notifications that ALREADY HAVE ATTACHMENTS.
How do I find the instid_b link when there are no attachments? There must be a process to determine the document_id I require for so_document_insert_api1
Hopefully this makes sense.. if not please ask.