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的更多相关文章
随机推荐
- redis发布订阅、事务、脚本
Redis 发布订阅 Redis 发布订阅(pub/sub)是一种消息通信模式:发送者(pub)发送消息,订阅者(sub)接收消息. Redis 客户端可以订阅任意数量的频道. 下图展示了频道 cha ...
- mysql限制用户只能访问指定数据库
1.使用root账户登录mysql mysql -uroot -ppassword 2.进入mysql数据库 mysql > use mysql 3.限制用户权限 GRANT SELECT, I ...
- numpy 性能提升
a = np.array([1,2,3,4,5,1,2,2,2])c = np.unique(a)print(c) 对于很大的稀疏矩阵,我们不能用a[a>0]去取大于0的元素,而应该使用np.w ...
- 《linux就该这么学》第七节课:文件的各种权限以及linux分区命名规则
笔记 (借鉴请改动) 5.3:文件特殊权限 SUID 临时拥有文件所有者的权限(基本上只是执行权限) SGID 临时拥有文件所有组的权限,在目录中创建文件自动继承该目录的用户组. SBIT 粘滞 ...
- python_study-1
# Author:larlly'''函数1.在Python交互式命令行下,可以直接输入代码,然后执行,并立刻得到结果.2.文本编辑器推荐俩款 http://www.sublimetext.com/ h ...
- Java集群优化——使用Dubbo对单一应用服务化改造
之前,我们讨论过Nginx+tomcat组成的集群,这已经是非常灵活的集群技术,但是当我们的系统遇到更大的瓶颈,全部应用的单点服务器已经不能满足我们的需求,这时,我们要考虑另外一种,我们熟悉的内容,就 ...
- 虚拟机linux下安装tomcat外部可访问
1.解压tomcat压缩包 tar -zxvf apache-tomcat 2.启动tomcat 进入bin目录下 ./catalina.sh run (startup.sh不会显示日志信息) 3. ...
- Docker Swarm 创建服务
Docker Swarm 创建服务 环境: 系统:Centos 7.4 x64 应用版本:Docker 18.09.0 管理节点:192.168.1.79 工作节点:192.168.1.78 工作节点 ...
- Linux下启动Oracle服务和监听程序
$ su – oracle $ sqlplus / nolog sql> conn / as sysdba sql> startup #启动Oracle,需 ...
- 剑指offer(60)把二叉树打印成多行
题目描述 从上到下按层打印二叉树,同一层结点从左至右输出.每一层输出一行. 题目分析 从上到下打印二叉树我们知道用队列可以实现,但是如果多行打印怎么做呢? 我们需要分割,在行与行之间进行分割.如何分割 ...