Application Development 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: 

Send E-mails with attached MIME objects and PDF files together

tanju_lise3
Participant
0 Kudos

Hello All,

I am sending e-mails with attached MIME objects ...

My problem is attaching another object like a PDF files ...

How can I do it ?

Is there any example ?

I am attaching my codes.

Please check it ...

Regards,

Tanju

1 ACCEPTED SOLUTION

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

I am not sure if this is what you want but have a look here:

The program also sends a smart form as attachment.

Regards.

16 REPLIES 16

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

I am not sure if this is what you want but have a look here:

The program also sends a smart form as attachment.

Regards.

0 Kudos

Hi Eitan,

Thank you for your response .

Nice working and very helpfull..

You are saying 'the programs alsıo send................... as attachment ' . Right ?

I mean, in my code I have smartforms and I created that pdf file.

So I want to attached it

Before, my old code I have a using function.'SO_DOCUMENT_SEND_API' and attache it.

In your code is it same logic ?

Or is there any difference ?

Regards

Tanju

0 Kudos

Hi,

The code is attached to the article look at the bottom there

http://scn.sap.com/servlet/JiveServlet/download/38-338104/Y_R_EITAN_TEST_10_06.txt.zip

The program use cl_bcs.

Regards.

0 Kudos

I appreciated Eitan,

I am changing my code ...

Regards and Greetins

Tanju

0 Kudos

Hi,

Thanks and have fun

Regards.

0 Kudos

Dear Eitan,

Well, I hope you will remember me ...

Your answer realy helpfull.

I have another question about this subject.

I want to know your recommendation ...

I am sending my mails one by one user.

But we want to send our mails multi  users...

So, How should I thought  ?

Regards

0 Kudos

Hi,

If you want to send the same content delivered to multiple recipients :

you can use:

CALL METHOD ob_bcs->add_recipient

    EXPORTING

      i_recipient = ob_cam_address_bcs.

     

As you can see you can use the I_BLIND_COPY parameter.

You can also use SAP distribution lists or Send a mail to Microsoft exchange distribution list.

Regards .

0 Kudos

Hi Eitan,

I need a recommendation, so I want to ask you ...

My boss says, OK, we are sending an e-mail ...

But we need also 'RECEIVED' message

So, I am checking sdn . But I did not find something ...

What do you recommend to me ?

Thank You

Regards

Tanju

0 Kudos

Hi,

Sorry no idea....

Regards,

0 Kudos

Hi Eitan,

Lets think of multiple recipients ...

My code like that ;

ob_cam_address_bcs = cl_cam_adress_bcs=>create_internte_addresss( p_mail1)

Call method ab_bcs -> add_recipient

  exporting

   i_recipint = ob_cam_address_bcs.

Think of p_mail1, p_mail2, ..............p_mailn. (I am founding the code.)

I am sending mails one by one ...

We want to send delivered all mails at the sametime .

How can I send it ?

Well, ob_cam_adress_bcs can be wrong,, because  I can not write p_mail1, p_mail2, p-mail3 ... p_mailn .

Regards

Tanju

0 Kudos

Hi,

From syntax point of view.

you need a separate call for each mail address.

ob_cam_address_bcs = cl_cam_adress_bcs=>create_internte_addresss( p_mail1)

Call method ab_bcs -> add_recipient

  exporting

   i_recipint = ob_cam_address_bcs.

  

ob_cam_address_bcs = cl_cam_adress_bcs=>create_internte_addresss( p_mail2)

Call method ab_bcs -> add_recipient

  exporting

   i_recipint = ob_cam_address_bcs.  

  

and so on.  

 

Regards.

0 Kudos

Hi,

Well, Actually I did it and sent it one by one like your says ...

But When I said how can it run to my boss, He said that, No, iti is not, He did not accept

Try it send it all of them .

I mean think of

'TO' : p_mail1, p_mail2, p_mail3 ....

When he check mail, he want to see all mail ids ...

Is it clear ?

Regards

0 Kudos

Hi,

On screen create a long text field (p_mails).

Fill p_mails with (p_mail1, p_mail2,...p_mailn) separated with your delimiter .

Split p_mails into internal table at the comma .

see split command http://help.sap.com/abapdocu_740/en/abapsplit_shortref.htm

loop on the table and for each entry apply:

ob_cam_address_bcs = cl_cam_adress_bcs=>create_internte_addresss( <table entry>)

Call method ab_bcs -> add_recipient

  exporting

   i_recipint = ob_cam_address_bcs.

 

Regards .

0 Kudos

Some code

Code fragment:

CALL METHOD cl_bcs_convert=>string_to_soli
     EXPORTING
       iv_string = my_string
     RECEIVING
       et_soli   = it_soli.

   DATA: ob_document_bcs TYPE REF TO cl_document_bcs.

   CALL METHOD cl_document_bcs=>create_document
     EXPORTING
       i_type    = 'HTM'
       i_subject = sos33-objdes
       i_text    = it_soli
     RECEIVING
       result    = ob_document_bcs.

   DATA: ob_bcs TYPE        REF TO cl_bcs.
   DATA: ob_cam_address_bcs TYPE REF TO cl_cam_address_bcs .

   ob_bcs = cl_bcs=>create_persistent( ).

   CALL METHOD ob_bcs->set_document( ob_document_bcs ).

   ob_cam_address_bcs = cl_cam_address_bcs=>create_internet_address( sos04-s_snd_nam ).

   CALL METHOD ob_bcs->set_sender
     EXPORTING
       i_sender = ob_cam_address_bcs.

   DATA: it_adr_name TYPE TABLE OF sos04-l_adr_name .

   SPLIT sos04-l_adr_name AT space INTO TABLE it_adr_name .

   FIELD-SYMBOLS: <st_adr_name> LIKE LINE OF it_adr_name .

   DATA: i_copy TYPE abap_bool .

   LOOP AT it_adr_name ASSIGNING <st_adr_name> .

     ob_cam_address_bcs = cl_cam_address_bcs=>create_internet_address( <st_adr_name> ).

     CALL METHOD ob_bcs->add_recipient
       EXPORTING
         i_copy      = i_copy
         i_recipient = ob_cam_address_bcs.

     i_copy  = abap_true .

   ENDLOOP.

   DATA: result TYPE abap_bool .

   CALL METHOD ob_bcs->send
     EXPORTING
       i_with_error_screen = abap_true
     RECEIVING
       result              = result.

   IF result EQ abap_true.
     MESSAGE s004(bcs_medium) WITH sos04-l_adr_name .
   ENDIF.

   COMMIT WORK .


Result in outlook



Regards.

0 Kudos

Thank You very much Eitan.

I am really appreciate ...

Regards

0 Kudos

Dear Eitan,

If you have a time would you like to please check this incident ,

http://scn.sap.com/thread/3822876

Thank You

Tanju