DATA: w_returnl TYPE ssfcrescl, w_returnp TYPE ssfcresop, w_returnd TYPE ssfcrespd. DATA : i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE, i_tline TYPE TABLE OF tline WITH HEADER LINE. " make each line 132 characters DATA: v_len_in LIKE sood-objlen. DATA : zdata LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE, zreceivers TYPE TABLE OF somlreci1 WITH HEADER LINE. *** make each line 255 characters DATA : BEGIN OF i_tline2 OCCURS 0, tline TYPE char255, END OF i_tline2.
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. * error handling ent_retco = sy-subrc. IF sy-subrc = 1. MESSAGE e001(/smb40/ssfcomposer). ENDIF. IF sy-subrc = 2. MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform. ENDIF. PERFORM protocol_update_i. ENDIF. * if it is faxed, changed its title to PO number IF ls_control_param-device = 'TELEFAX'. ls_composer_param-tdtitle = l_doc-xekko-ebeln. ENDIF. * if it is mail, changed its title to PO number IF ls_control_param-device = 'MAIL'. ls_composer_param-tdtitle = l_doc-xekko-ebeln. ENDIF. IF NOT lf_fm_name IS INITIAL. ls_control_param-no_dialog = ''. ls_control_param-preview = ''. ls_control_param-getotf = 'X'. ENDIF. *>>>>> Change of Parameters <<<<<<<<<<<<<<<<<<<<<<<
*
CALL FUNCTION '/1BCDWB/SF00000066' CALL FUNCTION lf_fm_name EXPORTING archive_index = toa_dara * ARCHIVE_INDEX_TAB = archive_parameters = arc_params control_parameters = ls_control_param * MAIL_APPL_OBJ = mail_recipient = ls_recipient mail_sender = ls_sender output_options = ls_composer_param user_settings = ' ' "Disable User Printer is_ekko = l_doc-xekko is_pekko = l_doc-xpekko is_nast = l_nast iv_from_mem = l_from_memory iv_druvo = iv_druvo IMPORTING document_output_info = w_returnd job_output_info = w_returnl job_output_options = w_returnp TABLES it_ekpo = l_doc-xekpo[] it_ekpa = l_doc-xekpa[] it_pekpo = l_doc-xpekpo[] it_eket = l_doc-xeket[] it_tkomv = l_doc-xtkomv[] it_ekkn = l_doc-xekkn[] it_ekek = l_doc-xekek[] it_komk = l_xkomk[] EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 OTHERS = 5 . IF sy-subrc <> 0. ent_retco = sy-subrc. PERFORM protocol_update_i. * get SmartForm protocoll and store it in the NAST protocoll PERFORM add_smfrm_prot. ENDIF. i_otf[] = w_returnl-otfdata[].
* * * * *
CALL FUNCTION 'CONVERT_OTF' EXPORTING format = 'PDF' max_linewidth = 132 ARCHIVE_INDEX = ' ' COPYNUMBER = 0 ASCII_BIDI_VIS2LOG = ' ' PDF_DELETE_OTFTAB = ' ' IMPORTING bin_filesize = v_len_in BIN_FILE =
TABLES otf = i_otf lines = i_tline EXCEPTIONS err_max_linewidth = 1 err_format = 2 err_conv_not_possible = 3 err_bad_otf = 4 OTHERS = 5 . *SX_TABLE_LINE_WIDTH_CHANGE use :- make each line 255 characters CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE' * EXPORTING * LINE_WIDTH_SRC = * LINE_WIDTH_DST = * TRANSFER_BIN = ' ' TABLES content_in = i_tline content_out = i_tline2 * EXCEPTIONS * ERR_LINE_WIDTH_SRC_TOO_LONG = 1 * ERR_LINE_WIDTH_DST_TOO_LONG = 2 * ERR_CONV_FAILED = 3 * OTHERS = 4 . CLEAR zdata. zdata-obj_name = 'PO Document'. zdata-obj_descr = 'SUBJECT for PO Document'. zdata-obj_langu = 'EN'. APPEND zdata. CLEAR zreceivers. zreceivers-receiver = '
[email protected]' . " RECEIVER mail address zreceivers-rec_type = 'U'. " B -> FOR SAP USER . PLEASE CHECK THE TABLE 'TBCS_RECIP' zreceivers-com_type = 'INT'. zreceivers-notif_del = 'X'. zreceivers-notif_ndel = 'X'. APPEND zreceivers. CLEAR zreceivers. zreceivers-receiver = '
[email protected]' . " RECEIVER mail address zreceivers-rec_type = 'U'. " B -> FOR SAP USER . PLEASE CHECK THE TABLE 'TBCS_RECIP' zreceivers-com_type = 'INT'. zreceivers-notif_del = 'X'. zreceivers-notif_ndel = 'X'. APPEND zreceivers. * zreceivers-rec_id = 'ABAP2' . " receiver mail address ********end of subject line CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1' EXPORTING document_data = zdata document_type = 'PDF'
* PUT_IN_OUTBOX = ' ' commit_work = 'X' * IMPORTING * SENT_TO_ALL = * NEW_OBJECT_ID = TABLES * OBJECT_HEADER = object_content = i_tline2 * CONTENTS_HEX = * OBJECT_PARA = * OBJECT_PARB = receivers = zreceivers " RECEIVER ADDRESS 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 EQ 0. WAIT UP TO 2 SECONDS. SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN. ENDIF.