DATA : it_abaplist TYPE TABLE OF abaplist.
DATA : it_html TYPE TABLE OF w3html.
DATA : lv_line TYPE sy-tabix.
DATA: objpack LIKE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,
tab_lines TYPE i,
doc_chng LIKE sodocchgi1,
objhead LIKE STANDARD TABLE OF solisti1 WITH HEADER LINE,
mail LIKE STANDARD TABLE OF solisti1 WITH HEADER LINE,
reclist LIKE STANDARD TABLE OF somlreci1 WITH HEADER LINE.
DELETE FROM MEMORY ID 'XXX'.
* internal table에 담아 처리해도되고( 이 경우 submit프로그램에서 import를 받아처리한다)
* submit 프로그램에서 처리해도 상관없다.
EXPORT gt_itab TO MEMORY ID 'XXX'.
DELETE FROM MEMORY ID '%_LIST'.
* ALV로 리스트를 뿌릴 프로그램을 SUBMIT한다.
SUBMIT ZXXXXXX WITH p_bukrs = p_bukrs
WITH p_batch = 'X'
AND RETURN EXPORTING LIST TO MEMORY.
FREE it_abaplist.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = it_abaplist
EXCEPTIONS
not_found = 1
OTHERS = 2.
" HTML 로 변경
FREE it_html.
CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
TABLES
html = it_html
listobject = it_abaplist.
* ------------------------------------------
doc_chng-obj_name = 'URGENT'.
doc_chng-sensitivty = 'O'.
CONCATENATE '[개인기준]' p_sdate '기준 미처리 증빙 내역' INTO doc_chng-obj_descr
SEPARATED BY space.
doc_chng-obj_langu = '3'.
** objhead = '파일제목'.
APPEND objhead.
* ------------------------------------------
FREE mail.
mail[] = it_html[].
CLEAR lv_line.
DESCRIBE TABLE mail LINES lv_line.
*
CLEAR: objpack.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = lv_line.
objpack-doc_type = 'HTM'.
objpack-obj_descr = '메일제목'.
objpack-doc_size = lv_line * 255.
objpack-obj_langu = '3'.
APPEND objpack.
CLEAR: reclist.
reclist-receiver = ls_ztficd10-email.
reclist-rec_type = 'U'.
APPEND reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = doc_chng " 메일 제목
document_type = 'HTM'
put_in_outbox = 'X'
commit_work = 'X'
* IP_ENCRYPT =
* IP_SIGN =
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
object_header = objhead
object_content = mail
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
댓글 없음:
댓글 쓰기