cancel
Showing results for 
Search instead for 
Did you mean: 

send mail in webdynpro abap

former_member497277
Participant
0 Kudos

Hello

I´m doing one view in webdynpro, which sends a mail to a direction predetermined with the data that the user introduces (in a inputfield).

I have found examples in java but no in abap. Somebody could help me?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I would assume that you can just call the function module from your Web Dynpro ABAP code, maybe in a onAction Method. Here is an example of the use of the function module in a report program.




report zrich_0003 .

* For API
data: maildata type sodocchgi1.
data: mailtxt  type table of solisti1 with header line.
data: mailrec  type table of somlrec90 with header line.

start-of-selection.

  clear:    maildata, mailtxt,  mailrec.
  refresh:  mailtxt, mailrec.

  maildata-obj_name = 'TEST'.
  maildata-obj_descr = 'Test'.
  maildata-obj_langu = sy-langu.

  mailtxt-line = 'This is a test'.
  append mailtxt.

  mailrec-receiver = 'you@yourcompany.com'.
  mailrec-rec_type  = 'U'.
  append mailrec.

    call function 'SO_NEW_DOCUMENT_SEND_API1'
         exporting
              document_data              = maildata
              document_type              = 'RAW'
              put_in_outbox              = 'X'
         tables
              object_header              = mailtxt
              object_content             = mailtxt
              receivers                  = mailrec
         exceptions
              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.
    if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.

  

Regards,

Rich Heilman

Answers (1)

Answers (1)

former_member497277
Participant
0 Kudos

THANKS FOR EVERYTHING