01-22-2008 4:18 AM
Hi,
I'm using the SO_NEW_DOCUMENT_ATT_SEND_API1 to send an email message with an attachment. The attachment filename is limited in 12 characters. Is there any alternative to have a longer filename??
Regards,
Kit
01-22-2008 4:29 AM
HI ,
Please go through this link it was given clear with Expalination .
[http://www.thespot4sap.com/Articles/SAP_Mail_Example_ABAP.asp]
Reward Points if it is usefull ...
Girish
01-22-2008 5:05 AM
01-22-2008 5:57 AM
HI,
Use this class this will solve your problem.
FORM send_mail TABLES p_it_error_records LIKE it_error_records p_it_parked_documents
LIKE it_success_records p_text TYPE string.
DATA: send_request TYPE REF TO cl_bcs,
att_text TYPE bcsy_text, "#EC NEEDED
document TYPE REF TO cl_document_bcs, "#EC NEEDED
sender TYPE REF TO cl_sapuser_bcs, "#EC NEEDED
recipient TYPE REF TO if_recipient_bcs,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
v_str(255) TYPE c,
wa_receivers TYPE adr6,
wa_text TYPE bcsy_text,
v_subject TYPE so_obj_des.
DATA:it_receivers TYPE TABLE OF adr6.
wa_receivers-smtp_addr = text-020.
APPEND wa_receivers TO it_receivers.
CLEAR wa_receivers.
wa_receivers-smtp_addr = text-021.
APPEND wa_receivers TO it_receivers.
CLEAR:wa_receivers,
wa_bdcmsgcoll.
wa_receivers-smtp_addr = text-022.
APPEND wa_receivers TO it_receivers.
CLEAR wa_receivers.
CONCATENATE text-004 sy-datum INTO v_subject SEPARATED BY space.
TRY.
----
send_request = cl_bcs=>create_persistent( ).
----
create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = wa_text
i_length = '60'
i_subject = v_subject ).
--
REFRESH wa_text.
CONCATENATE p_count p_text INTO v_str.
APPEND v_str TO wa_text.
LOOP AT p_it_parked_documents INTO wa_bdcmsgcoll1 . " For Success Records
AT FIRST.
MOVE text-016 TO v_str.
APPEND v_str TO wa_text.
CLEAR v_str.
ENDAT.
CONCATENATE wa_bdcmsgcoll1-msgv3 wa_bdcmsgcoll1-msgtyp wa_bdcmsgcoll1-msgnr
wa_bdcmsgcoll1-msgv2 wa_bdcmsgcoll1-msgv1 text-014 INTO v_str SEPARATED BY space.
APPEND v_str TO wa_text.
clear v_str.
ENDLOOP.
LOOP AT p_it_error_records INTO wa_bdcmsgcoll1 . "For Error Records
AT FIRST.
MOVE text-015 TO v_str.
APPEND v_str TO wa_text.
clear v_str.
ENDAT.
CONCATENATE wa_bdcmsgcoll1-msgv3 wa_bdcmsgcoll1-msgtyp wa_bdcmsgcoll1-msgnr wa_bdcmsgcoll1-msgv2
wa_bdcmsgcoll1-msgv1 wa_bdcmsgcoll1-msgv4 INTO v_str SEPARATED BY space.
APPEND v_str TO wa_text.
clear v_str.
ENDLOOP.
CALL METHOD document->add_attachment "Adding Attachment
EXPORTING
i_attachment_type = 'RAW'
i_attachment_subject = v_subject
i_attachment_size = '60'
i_att_content_text = wa_text.
add document to send request
CALL METHOD send_request->set_document( document ).
LOOP AT it_receivers INTO wa_receivers . "Recievers SMTP address
recipient =
cl_cam_address_bcs=>create_internet_address( wa_receivers-smtp_addr ).
----
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
----
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = 'X'.
MESSAGE s053(ZFI). " Document Sent Successfully
ENDIF.
COMMIT WORK.
-----------------------------------------------------------
* exception handling
-----------------------------------------------------------
-----------------------------------------------------------
CATCH cx_bcs INTO bcs_exception. " Exception while sending mail
WRITE: text-009 , bcs_exception->error_type.
EXIT.
ENDTRY.
ENDFORM. "seding_mail
01-22-2008 6:01 AM
Hi Rakesh,
I'm using the 4.6c and those classes are not available.
Regards,
Kit
01-24-2008 6:36 AM
Hi experts.
Any other FM can send email attachment which has a filename longer than 12 chars in 4.6c?
Regards,
Kit