Skip to content

Instantly share code, notes, and snippets.

@fahridon
Last active December 13, 2018 06:58
Show Gist options
  • Save fahridon/bbfa156125cab69eca3ef01770ffd441 to your computer and use it in GitHub Desktop.
Save fahridon/bbfa156125cab69eca3ef01770ffd441 to your computer and use it in GitHub Desktop.
ABAP: sample program to send mail from SAP
REPORT zpnt_fd_dnm2.
TYPES: BEGIN OF ty_lines,
line TYPE char255,
END OF ty_lines.
DATA: ti_lines TYPE STANDARD TABLE OF ty_lines,
wa_lines TYPE ty_lines.
DATA: title TYPE string,
sender_email TYPE string,
receiver_email TYPE string.
title = 'Mail başlığı-TEST'.
CLEAR wa_lines.
wa_lines-line = 'Merhaba.(Satır-1)'.
APPEND wa_lines TO ti_lines.
CLEAR wa_lines.
wa_lines-line = 'Bu bir test maili. (Satır-2)'.
APPEND wa_lines TO ti_lines.
sender_email = 'fahridonmez@test.com.tr'.
receiver_email = 'fahridonmez@test.com.tr'.
CALL FUNCTION 'EFG_GEN_SEND_EMAIL'
EXPORTING
i_title = title
i_sender = sender_email
i_recipient = receiver_email
i_flg_commit = 'X'
i_flg_send_immediately = 'X'
TABLES
i_tab_lines = ti_lines
EXCEPTIONS
not_qualified = 1
failed = 2
OTHERS = 3.
IF sy-subrc NE 0.
WRITE: 'hata...!'.
ELSE.
WRITE: 'basarili...!'.
ENDIF.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment