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: 

Can we create multiple Smartform attachments on one e-mail?

former_member1259992
Participant
0 Kudos
1,257

Hi All,

I have a requirement to attach two different Smartforms as two separate attachments on the same e-mail for external send. Combining the forms into one attachment will not solve the requirement.

Has anyone ever done this? Does anyone know how to?

Please be aware that I am quite new to Smartforms.

All suggestions appreciated.

Best Regards

Robin

1 ACCEPTED SOLUTION

FredericGirod
Active Contributor
0 Kudos
120

Hi Robin,

you have to create spool, transform this spool into PDF, and use the function module : SO_OBJECT_SEND to send the mail.

Rgd

Frédéric

5 REPLIES 5

FredericGirod
Active Contributor
0 Kudos
121

Hi Robin,

you have to create spool, transform this spool into PDF, and use the function module : SO_OBJECT_SEND to send the mail.

Rgd

Frédéric

0 Kudos
120

Thanks for the response Frederic, but wouldn't that generate a single PDF attachment? We need each form in it's own attachment, but on one mail.

Cheers

Robin

0 Kudos
120

You could send multiple files with the function SO_SEND_OBJECT.

Look the internal table PACKING_LIST, each lines will be a file name.

The file will be store in the internal table ATT_COND.

I send you a little part of a code to send one file. I think you will understand how to play with this function.

  move '/sap_interfaces/D27/pzr_00/data/test/logo100ans.jpeg'
       to v_file.
  open dataset v_file for input in binary mode.
  do.
    read dataset v_file into v_buff length v_length.
    v_total_length = v_length + v_total_length.
    move v_buff+0(v_length) to fic_attach-line+0(v_length).
    append fic_attach.
    if sy-subrc ne space.
      exit.
    endif.
  enddo.
  describe table fic_attach lines v_num.
  describe field fic_attach-line length v_len.
  move : 'Logo' to packing_list-objdes ,
         'Logo' to packing_list-objnam ,
         '1'    to packing_list-body_start ,
         'raw'  to packing_list-objtp ,
         'GIF'  to packing_list-file_ext .
*  packing_list-body_num = v_num - 1.
  packing_list-body_num = v_num.
*  packing_list-objlen   = ( v_num - 1 ) * v_len.
  packing_list-objlen   =  v_num * v_len.
*  packing_list-objlen   = v_total_length.
  append packing_list.


* Send mail.
  call function 'SO_OBJECT_SEND'
       exporting
           object_hd_change           = object_hd_change
           object_type                = 'RAW'
           owner                      = sy-uname
       tables
           objcont                    = itab_html
           objpara                    = objpara
           receivers                  = receivers
           packing_list               = packing_list
           att_cont                   = fic_attach
       exceptions
           others                     = 01.

Rgd

Frédéric

former_member187506
Contributor
0 Kudos
120

In our attempts to email smartforms we were unable to do much with the email interface on the smartforms, other than email a single form.

Our solution has been to call the smartform not as email but as otf.

We then convert the otf and to pdf and attach what we need to the message and send using SO_NEW_DOCUMENT_ATT_SEND_API1.

Search the forum for the fm or check the fm documentation for sample code.

former_member1259992
Participant
0 Kudos
120

Thanks for the ideas all.

I think you've confirmed my understanding that because the driver is the document we are in effect attaching the e-mail to the document, and cannot therefore attach further documents to the same mail.

Unless someone else knows different...............