E-Mail senden

Alles rund um die Sprache ABAP®: Funktionsbausteine, Listen, ALV

E-Mail senden

Postby Beate4743 » Tue Aug 14, 2018 8:55 am

Hallo Leute,

ich benutze zum Emails schicken die Klasse CL_BCS. Habe sie auch schon mal verwendet aber in meinem neuen Programm gehen keine Mails raus, obwohl der Code meiner Meinung nach stimmt. Kann hier mal einer rüber gucken?
E-mailadressen habe ich natürlich fürs Posten verändert.

Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1.   "Sendeauftrag
  2.   lr_send_request  TYPE REF TO cl_bcs VALUE IS INITIAL,
  3.   lr_document      TYPE REF TO cl_document_bcs,
  4.   lrx_bcs          TYPE REF TO cx_bcs,
  5.   lif_recipient    TYPE REF TO if_recipient_bcs,
  6.   lif_cc           TYPE REF TO if_recipient_bcs,
  7.   "Mail
  8.   l_subject        TYPE so_obj_des,
  9.   lt_mailtext      TYPE TABLE OF solisti1,
  10.   ls_mailtext      TYPE solisti1,
  11.   lif_sender       TYPE REF TO if_sender_bcs,
  12.   l_is_sent_to_all TYPE os_boolean.
  13.  
  14.     "Sendeauftrag anlegen
  15.     lr_send_request = cl_bcs=>create_persistent( ).
  16.  
  17.     "E-Mail subject
  18.     CLEAR l_subject.
  19.  
  20.     CONCATENATE TEXT-t01 '123' INTO l_subject SEPARATED BY space.
  21.  
  22. * Mailtabelle füllen
  23.     ls_mailtext = 'Hallo'.
  24.     APPEND ls_mailtext TO lt_mailtext.
  25.  
  26. * Office Document anlegen
  27.     lr_document = cl_document_bcs=>create_document(
  28.                                  i_type    = 'RAW'
  29.                                  i_text    = lt_mailtext
  30.                                  i_subject = l_subject ).
  31.  
  32.     lr_send_request->set_document( lr_document ).
  33.  
  34. *       Sender
  35.     lif_sender = cl_cam_address_bcs=>create_internet_address( 'test@test.com' ).
  36.     lr_send_request->set_sender( i_sender = lif_sender ).
  37.  
  38.     lif_recipient = cl_cam_address_bcs=>create_internet_address( 'test@test.de' ).
  39.     lr_send_request->add_recipient( i_recipient = lif_recipient ).
  40.     "senden
  41. *    lr_send_request->set_send_immediately( i_send_immediately = 'X' ).    "nachher auskommentieren
  42.     l_is_sent_to_all = lr_send_request->send( i_with_error_screen = 'X' ).
  43.  
  44.   CATCH cx_bcs INTO lrx_bcs.
  45.     MESSAGE e865(so) WITH lrx_bcs->error_type.
GeSHi ©


Danke.
Beate4743
...
...
 
Posts: 214
Joined: Mon Oct 26, 2009 8:18 am

Return to ABAP® Core

Who is online

Users browsing this forum: No registered users and 2 guests

cron
  • Latest Topics