10-30-2015 7:49 AM
Hi expert,
Using this FM SCMS_AO_TABLE_GET, I can download PO attachment into local machine, My requirement is to attach these document without download into local, I want to send a mail with these files.
Thanks
Vimal Raj
10-30-2015 5:09 PM
Dear Vimal,
All atachments for PO is working using GOS service. So, you cna find in SRGBTBREL Table throw INSTID_A field the PO that correspond and then do something like this:
gs_lpor-instid = SRGBTBREL-instid.
gs_lpor-typeid = SRGBTBREL-typeid.
gs_lpor-catid = SRGBTBREL-catid.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = gs_lpor
it_relation_options = lt_relat
IMPORTING
et_links = t_links.
CLEAR gs_lpor.
LOOP AT t_links INTO s_links.
REFRESH: lt_object_content_l, lt_hex, lt_content.
CLEAR: lwa_document_data.
MOVE s_links-instid_b TO lv_document_id.
* Read the data
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_document_id
IMPORTING
document_data = lwa_document_data
TABLES
contents_hex = lt_hex
object_content = lt_content
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
IF sy-subrc = 0.
CLEAR lv_objdes.
lv_objdes = lwa_document_data-obj_descr.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = lwa_document_data-obj_type
i_attachment_subject = lv_objdes
i_att_content_text = lt_content
i_att_content_hex = lt_hex.
* add document to send request
CALL METHOD send_request->set_document( document ).
ENDIF.
ENDLOOP.
Regards.
10-31-2015 6:37 AM
11-06-2015 11:02 AM