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.
Showing results for 
Search instead for 
Did you mean: 

Enviar mail a travu00E9s de ABAP IV

Former Member
0 Kudos

Deseo enviar un mail desde un programa con la siguiente particularidad:

*Si quien recibe el mail deseara responder en lugar de la dirección de envio salga otra.

La función


tiene un parámetro que se llama MAILREC y allí hay un campo llamado REP_REC que pareciera que cubre esa funcionalidad pero a la hora de probar no lo hace.

¿Alquien sabe cómo hacerlo?



Former Member
0 Kudos

Any change that you can write this in English, please?

0 Kudos

here you go Ravi..


I want to send a mail from a program with the following peculiarity:

*yes the one who receives the mail will want to answer instead of the direction of mailing that it should go out different.

The function


it has a parameter that is called MAILREC and there, there is a called field REP_REC that seemed that it covers this functionality but at the time of trying it does not do it.

Does Any one know how to do it?



Now go for it & remember to reply in SPANISH..


Suresh Datti

P.S. Hey I live in Florida now..

Former Member
0 Kudos


SO_NEW_DOCUMENT_ATT_SEND_API1 is used to send a mail.

If you want to send a mail to external mail id:

*& Report  ZSENDEMAIL                                                  *
*&                                                                     *
*& Example of sending external email via SAPCONNECT                    *
*&                                                                     *
REPORT  zsendemail                    .

PARAMETERS: psubject(40) type c default  'Testing',
            p_email(40)   type c default ''.

data:   it_packing_list like sopcklsti1 occurs 0 with header line,
        it_contents like solisti1 occurs 0 with header line,
        it_receivers like somlreci1 occurs 0 with header line,
        it_attachment like solisti1 occurs 0 with header line,
        gd_cnt type i,
        gd_sent_all(1) type c,
        gd_doc_data like sodocchgi1,
        gd_error type sy-subrc.

data:   it_message type standard table of SOLISTI1 initial size 0
                with header line.


Perform populate_message_table.

*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.

*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.

*       Adds text to email text table
form populate_message_table.
  Append 'Line1' to it_message.
  Append 'Line2' to it_message.
  Append 'Line3' to it_message.
  Append 'Test- 1' to it_message.
endform.                    " POPULATE_MESSAGE_TABLE

*       Send email message
form send_email_message.
* Fill the document data.
  gd_doc_data-doc_size = 1.

* Populate the subject/generic message attributes
  gd_doc_data-obj_langu = sy-langu.
  gd_doc_data-obj_name  = 'SAPRPT'.
  gd_doc_data-obj_descr = psubject.
  gd_doc_data-sensitivty = 'F'.

* Describe the body of the message
* Information about structure of data tables
  clear it_packing_list.
  refresh it_packing_list.
  it_packing_list-transf_bin = space.
  it_packing_list-head_start = 1.
  it_packing_list-head_num = 0.
  it_packing_list-body_start = 1.
  describe table it_message lines it_packing_list-body_num.
  it_packing_list-doc_type = 'RAW'.
  append it_packing_list.

* Add the recipients email address
  clear it_receivers.
  refresh it_receivers.
  it_receivers-receiver = p_email.
  it_receivers-rec_type = 'U'.
  append it_receivers.

* Call the FM to post the message to SAPMAIL
  call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            sent_to_all                = gd_sent_all
            packing_list               = it_packing_list
            contents_txt               = it_message
            receivers                  = it_receivers
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            others                     = 8.

* Store function module return code
  gd_error = sy-subrc.

* Get it_receivers return code
  loop at it_receivers.
endform.                    " SEND_EMAIL_MESSAGE

*       Instructs mail send program for SAPCONNECT to send email.

form initiate_mail_execute_program.
  wait up to 2 seconds.
  if gd_error eq 0.
      submit rsconn01 with mode = 'INT'
                    with output = 'X'
                    and return.
endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM

pls TRANSLATE to ENGLISH to make us help you better.



Former Member
0 Kudos


biselo claramente sobre el requisito que usted tiene given.Can usted me explica por favor detalladamente sobre su esperanza de requirement.I puedo ayudarle más después eso.


Mrutyunjaya Tripathy