on 09-09-2015 7:34 PM
Hi guys,
Lets say got a PO with 2 attachment files one,
I need to send just one of those 2 in a mail (it will be chosen by the attachment title).
Now the output message its sending both files, how can I pick the files in runtime?
Its there any badi or exit I can use?
Thanks!
Nico.-
No, it's not possible. Please refer the SAP note 457497.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for you answer Rosh,
I cenrtanlly cannot be done using the standard but I managed to do it using some ABAP code.
In case somebody else face this problem, here is the solution.
In a custom print program do this:
1st get the archive id of the file using: FM ARCHIV_GET_CONNECTIONS
2nd get the files in a binary table format with FM SCMS_AO_TABLE_GET
3rd Then use what SCMS_AO_TABLE_GET returns to call FM SCMS_XSTRING_TO_BINARY
HERE IS THE TRICK FOR XLSX, DOCX and any other 4char extention:
4th Create the document using Method CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = ‘BIN’
i_subject = put here the name file along with the extension
i_length = from FM 'SCMS_BINARY_TO_XSTRING'
i_hex = from FM 'SCMS_XSTRING_TO_BINARY'
RECEIVING
result = o_document_attach.
Then append the resulting object to the mail
CALL METHOD o_document->add_document_as_attachment
EXPORTING
im_document = o_document_attach.
Hope this help somebody.
Hi Vimal
This is what you need to do in steps 3 and foward:
CALL FUNCTION 'SCMS_AO_TABLE_GET'
EXPORTING
mandt = sy-mandt
arc_id = <connect>-archiv_id
doc_id = <connect>-arc_doc_id
IMPORTING
length = l_v_length
TABLES
data = l_i_data
EXCEPTIONS
error_http = 1
error_archiv = 2
error_kernel = 3
error_config = 4
OTHERS = 5.
IF sy-subrc EQ 0.
*Cast from binary to xstring
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = l_v_length
IMPORTING
buffer = l_v_xstring
TABLES
binary_tab = l_i_data
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc EQ 0.
REFRESH i_objbin1[].
CLEAR v_num.
*Cast from xstring to binary into a object format
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_v_xstring
TABLES
binary_tab = i_objbin1.
After that,do this:
Note:o_document_attach its TYPE REF TO cl_document_bcs
TRY.
v_doc_size = l_v_length.
CLEAR o_document_attach.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'BIN'
i_subject = l_v_subject <----- Document name with the extention,doc, docx, txt...
i_length = v_doc_size
i_hex = i_objbin1
RECEIVING
result = o_document_attach.
CATCH cx_bcs INTO o_bcs_exception.
ENDTRY.
CALL METHOD o_document->add_document_as_attachment
EXPORTING
im_document = o_document_attach.
Hope this helps.
Regards,
Nico.-
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.