2007 Jun 05 12:27 PM
I am pasting a part of the code which I am working on now...
This is related to sending an e-mail using class CL_BCS.. I am trying to send an e-mail with more than 50 characters in it.
The e-mail is already working, i get an e-mail immediately but with a shortened subject line.....
I know that the problem is with the bolded part.. when i went into the debugger mode i see that it compares the subject line which is passed on to the i_subject.
Now please tell me how to link the created object Document with the method set_message_subject...
Points are guaranteed.........
try.
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
-------- create and set document with attachment ---------------
create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = i_subject ).
<b>
*subject line more than 50 chars
data: t_sub type string.
t_sub = 'This is too ridiculous but lets just test this whether this will work out for more than 50 chars'.
CALL METHOD send_request->set_message_subject
EXPORTING
ip_subject = t_sub.
</b>
*changing the content of the attachment
binary_content[] = l_iobjbin[].
*change the name of the PDF attachment
concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
into i_att_sub separated by space.
add attachment to document
CALL METHOD document->add_attachment
EXPORTING i_attachment_type = 'PDF'
i_attachment_subject = i_att_sub
i_att_content_hex = binary_content.
add document to send request
CALL METHOD send_request->set_document( document ).
I am pasting a part of the code which I am working on now...
This is related to sending an e-mail using class CL_BCS.. I am trying to send an e-mail with more than 50 characters in it.
The e-mail is already working, i get an e-mail immediately but with a shortened subject line.....
I know that the problem is with the bolded part.. when i went into the debugger mode i see that it compares the subject line which is passed on to the i_subject.
Now please tell me how to link the created object Document with the method set_message_subject...
Points are guaranteed.........
try.
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
-------- create and set document with attachment ---------------
create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = i_subject ).
<b>
*subject line more than 50 chars
data: t_sub type string.
t_sub = 'This is too ridiculous but lets just test this whether this will work out for more than 50 chars'.
CALL METHOD send_request->set_message_subject
EXPORTING
ip_subject = t_sub.
</b>
*changing the content of the attachment
binary_content[] = l_iobjbin[].
*change the name of the PDF attachment
concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
into i_att_sub separated by space.
add attachment to document
CALL METHOD document->add_attachment
EXPORTING i_attachment_type = 'PDF'
i_attachment_subject = i_att_sub
i_att_content_hex = binary_content.
add document to send request
CALL METHOD send_request->set_document( document ).
2007 Jun 05 1:07 PM
the code is right , you just need to call the following code
data: t_sub type string.
t_sub = 'This is too ridiculous but lets just test this whether this will work out for more than 50 chars'.
CALL METHOD send_request->set_message_subject
EXPORTING
ip_subject = t_sub.
just before
CALL METHOD send_request->set_document( document ).
and blank out the subject iin
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = i_subject ).
however though the subj parameter is of type string there is a limitation. it will only pass 255 characters
2007 Jun 05 1:16 PM
hi Raja
I have tried just like that now, i have made the i_subject blank and executed the program, but now i dont get any subject line in my e-mail...
Please help
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
clear i_subject.
-------- create and set document with attachment ---------------
create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = '' ).
*changing the content of the attachment
binary_content[] = l_iobjbin[].
*change the name of the PDF attachment
concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
into i_att_sub separated by space.
add attachment to document
CALL METHOD document->add_attachment
EXPORTING i_attachment_type = 'PDF'
i_attachment_subject = i_att_sub
i_att_content_hex = binary_content.
*subject line more than 50 chars
t_sub = '[ D01 TEST] CCS0000096 NJ 8A7192 21 CONSTITUTION AVE'.
CALL METHOD send_request->set_message_subject
EXPORTING
ip_subject = t_sub.
add document to send request
CALL METHOD send_request->set_document( document ).
2007 Jun 05 1:21 PM
i use similar code and it works
data: send_request type ref to cl_bcs.
clear document .
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = text
i_length = conlengths
i_subject = '' ).
*TRY.
data: sub type string .
sub = '12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
call method send_request->set_message_subject
exporting
ip_subject = sub .
* CATCH CX_SEND_REQ_BCS .
*ENDTRY.
2007 Jun 05 1:30 PM
Hi raja
I am not able to get this subject line.. can you post the whole part of the code if you have it
Are there any settings I need to do ??
2007 Jun 05 1:33 PM
here is the code relevant for email
try.
clear send_request .
send_request = cl_bcs=>create_persistent( ).
clear document .
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = text
i_length = conlengths
i_subject = '' ).
call method document->add_attachment
exporting
i_attachment_type = 'XLS'
i_attachment_subject = atta_sub
i_att_content_hex = binary_content.
* add document to send request
*TRY.
data: sub type string .
sub = '12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
call method send_request->set_message_subject
exporting
ip_subject = sub .
* CATCH CX_SEND_REQ_BCS .
*ENDTRY.
call method send_request->set_document( document ).
clear sender .
sender = cl_cam_address_bcs=>create_internet_address( sender_id ).
call method send_request->set_sender
exporting
i_sender = sender.
clear wa_rec .
loop at recepients into wa_rec .
clear recipient .
recipient = cl_cam_address_bcs=>create_internet_address(
wa_rec ).
* add recipient with its respective attributes to send request
call method send_request->add_recipient
exporting
i_recipient = recipient
i_express = 'X'.
endloop .
call method send_request->set_status_attributes
exporting
i_requested_status = 'E'
i_status_mail = 'E'.
call method send_request->set_send_immediately( 'X' ).
* ---------- send document ---------------------------------------
call method send_request->send(
exporting
i_with_error_screen = 'X'
receiving
result = sent_to_all ).
if sent_to_all = 'X'.
append 'Mail sent successfully ' to return .
endif.
commit work.
catch cx_bcs into bcs_exception.
bcs_message = bcs_exception->get_text( ).
append bcs_message to return .
exit.
endtry.
endif .
else .
append 'Specify email address for sending' to return .
endif .
2007 Jun 05 1:42 PM
hi raja
Actually i thought there must be a problem with my program and then i replicated the standard program BCS_EXAMPLE_1 to a Z program
still the mail comes without subject line........
Is it something goto do with the format type or length
FORM MAIN.
TRY.
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
-------- create and set document -------------------------------
create document from internal table with text
APPEND 'Hello world!' TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = '' ).
add document to send request
*TRY.
data: sub type string .
sub = '12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
call method send_request->set_message_subject
exporting
ip_subject = sub .
add document to send request
CALL METHOD send_request->set_document( document ).
--------- set sender -------------------------------------------
note: this is necessary only if you want to set the sender
different from actual user (SY-UNAME). Otherwise sender is
set automatically with actual user.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
--------- add recipient (e-mail address) -----------------------
create recipient - please replace e-mail address !!!
recipient = cl_cam_address_bcs=>create_internet_address(
'[email protected]' ).
add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
CALL METHOD send_request->set_send_immediately( 'X' ).
---------- send document ---------------------------------------
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = 'X'.
WRITE text-003.
ENDIF.
COMMIT WORK.
ENDFORM.
2013 Jan 02 12:30 PM
Hi Durairaj Athavan Raja... iam facing one problem 'user wants email attachment name more than 50 chars but in add_attchmnet method call method document->add_attachment exporting i_attachment_type = 'XLS' i_attachment_subject = atta_sub i_att_content_hex = binary_content. the parameter i_attachment_subject is limited to 50 chars. how to solve this pbm? can any one provide solution for this? regards Karthik
2007 Jun 11 11:12 AM
I found the solution for this
We need to change the configuration settings in SCOT
Set SMTP node to node in use, goto Internet settings and then say '*' in the address area
This will do the work....
2010 Apr 19 1:21 AM
Hi,
I have used this example to send email BCS_EXAMPLE_1 it worked fine, but I am receiving email with Importance: High I tried to set the parameter i_importance of the method create_document of class cl_document_bcs with different values from 1 to 9. I can not stop the Importance: High with email.
I know your issue is solved. If you have an idea of this please let me know.
Thank you,
Surya
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |