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

Sending Multiple Attachment

Former Member
0 Likes
1,829

Hello Abapers,

I'm using FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail with multiple attachment.

Is it possible to display->

Some text_1

Attachment_1

Some text_2

attachment_2

Can anyone enlighten me?

thanks

5 REPLIES 5
Read only

SimoneMilesi
Active Contributor
0 Likes
1,433

For send multiple Attachments you need to use CL_BCS class

To learn more about it, give a look at example report from BCS_EXAMPLE_1 to BCS_EXAMPLE_5

With FM SO_NEW_DOCUMENT_ATT_SEND_API1 you cannot send more than 1 attachment each time

Read only

former_member194416
Contributor
0 Likes
1,433

Hi,

It is possible to send multiple attachments using SO_NEW_DOCUMENT_ATT_SEND_API1. All files will be in one internal table contents_bin and you need to specify the filelength for and name for each attachment in table packing_list. So the program will know which lines of contents for which file and it is easy to have filelength if you are uploading the files.

LOOP AT gt_attach INTO gs_attach.

*  describe table i_objbin lines v_lines_bin   .

    i_objpack-body_num   = gs_attach-count       .
    PERFORM get_file_ext_name USING gs_attach-path
                              CHANGING  i_objpack.
*Get file extension  and name
*  SPLIT gs_attach-path AT '.' INTO TABLE LT_SPLIT.
*  READ TABLE LT_SPLIT INTO LS_SPLIT INDEX 2.
*  TRANSLATE LS_SPLIT TO UPPER CASE.
*    i_objpack-doc_type   = LS_SPLIT              .
    i_objpack-obj_name   = lv_n                  .

*   i_objpack-obj_descr  = gs_attach-docname     .
    i_objpack-transf_bin = 'X'                   .
    i_objpack-doc_size   = gs_attach-filelength  .
    gv_filelength_all = gv_filelength_all + gs_attach-filelength.
    i_objpack-body_start = lv_n.
    lv_n = lv_n + gs_attach-count.
    IF gv_filelength_all > '5000000'.
      APPEND i_objpack TO i_objpack2.
    ELSE.
      APPEND i_objpack.
    ENDIF.
  ENDLOOP.

Edited by: Gungor Ozcelebi on May 7, 2010 3:17 PM

Read only

0 Likes
1,433

Hi ,

Can You Explain with full  Example For Two separate smartform in single mail

Regards

Saranya

Read only

Former Member
0 Likes
1,433

Hi,

You can use CL_BCS class to send emails with multiple attachments. Below URL of my article has code snippet of how it can be done. Hope it helps.

Cheers,

Ravikiran

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,433

Look at that wiki: [Sending Mails - Home Page|http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage]

Use CL_BCS examples (SO_* function modules are obsolete and complex to make them work if you're not an expert)