접수완료 [ABAP] 엑셀 메일 전송시 한글깨짐 현상
페이지 정보
작성자
본문
※ T-CODE 가 없는 업무 프로세스 관련 질의는 상황적 설명만 올려 주세요!^^
1. 에러 발생 T-CODE :
2. SAP 에레 메세지 전체 Text :
3. 상황적인 설명 :
(필수 정보 - R3 or S4 , IT 직원 or 회계팀(현업) , 최종 원하는 결과 )
인터널테이블을 엑셀로 변환하여 메일을 전송하는 프로그램을 짜고있는데,,
메일에 엑셀첨부되어 전송까지는 잘되는데...
파일을 열면 한글이 깨져보입니다...ㅠㅠ
구글링해보니 SAP 버전 문제라고하는데,, 방법이 없을까요??
해당 소스 첨부합니다!
report zmailtest.
parameters: p_email type somlreci1-receiver
default 'aaa@naver.com'.
data: begin of it001 occurs 0,
bukrs type t001-bukrs,
butxt type t001-butxt,
end of it001.
data: imessage type standard table of solisti1 with header line,
iattach type standard table of solisti1 with header line,
ipacking_list like sopcklsti1 occurs 0 with header line,
ireceivers like somlreci1 occurs 0 with header line,
iattachment like solisti1 occurs 0 with header line.
start-of-selection.
select bukrs butxt into table it001 from t001.
*Populate table with detaisl to be entered into .xls file
perform build_xls_data .
*Populate message body text
clear imessage. refresh imessage.
imessage = 'Please find attached excel file'.
append imessage.
*Send file by email as .xls speadsheet
perform send_email_with_xls tables imessage
iattach
using p_email
'Example Excel Attachment'
'XLS'
'TestFileName'
'CompanyCodes'.
************************************************************************
form build_xls_data.
************************************************************************
*constants: con_cret type x value '0D', "OK for non Unicode
*con_tab type x value '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
constants: con_tab type c value cl_abap_char_utilities=>horizontal_tab,
con_cret type c value cl_abap_char_utilities=>cr_lf.
concatenate 'BUKRS' 'BUTXT'
into iattach separated by con_tab.
concatenate con_cret iattach into iattach.
append iattach.
loop at it001.
concatenate it001-bukrs it001-butxt
into iattach separated by con_tab.
concatenate con_cret iattach into iattach.
append iattach.
endloop.
endform. "BUILD_XLS_DATA
************************************************************************
************************************************************************
form send_email_with_xls tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription.
data: xdocdata like sodocchgi1,
xcnt type i.
*Fill the document data.
xdocdata-doc_size = 1.
*Populate the subject/generic message attributes
xdocdata-obj_langu = sy-langu.
xdocdata-obj_name = 'SAPRPT'.
xdocdata-obj_descr = p_mtitle .
*Fill the document data and get size of attachment
clear xdocdata.
read table iattach index xcnt.
xdocdata-doc_size =
( xcnt - 1 ) * 255 + strlen( iattach ).
xdocdata-obj_langu = sy-langu.
xdocdata-obj_name = 'SAPRPT'.
xdocdata-obj_descr = p_mtitle.
clear iattachment. refresh iattachment.
iattachment[] = pit_attach[].
*Describe the body of the message
clear ipacking_list. refresh ipacking_list.
ipacking_list-transf_bin = space.
ipacking_list-head_start = 1.
ipacking_list-head_num = 0.
ipacking_list-body_start = 1.
describe table imessage lines ipacking_list-body_num.
ipacking_list-doc_type = 'RAW'.
append ipacking_list.
*Create attachment notification
ipacking_list-transf_bin = 'X'.
ipacking_list-head_start = 1.
ipacking_list-head_num = 1.
ipacking_list-body_start = 1.
describe table iattachment lines ipacking_list-body_num.
ipacking_list-doc_type = p_format.
ipacking_list-obj_descr = p_attdescription.
ipacking_list-obj_name = p_filename.
ipacking_list-doc_size = ipacking_list-body_num * 255.
append ipacking_list.
*Add the recipients email address
clear ireceivers. refresh ireceivers.
ireceivers-receiver = p_email.
ireceivers-rec_type = 'U'.
ireceivers-com_type = 'INT'.
ireceivers-notif_del = 'X'.
ireceivers-notif_ndel = 'X'.