Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

send files as attachment with BCS-methods

andreas_mann3
Active Contributor
0 Likes
825

Hi,

I want to load file(s) from application server

and send it as attachment per mail.

In 4.6c I had a program with fm 'SO_DOCUMENT_SEND_API1'

that worked fine. But not any longer in 7.01.

So i tried it with the new method of BCS*

But it worked not fully correct.

German mutations are not correct.

and e.g. in excel ther is a message "too many columns" although there're only 130 col.

In 4.6 I opend the data file(s) in binary mode and saved it to solix

Which addition I must choose to the open-command?

And what I have to note by the converting method cl_bcs_convert=>string_to_solix?

Do you know a sample program to my problem ?

In BCS_EXAMPLE* I did not found anyone

thanks

Andreas

Edited by: Andreas Mann on Oct 25, 2011 4:22 PM

Hi,

I want to load file(s) from application server

and send it as attachment per mail.

In 4.6c I had a program with fm 'SO_DOCUMENT_SEND_API1'

that worked fine. But not any longer in 7.01.

So i tried it with the new method of BCS*

But it worked not fully correct.

German mutations are not correct.

and e.g. in excel ther is a message "too many columns" although there're only 130 col.

In 4.6 I opend the data file(s) in binary mode and saved it to solix

Which addition I must choose to the open-command?

And what I have to note by the converting method cl_bcs_convert=>string_to_solix?

Do you know a sample program to my problem ?

In BCS_EXAMPLE* I did not found anyone

thanks

Andreas

Edited by: Andreas Mann on Oct 25, 2011 4:22 PM

2 REPLIES 2
Read only

surajarafath
Contributor
0 Likes
571

I do have sample code

sending email with attachment using BCS,

i can only post it by thursday,

currently refer this.. i will post sample code later

DATA lt_message TYPE bcsy_text.
DATA lv_mail_title TYPE so_obj_des.
DATA document TYPE REF TO cl_document_bcs.
DATA recipient TYPE REF TO if_recipient_bcs.
DATA send_request TYPE REF TO cl_bcs.
DATA sent_to_all TYPE os_boolean.
DATA bcs_execption TYPE REF TO cx_bcs.
DATA email_id TYPE ADR6-SMTP_ADDR
send_request = cl_bcs=>create_persistent( ).
*Create Title
CONCATENATE 'Mail Subject' '-' 'xxx'
INTO lv_mail_title RESPECTING BLANKS.
*Create Message(EMAIL Body)
APPEND '<p>Dear Sir/Madam</p>' TO lt_message.
APPEND '<p>The Message body.......</p>' TO lt_message.
APPEND '<br>' TO lt_message.
*Create Document
document = cl_document_bcs=>create_document(
     i_type = 'HTM'
     i_text =  message_body
     i_subject = subject ).
*Add Attachement
document->add_attachment(..
...). "Check this method 
*Add document to email
send_request->set_document( document ).

recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = email_id ).
*add recipients to send request
send_request->add_recipient( i_recipient = recipient ).
sent_to_all = send_request->send(
i_with_error_screen = 'X' ).
COMMIT WORK.
IF sent_to_all = 'X'.
MESSAGE s398(00) WITH 'Message Sent Succesfully'.
RETURN.
ENDIF.

thanks & regards,

suji

Read only

Subhankar
Active Contributor
0 Likes
571

Hi,

Please check the below link..

[send mail attachment|http://wiki.sdn.sap.com/wiki/display/Snippets/SendingmailwithattachmentusingObjectOriented+Approach]