Smartform으로 작성된 발주서를 멜로 전송시 제목과 그 Smartform 양식을 첨부파일로 보내고 있습니다.
But 그러나 제목과 첨부파일만 존재하는 이 메일을 스펨으로 간주 전달이 되지 않는 업체가 존재합니다.
멜로 전송시 본문의 내용을 첨부할 수 있는 방법은 없을런지요?
<참고>
CALL FUNCTION FM_NAME
EXPORTING
CONTROL_PARAMETERS = CONTROL_PARAMETERS
MAIL_APPL_OBJ = G_MAIL_APP_OBJ "제목
MAIL_RECIPIENT = G_MAIL_REC_OBJ "수신인
MAIL_SENDER = G_MAIL_SEN_OBJ "발신인
OUTPUT_OPTIONS = OUTPUT_OPTIONS
* P_LFA1 = P_LFA1
LFA_LINE = PL_LINE
PLANT = P_WERKS
TABLES
STAB = STAB
SLFA = P_LFA1.
-> 요 function에 본문내용을 추가 할 방법이 있는지요?
내용이 들어가는지는 모르겠고요 프로그래밍은 레포트
BCS_EXAMPLE_2,
BCS_EXAMPLE_6 을 참조하면 될듯합니다. 믹스한 소스는 아래와 같습니다. 즐거운 하루 되세요
*----------------------------------------------------------------------*
* Report BCS_EXAMPLE_6
*----------------------------------------------------------------------*
* Email documents using PDF based forms
*----------------------------------------------------------------------*
REPORT bcs_example_6.
DATA: carr_id TYPE sbook-carrid.
PARAMETER: p_custid TYPE scustom-id DEFAULT 12.
SELECT-OPTIONS: s_carrid FOR carr_id DEFAULT 'AA' TO 'ZZ'.
PARAMETER: p_email TYPE adr6-smtp_addr OBLIGATORY.
DATA: customer TYPE scustom,
bookings TYPE ty_bookings,
connections TYPE ty_connections,
fm_name TYPE rs38l_fnam,
fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams,
error_string TYPE string.
DATA ls_formoutput TYPE fpformoutput.
DATA lx_fp_api TYPE REF TO cx_fp_api.
data lp_form TYPE tdsfname value 'FP_TEST_03'.
data lp_langu TYPE langu value 'D'.
data lp_countr TYPE land1 value 'DE'.
* BCS data
DATA send_request TYPE REF TO cl_bcs.
DATA text TYPE bcsy_text.
DATA document TYPE REF TO cl_document_bcs.
DATA recipient TYPE REF TO if_recipient_bcs.
DATA: bcs_exception TYPE REF TO cx_bcs.
DATA sent_to_all TYPE os_boolean.
DATA pdf_content TYPE solix_tab.
DATA lp_pdf_size TYPE so_obj_len.
* get data
SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.
CHECK sy-subrc = 0.
SELECT * FROM sbook INTO TABLE bookings
WHERE customid = p_custid
AND carrid IN s_carrid
ORDER BY PRIMARY KEY.
SELECT * FROM spfli INTO TABLE connections
FOR ALL ENTRIES IN bookings
WHERE carrid = bookings-carrid
AND connid = bookings-connid
ORDER BY PRIMARY KEY.
* Print data:
* First get name of the generated function module
TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lp_form
IMPORTING
e_funcname = fm_name.
CATCH cx_fp_api INTO lx_fp_api.
* exception handling
MESSAGE ID lx_fp_api->msgid TYPE lx_fp_api->msgty
NUMBER lx_fp_api->msgno
WITH lx_fp_api->msgv1 lx_fp_api->msgv2
lx_fp_api->msgv3 lx_fp_api->msgv4.
EXIT.
ENDTRY.
* Set output parameters and open spool job
fp_outputparams-nodialog = 'X'. " no print preview
fp_outputparams-getpdf = 'X'. " request PDF
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 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.
* Set form language and country (->form locale)
fp_docparams-langu = lp_langu.
fp_docparams-country = lp_countr.
* Now call the generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
customer = customer
bookings = bookings
connections = connections
IMPORTING
/1bcdwb/formoutput = ls_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
IMPORTING
e_adserrstr = error_string.
IF NOT error_string IS INITIAL.
* we received a detailed error description
WRITE:/ error_string.
EXIT.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
* Close spool job
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
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 BCS interface ----------------------------------
TRY.
* ---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
* ---------- add document ----------------------------------------
APPEND 'Hello world!' TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = 'test created by BCS_EXAMPLE_6' ).
* get PDF xstring and convert it to BCS format
lp_pdf_size = XSTRLEN( ls_formoutput-pdf ).
pdf_content = cl_document_bcs=>xstring_to_solix(
ip_xstring = ls_formoutput-pdf ).
* add attachment to document
CALL METHOD document->add_attachment
EXPORTING i_attachment_type = 'PDF'
i_attachment_subject = 'My attachment'
i_attachment_size = lp_pdf_size
i_att_content_hex = pdf_content.
* add document to send request
send_request->set_document( document ).
* ---------- add recipient (e-mail address) ----------------------
recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = p_email ).
* add recipient to send request
send_request->add_recipient( i_recipient = recipient ).
* ---------- send document ---------------------------------------
sent_to_all = send_request->send(
i_with_error_screen = 'X' ).
IF sent_to_all = 'X'.
message i022(so).
ENDIF.
* ---------- explicit 'commit work' is mandatory! ----------------
COMMIT WORK.
* ------------------------------------------------------------------
* * exception handling
* ------------------------------------------------------------------
* * replace this very rudimentary exception handling
* * with your own one !!!
* ------------------------------------------------------------------
CATCH cx_bcs INTO bcs_exception.
WRITE: text-001.
WRITE: text-002, bcs_exception->error_type.
EXIT.
ENDTRY.