‎2007 Jun 12 6:12 AM
Hi,
I am using the method add_attachment, to add attachments to my Email.
The mail is being triggered successfully with the attachments, but with the following problems:
a. The attachment is being populated with incomplete data.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = file_type
i_attachment_subject = attach_name1
i_att_content_text = it_attach[].
Although it_attach[] has all the data in it, the data in the attachment is incomplete.
Is there a limit on the attachment size? How can this be increased.
b. There is a space after every character in the attachment data. How can this be corrected?
Thanks,
Smitha.
‎2007 Jun 12 1:30 PM
Hi Smitha,
Can you please give more information on the type of data in it_attach[] and how you are populating this internal table. Does the table contain an ABAP List, simple text or other data?
‎2007 Jun 12 6:20 AM
‎2007 Jun 12 6:36 AM
‎2007 Jun 12 6:42 AM
Sudheer,aRs,
Thanks for the replies.
Will check the SCOT transaction and revert.
Regards,
Smitha.
Message was edited by:
Smitha Rao
‎2007 Jun 12 12:57 PM
Hi,
The configurations mentioned in the links above, have already been made in the SCOT transaction.
I am still facing the same issues.
Any ideas?
Thanks,
Smitha.
‎2007 Jun 12 1:01 PM
Hi,
Check the following link:
http://www.sap-img.com/abap/sending-email-with-attachment.htm
Regards,
Bhaskar
‎2007 Jun 12 1:02 PM
can you try converting the it_attach to binary and then pass it to i_att_content_hex to see whether you still have that problem?
‎2007 Jun 12 1:43 PM
Hi Durairaj,
I am new to ABAP. Could you please let me know how this can be done?
How do I convert text to binary before assigning it to i_att_content_hex?
Thanks,
Smitha.
‎2007 Jun 12 1:30 PM
Hi Smitha,
Can you please give more information on the type of data in it_attach[] and how you are populating this internal table. Does the table contain an ABAP List, simple text or other data?
‎2007 Jun 12 1:34 PM
Hi Surbjeet,
The data in the it_attach[] is simple text.
This table is one of the import parameters.
Thanks,
Smitha.
‎2007 Jun 12 1:48 PM
data: text type bcsy_text.
data: xtext type standard table of solix .
call function 'SO_SOLITAB_TO_SOLIXTAB'
exporting
ip_solitab = text
importing
ep_solixtab = xtext .
call method document->add_attachment
exporting
i_attachment_type = 'htm'
i_attachment_subject = atta_sub
i_att_content_hex = xtext.
Raja
‎2007 Jun 12 1:51 PM
‎2007 Jun 13 6:20 AM
Thanks Raja,
I get the complete content in the attachments now.
But the data in the attachment is not formatted correctly.
For example, "valid data" in the attachment looks like "v a l i d d a t a".
Any clues on this?
Thanks,
Smitha.
‎2007 Jun 13 6:55 AM
can you post your complete code, we can then check whats going wrong
‎2007 Jun 13 7:25 AM
Below is the code:
FUNCTION Z_XI_SEND_MAIL_ATT_DYN_EMAILID.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(SUBJECT) TYPE SO_OBJ_DES OPTIONAL
*" VALUE(ATTACH_NAME1) TYPE SOOD-OBJDES OPTIONAL
*" VALUE(FILE_TYPE) TYPE SOODK-OBJTP OPTIONAL
*" VALUE(ATTACH_NAME2) TYPE SOOD-OBJDES OPTIONAL
*" TABLES
*" IT_CONTENT TYPE SOLI_TAB OPTIONAL
*" IT_ATTACH TYPE SOLI_TAB OPTIONAL
*" IT_ATTACH1 TYPE SOLI_TAB OPTIONAL
*" IT_EMAILID TYPE SOLI_TAB OPTIONAL
*"----------------------------------------------------------------------
DATA: send_request TYPE REF TO cl_bcs.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: exception_info TYPE REF TO if_os_exception_info,
bcs_exception TYPE REF TO cx_document_bcs.
DATA i_attachment_size TYPE sood-objlen.
DATA it_recv LIKE zmailmap OCCURS 0 WITH HEADER LINE.
DATA ext(3).
DATA: it_attach_hex type standard table of solix .
DATA: it_attach1_hex type standard table of solix .
* Create persistent send request
send_request = cl_bcs=>create_persistent( ).
TRY.
document = cl_document_bcs=>create_document(
i_type = 'txt'
i_text = it_content[]
i_subject = subject ).
DESCRIBE TABLE it_attach.
SPLIT attach_name1 AT '.' INTO attach_name1 ext.
**************** Convert text to binary***********************
call function 'SO_SOLITAB_TO_SOLIXTAB'
exporting
ip_solitab = it_attach[]
importing
ep_solixtab = it_attach_hex[].
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = file_type
i_attachment_subject = attach_name1
i_att_content_hex = it_attach_hex[].
****Additional code for QRN Interface*****
IF file_type = 'QRN'.
SPLIT attach_name2 AT '.' INTO attach_name2 ext.
DESCRIBE TABLE it_attach1.
*********Convert text to binary***************
call function 'SO_SOLITAB_TO_SOLIXTAB'
exporting
ip_solitab = it_attach1[]
importing
ep_solixtab = it_attach1_hex[].
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'QTX'
i_attachment_subject = attach_name2
i_att_content_hex = it_attach1_hex[].
ENDIF.
*********************************************
* Add document to send request
CALL METHOD send_request->set_document( document ).
* Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
* Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
********Determine the receipients (Extra code added for QRN interface - 31st May 2007)************
****Add Reciepents
IF file_type = 'QRN'.
LOOP AT IT_EMAILID.
it_recv-MAILID = IT_EMAILID.
APPEND it_recv.
CLEAR it_recv.
ENDLOOP.
**it_recv-mailid = IT_EMAILID.
**APPEND it_recv.
ELSE.
SELECT * FROM zmailmap INTO TABLE it_recv WHERE filetype = file_type.
ENDIF.
LOOP AT it_recv.
TRANSLATE it_recv-mailid TO LOWER CASE.
recipient = cl_cam_address_bcs=>create_internet_address(
it_recv-mailid ).
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'U'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '.
ENDLOOP.
***********Trigger e-mails immediately*****************************
send_request->set_send_immediately( 'X' ).
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_document_bcs INTO bcs_exception.
ENDTRY.
ENDFUNCTION.
‎2007 Jun 13 7:38 AM
HI SMITHA RAO,
I am also having the same requirement like to send mail with attachment.
I dont have idea to configure the SCOT.
I f u dont mine can u send me ur code pls.
Its users urgent requirement.But no one is helping me.
I am facing lot of problems to complete that requirement.
My mail id is
goudjayasankar@yahoo.co.in
Madam,Pls help me.
I dont know how to configure the SCOT also.Pls tell me that one also.Here in my company even basis people they dont have idea to configure the SCOT. they were asking me to tell how to configure the SCOT.
At least pls send ur code .
Pls help me.
Thanks & Regards,
LOkesh.
‎2007 Jun 13 7:41 AM
HI SMITHA RAO,
I am also having the same requirement like to send mail with attachment.
I dont have idea to configure the SCOT.
I f u dont mine can u send me ur code pls.
Its users urgent requirement.But no one is helping me.
I am facing lot of problems to complete that requirement.
My mail id is
goudjayasankar@yahoo.co.in
Madam,Pls help me.
I dont know how to configure the SCOT also.Pls tell me that one also.Here in my company even basis people they dont have idea to configure the SCOT. they were asking me to tell how to configure the SCOT.
At least pls send ur code .
Pls help me.
Thanks & Regards,
LOkesh.
‎2007 Jun 13 12:27 PM
Hi,
Thanks all. The problem has been resolved.
1. The data had to be converted to hex before adding the attachment to the document.
2. The file type had to be 'RAW' .
Lokesh,
The code has already been posted above.
To configure SCOT, follow the links provided by Sudheer and aRs.
Thanks,
Smitha.