ZCRM_AU_MAIL
FUNCTION ZCRM_AU_MAIL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(EXGST) TYPE ZZFPAMT OPTIONAL
*" VALUE(INGST) TYPE ZZFPAMT OPTIONAL
*" VALUE(BELNR) TYPE BELNR_D OPTIONAL
*" TABLES
*" ZCRMS004 STRUCTURE ZCRMS004
*"----------------------------------------------------------------------
DATA: LS_CONTROL_PARAM TYPE SSFCTRLOP.
DATA: LS_COMPOSER_PARAM TYPE SSFCOMPOP.
DATA: LS_RECIPIENT TYPE SWOTOBJID.
DATA: LS_SENDER TYPE SWOTOBJID.
DATA: LF_FORMNAME TYPE TDSFNAME.
DATA: JOBINFO TYPE SSFCRESCL.
DATA: LF_FM_NAME TYPE RS38L_FNAM.
DATA: OTFDATA TYPE TSFOTF.
DATA: GV_XSTRING TYPE XSTRING,
LV_LEN TYPE I,
LT_PDF TYPE TABLE OF TLINE.
DATA: GT_OBJTXT LIKE SOLISTI1 OCCURS WITH HEADER LINE,
GT_OBJHEX TYPE SOLIX_TAB,
G_BENFILE TYPE XSTRING,
P_SENDER LIKE ADR6-SMTP_ADDR,
LV_SUBJECT TYPE SO_OBJ_DES VALUE 'remittance for payment to be processed'.
DATA LO_SEND_REQUEST TYPE REF TO CL_BCS.
DATA LO_DOCUMENT TYPE REF TO CL_DOCUMENT_BCS.
DATA LO_RECIPIENT TYPE REF TO IF_RECIPIENT_BCS.
DATA LO_BCS_EXCEPTION TYPE REF TO CX_BCS.
DATA LO_SENDER TYPE REF TO IF_SENDER_BCS. " Sender address
DATA LV_SIZE TYPE SO_OBJ_LEN.
DATA LV_ALL TYPE OS_BOOLEAN. LF_FORMNAME = 'ZCRM_SETMENT_AU'.
LS_CONTROL_PARAM-LANGU = 'E'.
LS_CONTROL_PARAM-NO_OPEN = 'X'.
LS_CONTROL_PARAM-NO_CLOSE = 'X'.
LS_COMPOSER_PARAM-TDDELETE = 'X'.",打印后删除
LS_COMPOSER_PARAM-TDIMMED = 'X'."立即打印
LS_COMPOSER_PARAM-TDDEST = 'LP03'.
LS_CONTROL_PARAM-GETOTF = 'X'.
LS_CONTROL_PARAM-NO_DIALOG = 'X'.
LS_COMPOSER_PARAM-TDNOPREV = 'X'. CALL FUNCTION 'SSF_OPEN'
EXPORTING
CONTROL_PARAMETERS = LS_CONTROL_PARAM
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
USER_SETTINGS = ''
EXCEPTIONS
FORMATTING_ERROR =
INTERNAL_ERROR =
SEND_ERROR =
USER_CANCELED =
OTHERS = .
IF SY-SUBRC <> .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = LF_FORMNAME
IMPORTING
FM_NAME = LF_FM_NAME
EXCEPTIONS
NO_FORM =
NO_FUNCTION_MODULE =
OTHERS = .
IF SY-SUBRC <> .
MESSAGE 'Call SSF_FUNCTION_MODULE_NAME Error' TYPE 'E'.
ENDIF. CALL FUNCTION LF_FM_NAME
EXPORTING
CONTROL_PARAMETERS = LS_CONTROL_PARAM
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
USER_SETTINGS = ' '
EXGST = EXGST
INGST = INGST
TABLES
GT_TABLE = ZCRMS004
EXCEPTIONS
FORMATTING_ERROR =
INTERNAL_ERROR =
SEND_ERROR =
USER_CANCELED =
OTHERS = .
IF SY-SUBRC <> .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. CALL FUNCTION 'SSF_CLOSE'
IMPORTING
JOB_OUTPUT_INFO = JOBINFO
EXCEPTIONS
FORMATTING_ERROR =
INTERNAL_ERROR =
SEND_ERROR =
OTHERS = .
IF SY-SUBRC <> .
MESSAGE 'Print Error!' TYPE 'E'.
ENDIF. OTFDATA = JOBINFO-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH =
IMPORTING
BIN_FILESIZE = LV_LEN
BIN_FILE = GV_XSTRING
TABLES
OTF = OTFDATA
LINES = LT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH =
ERR_FORMAT =
ERR_CONV_NOT_POSSIBLE =
OTHERS = . FREE LO_SEND_REQUEST.
LO_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
"
CLEAR: GT_OBJTXT, GT_OBJTXT[].
GT_OBJTXT = ' '.
APPEND GT_OBJTXT.
GT_OBJTXT = 'Dear Service Agent<br /> '.
APPEND GT_OBJTXT.
GT_OBJTXT = '<br />'.
APPEND GT_OBJTXT.
CLEAR:GT_OBJTXT.
MOVE INGST TO GT_OBJTXT.
CONDENSE GT_OBJTXT NO-GAPS.
CONCATENATE 'Please find attached remittance for' GT_OBJTXT 'payment<br />' INTO GT_OBJTXT SEPARATED BY space.
* GT_OBJTXT = 'Please find attached remittance for xxx.xx payment<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = 'Please allow up to 7 days for payment to be processed<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = 'If you have any enquiries, please email service.agents@hisense.com<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = '<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = 'Thank you.<br />'.
APPEND GT_OBJTXT. LO_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = 'HTM'
I_TEXT = GT_OBJTXT[]
I_SUBJECT = LV_SUBJECT ). TRY.
GT_OBJHEX = CL_BCS_CONVERT=>XSTRING_TO_SOLIX(
IV_XSTRING = GV_XSTRING
).
CATCH CX_BCS.
MESSAGE E445(SO).
ENDTRY.
CONCATENATE BELNR '.PDF' INTO LV_SUBJECT.
LO_DOCUMENT->ADD_ATTACHMENT(
I_ATTACHMENT_TYPE = 'PDF'
I_ATTACHMENT_SUBJECT = LV_SUBJECT
I_ATT_CONTENT_HEX = GT_OBJHEX ).
DATA: FAULT TYPE REF TO CX_SEND_REQ_BCS.
TRY.
LO_SEND_REQUEST->SET_DOCUMENT( LO_DOCUMENT ).
CATCH CX_SEND_REQ_BCS INTO FAULT.
MESSAGE I605(SBCOMS) .
ENDTRY. P_SENDER = 'XXXXXXX'. CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS
EXPORTING
I_ADDRESS_STRING = P_SENDER
I_ADDRESS_NAME = P_SENDER
RECEIVING
RESULT = LO_SENDER.
CALL METHOD LO_SEND_REQUEST->SET_SENDER
EXPORTING
I_SENDER = LO_SENDER. P_SENDER = 'wwwliyuananhui@126.com'. LO_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_SENDER ).
LO_SEND_REQUEST->ADD_RECIPIENT( LO_RECIPIENT ). P_SENDER = 'XXXXXXXX'. LO_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_SENDER ).
LO_SEND_REQUEST->ADD_RECIPIENT( EXPORTING I_RECIPIENT = LO_RECIPIENT I_COPY = 'X' ). LO_SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
LV_ALL = LO_SEND_REQUEST->SEND( I_WITH_ERROR_SCREEN = 'X' ). ENDFUNCTION.
FUNCTION ZCRM_AU_MAIL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(EXGST) TYPE ZZFPAMT OPTIONAL
*" VALUE(INGST) TYPE ZZFPAMT OPTIONAL
*" VALUE(BELNR) TYPE BELNR_D OPTIONAL
*" TABLES
*" ZCRMS004 STRUCTURE ZCRMS004
*"----------------------------------------------------------------------
DATA: LS_CONTROL_PARAM TYPE SSFCTRLOP.
DATA: LS_COMPOSER_PARAM TYPE SSFCOMPOP.
DATA: LS_RECIPIENT TYPE SWOTOBJID.
DATA: LS_SENDER TYPE SWOTOBJID.
DATA: LF_FORMNAME TYPE TDSFNAME.
DATA: JOBINFO TYPE SSFCRESCL.
DATA: LF_FM_NAME TYPE RS38L_FNAM.
DATA: OTFDATA TYPE TSFOTF.
DATA: GV_XSTRING TYPE XSTRING,
LV_LEN TYPE I,
LT_PDF TYPE TABLE OF TLINE.
DATA: GT_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
GT_OBJHEX TYPE SOLIX_TAB,
G_BENFILE TYPE XSTRING,
P_SENDER LIKE ADR6-SMTP_ADDR,
LV_SUBJECT TYPE SO_OBJ_DES VALUE 'remittance for payment to be processed'.
DATA LO_SEND_REQUEST TYPE REF TO CL_BCS.
DATA LO_DOCUMENT TYPE REF TO CL_DOCUMENT_BCS.
DATA LO_RECIPIENT TYPE REF TO IF_RECIPIENT_BCS.
DATA LO_BCS_EXCEPTION TYPE REF TO CX_BCS.
DATA LO_SENDER TYPE REF TO IF_SENDER_BCS. " Sender address
DATA LV_SIZE TYPE SO_OBJ_LEN.
DATA LV_ALL TYPE OS_BOOLEAN.
LF_FORMNAME = 'ZCRM_SETMENT_AU'.
LS_CONTROL_PARAM-LANGU = 'E'.
LS_CONTROL_PARAM-NO_OPEN = 'X'.
LS_CONTROL_PARAM-NO_CLOSE = 'X'.
LS_COMPOSER_PARAM-TDDELETE = 'X'.",打印后删除
LS_COMPOSER_PARAM-TDIMMED = 'X'."立即打印
LS_COMPOSER_PARAM-TDDEST = 'LP03'.
LS_CONTROL_PARAM-GETOTF = 'X'.
LS_CONTROL_PARAM-NO_DIALOG = 'X'.
LS_COMPOSER_PARAM-TDNOPREV = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
CONTROL_PARAMETERS = LS_CONTROL_PARAM
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
USER_SETTINGS = ''
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = LF_FORMNAME
IMPORTING
FM_NAME = LF_FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE 'Call SSF_FUNCTION_MODULE_NAME Error' TYPE 'E'.
ENDIF.
CALL FUNCTION LF_FM_NAME
EXPORTING
CONTROL_PARAMETERS = LS_CONTROL_PARAM
OUTPUT_OPTIONS = LS_COMPOSER_PARAM
USER_SETTINGS = ' '
EXGST = EXGST
INGST = INGST
TABLES
GT_TABLE = ZCRMS004
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
JOB_OUTPUT_INFO = JOBINFO
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE 'Print Error!' TYPE 'E'.
ENDIF.
OTFDATA = JOBINFO-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = LV_LEN
BIN_FILE = GV_XSTRING
TABLES
OTF = OTFDATA
LINES = LT_PDF
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
FREE LO_SEND_REQUEST.
LO_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
"
CLEAR: GT_OBJTXT, GT_OBJTXT[].
GT_OBJTXT = ' '.
APPEND GT_OBJTXT.
GT_OBJTXT = 'Dear Service Agent<br /> '.
APPEND GT_OBJTXT.
GT_OBJTXT = '<br />'.
APPEND GT_OBJTXT.
CLEAR:GT_OBJTXT.
MOVE INGST TO GT_OBJTXT.
CONDENSE GT_OBJTXT NO-GAPS.
CONCATENATE 'Please find attached remittance for' GT_OBJTXT 'payment<br />' INTO GT_OBJTXT SEPARATED BY space.
* GT_OBJTXT = 'Please find attached remittance for xxx.xx payment<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = 'Please allow up to 7 days for payment to be processed<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = 'If you have any enquiries, please email service.agents@hisense.com<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = '<br />'.
APPEND GT_OBJTXT.
GT_OBJTXT = 'Thank you.<br />'.
APPEND GT_OBJTXT.
LO_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = 'HTM'
I_TEXT = GT_OBJTXT[]
I_SUBJECT = LV_SUBJECT ).
TRY.
GT_OBJHEX = CL_BCS_CONVERT=>XSTRING_TO_SOLIX(
IV_XSTRING = GV_XSTRING
).
CATCH CX_BCS.
MESSAGE E445(SO).
ENDTRY.
CONCATENATE BELNR '.PDF' INTO LV_SUBJECT.
* LV_SUBJECT = 'test.PDF'.
LO_DOCUMENT->ADD_ATTACHMENT(
I_ATTACHMENT_TYPE = 'PDF'
I_ATTACHMENT_SUBJECT = LV_SUBJECT
I_ATT_CONTENT_HEX = GT_OBJHEX ).
DATA: FAULT TYPE REF TO CX_SEND_REQ_BCS.
TRY.
LO_SEND_REQUEST->SET_DOCUMENT( LO_DOCUMENT ).
CATCH CX_SEND_REQ_BCS INTO FAULT.
MESSAGE I605(SBCOMS) .
ENDTRY.
P_SENDER = 'service_jp@hisense.com'.
CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS
EXPORTING
I_ADDRESS_STRING = P_SENDER
I_ADDRESS_NAME = P_SENDER
RECEIVING
RESULT = LO_SENDER.
CALL METHOD LO_SEND_REQUEST->SET_SENDER
EXPORTING
I_SENDER = LO_SENDER.
P_SENDER = 'wwwliyuananhui@126.com'.
LO_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_SENDER ).
LO_SEND_REQUEST->ADD_RECIPIENT( LO_RECIPIENT ).
P_SENDER = 'dongxiang@hisense.com'.
LO_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_SENDER ).
LO_SEND_REQUEST->ADD_RECIPIENT( EXPORTING I_RECIPIENT = LO_RECIPIENT I_COPY = 'X' ).
LO_SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
LV_ALL = LO_SEND_REQUEST->SEND( I_WITH_ERROR_SCREEN = 'X' ).
ENDFUNCTION.
ZCRM_AU_MAIL的更多相关文章
随机推荐
- 6.1-uC/OS-III软件定时器
1.软件定时器是 uC/OS 操作系统的一个内核对象,软件定时器是基于时钟节拍和系统管理创建的软件性定时器,理论上可以创建无限多个,但精准度肯定比硬件定时稍逊一筹. 2.软件定时器启动之后是由软件定时 ...
- 20189203《Linux内核原理与分析》第一周作业
实验一 Linux 系统简介 我在这一课中主要学习了Linux是什么,Linux的产生和发展历史,Linux发展中的重要人物以及Linux和Windows在是否收费.软件与支持.安全性等方面存在的一些 ...
- Python中if __name__ == '__main__',__init__和self 的解析
1.2.1 一个.py文件被其他.py文件引用 假设我们有一个const.py文件,内容如下: 现在,我们写一个用于计算圆面积的area.py文件,area.py文件需要用到const.py文件中的P ...
- 用python写多线程
import threading #首先导入threading 模块,这是使用多线程的前提 from time import ctime,sleep def music(func): ): print ...
- proto 3 语法
一.简介 proto3是新版本的protobuf语法.它简化了部分语法,并扩大了支持的语言,Ruby.C#.目前谷歌推荐只在是用新支持的语言或使用新的gRPC框架的时候使用.proto2和proto3 ...
- Scala 偏函数
如果你想定义一个函数,而让它只接受和处理其参数定义域范围内的子集,对于这个参数范围外的参数则抛出异常,这样的函数就是偏函数(顾名思异就是这个函数只处理传入来的部分参数). 偏函数是个特质其的类型为Pa ...
- iptables 扩展匹配 第三章
获取帮助: centos 6 :man iptables centos 7: man iptables-extensions 扩展匹配: 隐式扩展:当使用-p指定某一协议之后,协议自身所支持的扩展就叫 ...
- elastichd安装部署
1.下载 elastichd下载地址:https://github.com/360EntSecGroup-Skylar/ElasticHD/releases或是直接在linux下下载wget http ...
- MySQL基础和JDBC
第一章 命令行工具 mysqladmin:MySQL服务器管理工具 mysql:MySQL客服端链接工具 mysqldump 演示链接到服务器host=127.0.0.1,用户名为root,密码为空 ...
- springboot配置cxf
1.引入两个需要的jar <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf- ...