使用ABAP cl_document_bcs发送邮件
发布日期:2021-06-30 14:06:37
浏览次数:3
分类:技术文章
本文共 2123 字,大约阅读时间需要 7 分钟。
REPORT ZBO.DATA: lv_title TYPE so_obj_des, send_request TYPE REF TO CL_BCS, document TYPE REF TO CL_DOCUMENT_BCS, conlengths TYPE so_obj_len, html TYPE STANDARD TABLE OF w3html, wa_html TYPE w3html, sender_id TYPE REF TO IF_SENDER_BCS, recipient TYPE REF TO IF_RECIPIENT_BCS, sent_to_all TYPE os_boolean, bcs_exception TYPE REF TO cx_bcs, bcs_message TYPE string.lv_title = 'This is the title'.wa_html-line = ''.APPEND wa_html TO html....wa_html-line = ''.APPEND wa_html TO html.TRY. CLEAR send_request. send_request = cl_bcs=>create_persistent( ). CLEAR document . document = cl_document_bcs=>create_document( i_type = 'HTM' i_text = html i_length = conlengths i_subject = lv_title ).* Add document to send request CALL METHOD send_request->set_document( document ).* Construct sender and receiver CLEAR: sender_id , recipient . sender_id = cl_cam_address_bcs=>create_internet_address( 'abc@zh.cn' ). recipient = cl_cam_address_bcs=>create_internet_address( 'jerry.wang@sap.com' ).* Set sender CALL METHOD send_request->set_sender EXPORTING i_sender = sender_id.* Add recipient with its respective attributes to send request CALL METHOD send_request->add_recipient EXPORTING i_recipient = recipient i_express = 'X'.* Set E-mail sending options CALL METHOD send_request->set_status_attributes EXPORTING i_requested_status = 'E' i_status_mail = 'E'. CALL METHOD send_request->set_send_immediately( 'X' ).* Send document CALL METHOD send_request->send( EXPORTING i_with_error_screen = 'X' RECEIVING result = sent_to_all ). IF sent_to_all = 'X'. MESSAGE 'Mail sent successfully ' TYPE 'S'. ENDIF. COMMIT WORK. CATCH cx_bcs INTO bcs_exception. bcs_message = bcs_exception->get_text( ). MESSAGE bcs_exception TYPE 'E'. EXIT.ENDTRY.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
转载地址:https://jerry.blog.csdn.net/article/details/104033707 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
做的很好,不错不错
[***.243.131.199]2024年04月13日 16时45分57秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
MATLAB与CUDA
2019-04-30
Linux png转jpg (convert命令)
2019-04-30
Ubuntu更新后终端中字体的颜色全是白色
2019-04-30
vscode git
2019-04-30
基于MATLAB的二进制数字调制与解调信号的仿真——2PSK
2019-04-30
基于MATLAB的模拟调制信号与解调的仿真——DSB
2019-04-30
HDU - 1166 敌兵布阵 (树状数组模板题/线段树模板题)
2019-04-30
CodeForces - 456C Boredom (dp)
2019-04-30
CodeForces - 675A Infinite Sequence(简单数论 细节)
2019-04-30
CodeForces - 1042B Vitamins (思维)
2019-04-30
ACM 2013 长沙区域赛 Collision (几何)
2019-04-30
ACM 2014 鞍山区域赛 E - Hatsune Miku (dp)
2019-04-30
反向传播&梯度下降 的直观理解程序(numpy)
2019-04-30
CodeForces - 931B World Cup (思维 模拟)
2019-04-30
ACM 2017 北京区域赛 J-Pangu and Stones(区间dp)
2019-04-30
java常用类 String面试题
2019-04-30
利用ffmpeg合并音频和视频
2019-04-30