<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: smartform in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899954#M935866</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This document can be utilized while sending a smartform output as an attachment in the PDF format to any recipient email address in the World Wide Web.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step1:  Call the function module of the smartform and pass the final internal table (output table) into the form interface, also exporting the control parameters output options and user settings importing the structure job_output_info and transfer the contents of STRUC_JOB_OUTPUT_INFO-OTFDATA[] into an internal table I_OTFDATA[] which contains the records in OTF format.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;CALL FUNCTION v_function_module&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;    CONTROL_PARAMETERS      = STRUC_SSFCTRLOP&lt;/P&gt;&lt;P&gt;    OUTPUT_OPTIONS          = STRUC_OUTPUT_OPTIONS&lt;/P&gt;&lt;P&gt;    USER_SETTINGS           = C_NO&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;    JOB_OUTPUT_INFO         = STRUC_JOB_OUTPUT_INFO&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    p_write_file               =   i_write_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   FORMATTING_ERROR           = 1&lt;/P&gt;&lt;P&gt;   INTERNAL_ERROR             = 2&lt;/P&gt;&lt;P&gt;   SEND_ERROR                 = 3&lt;/P&gt;&lt;P&gt;   USER_CANCELED              = 4&lt;/P&gt;&lt;P&gt;   OTHERS                     = 5&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Transferring the data into an internal table &lt;/P&gt;&lt;P&gt;I_OTFDATA[] = STRUC_JOB_OUTPUT_INFO-OTFDATA[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 2:  Creation of the document to be sent .Populate the exporting structure doc_chng with the text containing the name of the document and the calculated document size and also populate the table objtxt .&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  doc_chng-obj_name = text-001.  "'ACCOUNT_STATEMENT'.&lt;/P&gt;&lt;P&gt;  doc_chng-obj_descr = text-001.  "'ACCOUNT_STATEMENT'.&lt;/P&gt;&lt;P&gt;  objtxt = text-001.  "'ACCOUNT_STATEMENT'.&lt;/P&gt;&lt;P&gt;  APPEND objtxt.&lt;/P&gt;&lt;P&gt;  CLEAR objtxt.&lt;/P&gt;&lt;P&gt;  APPEND objtxt.&lt;/P&gt;&lt;P&gt;  APPEND objtxt.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE objtxt LINES tab_lines.&lt;/P&gt;&lt;P&gt;  READ TABLE objtxt INDEX tab_lines.&lt;/P&gt;&lt;P&gt;  doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 3: Creation of the entry for the compressed document by populating the table objpack.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  CLEAR objpack-transf_bin.&lt;/P&gt;&lt;P&gt;  objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-head_num = 0.&lt;/P&gt;&lt;P&gt;  objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-body_num = tab_lines.&lt;/P&gt;&lt;P&gt;  objpack-doc_type = c_raw.&lt;/P&gt;&lt;P&gt;  APPEND objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 4: Converting the form to PDF format by passing the table in OTF format and storing the returned value in PDF format.&lt;/P&gt;&lt;P&gt;Sample Code &lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'CONVERT_OTF_2_PDF'&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            bin_filesize           = l_numbytes&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            otf                    = i_otfdata&lt;/P&gt;&lt;P&gt;            doctab_archive         = doctab&lt;/P&gt;&lt;P&gt;            lines                  = i_pdf&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            err_conv_not_possible  = 1&lt;/P&gt;&lt;P&gt;            err_otf_mc_noendmarker = 2&lt;/P&gt;&lt;P&gt;            OTHERS                 = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 5: Creation of the document to be attached and storing it in the table objbin to be later on passed on, in the function module. &lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  LOOP AT i_pdf.&lt;/P&gt;&lt;P&gt;    CLEAR l_str.&lt;/P&gt;&lt;P&gt;    l_str+0(2) = i_pdf-tdformat.&lt;/P&gt;&lt;P&gt;    l_str+2(132) = i_pdf-tdline.&lt;/P&gt;&lt;P&gt;    v2 = v1 + c_134.&lt;/P&gt;&lt;P&gt;    IF v2 LE c_255.&lt;/P&gt;&lt;P&gt;      objbin-line+v1(c_134) = l_str.&lt;/P&gt;&lt;P&gt;      v1 = v2.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      v3 = v2 - c_255.&lt;/P&gt;&lt;P&gt;      v2 = c_255 - v1.&lt;/P&gt;&lt;P&gt;      IF NOT v2 IS INITIAL.&lt;/P&gt;&lt;P&gt;        objbin-line&lt;EM&gt;v1(v2) = l_str&lt;/EM&gt;0(v2).&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;      APPEND objbin.&lt;/P&gt;&lt;P&gt;      CLEAR objbin.&lt;/P&gt;&lt;P&gt;      v1 = v3.&lt;/P&gt;&lt;P&gt;      v3 = 134 - v1.&lt;/P&gt;&lt;P&gt;      IF NOT v1 IS INITIAL.&lt;/P&gt;&lt;P&gt;        objbin-line&lt;EM&gt;0(v1) = l_str&lt;/EM&gt;v3(v1).&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  APPEND objbin.&lt;/P&gt;&lt;P&gt;  CLEAR objbin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE objbin LINES tab_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 6: Populating the table objhead to be later on passed in the function module.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  Describe table objbin lines tab_lines.&lt;/P&gt;&lt;P&gt;  objhead = text-001.  "'Account Statement'.&lt;/P&gt;&lt;P&gt;  APPEND objhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 7: Creation of the entry for the compressed attachment&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  objpack-transf_bin = c_x.&lt;/P&gt;&lt;P&gt;  objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-head_num = 1.&lt;/P&gt;&lt;P&gt;  objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-body_num = tab_lines.&lt;/P&gt;&lt;P&gt;  objpack-doc_type = c_pdf.&lt;/P&gt;&lt;P&gt;  objpack-obj_name = text-001.  "''&lt;/P&gt;&lt;P&gt;  objpack-obj_descr = text-001.  "''&lt;/P&gt;&lt;P&gt;  objpack-doc_size = tab_lines * 255.&lt;/P&gt;&lt;P&gt;  APPEND objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 8:  Populating the recipient internet addresses where mails are to be sent in the table reclist to be passed on the function module.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;   IF NOT i_reclist[] is initial.&lt;/P&gt;&lt;P&gt;    SELECT  addrnumber&lt;/P&gt;&lt;P&gt;            smtp_addr&lt;/P&gt;&lt;P&gt;    INTO TABLE i_reclist&lt;/P&gt;&lt;P&gt;    FROM adr6&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN i_adrc&lt;/P&gt;&lt;P&gt;    WHERE addrnumber = i_adrc-addrnumber.&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    LOOP AT i_reclist.&lt;/P&gt;&lt;P&gt;    reclist-receiver = i_reclist-smtp_addr.&lt;/P&gt;&lt;P&gt;    reclist-rec_type = c_u.&lt;/P&gt;&lt;P&gt;    APPEND reclist.&lt;/P&gt;&lt;P&gt;    CLEAR  reclist.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 9:  CALL FUNCTION 'SO_DOCUMENT_SEND_API1' and pass the already populated structures and tables. The sender address type is u2018INTu2019 and the sender address can be left as default blank.This will mail the contents of OBJBIN (PDF file containing the smartform output) to the recipient internet addresses stored in the table reclist.&lt;/P&gt;&lt;P&gt;       Sample Code&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;            document_data              = doc_chng&lt;/P&gt;&lt;P&gt;            put_in_outbox              = c_x&lt;/P&gt;&lt;P&gt;            sender_address             = l_sender&lt;/P&gt;&lt;P&gt;            sender_address_type        = c_int&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            packing_list               = objpack&lt;/P&gt;&lt;P&gt;            object_header              = objhead&lt;/P&gt;&lt;P&gt;            contents_bin               = objbin&lt;/P&gt;&lt;P&gt;            contents_txt               = objtxt&lt;/P&gt;&lt;P&gt;            receivers                  = reclist&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            too_many_receivers         = 1&lt;/P&gt;&lt;P&gt;            document_not_sent          = 2&lt;/P&gt;&lt;P&gt;            document_type_not_exist    = 3&lt;/P&gt;&lt;P&gt;            operation_no_authorization = 4&lt;/P&gt;&lt;P&gt;            parameter_error            = 5&lt;/P&gt;&lt;P&gt;            x_error                    = 6&lt;/P&gt;&lt;P&gt;            enqueue_error              = 7&lt;/P&gt;&lt;P&gt;            OTHERS                     = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jun 2008 09:34:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-06T09:34:10Z</dc:date>
    <item>
      <title>smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899951#M935863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to send emails to a recipient address containing the smartform in the PDF format as an attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;jagruthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2008 04:35:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899951#M935863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-06T04:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899952#M935864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagruthi hanma,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WELCOME TO SDN!!!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Smartform PDF as Mail&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="736633"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and also look at this thread&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="790560"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check some of the blogs posted by Thomas Jung&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kodandarami Reddy.S on Jun 6, 2008 10:14 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2008 04:40:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899952#M935864</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-06T04:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899953#M935865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal Table declarations &lt;/P&gt;&lt;P&gt;DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_tline TYPE TABLE OF tline WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Objects to send mail. &lt;/P&gt;&lt;P&gt;i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Work Area declarations &lt;/P&gt;&lt;P&gt;wa_objhead TYPE soli_tab,&lt;/P&gt;&lt;P&gt;w_ctrlop TYPE ssfctrlop,&lt;/P&gt;&lt;P&gt;w_compop TYPE ssfcompop,&lt;/P&gt;&lt;P&gt;w_return TYPE ssfcrescl,&lt;/P&gt;&lt;P&gt;wa_doc_chng typE sodocchgi1,&lt;/P&gt;&lt;P&gt;w_data TYPE sodocchgi1,&lt;/P&gt;&lt;P&gt;wa_buffer TYPE string,"To convert from 132 to 255&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variables declarations &lt;/P&gt;&lt;P&gt;v_form_name TYPE rs38l_fnam,&lt;/P&gt;&lt;P&gt;v_len_in LIKE sood-objlen,&lt;/P&gt;&lt;P&gt;v_len_out LIKE sood-objlen,&lt;/P&gt;&lt;P&gt;v_len_outn TYPE i,&lt;/P&gt;&lt;P&gt;v_lines_txt TYPE i,&lt;/P&gt;&lt;P&gt;v_lines_bin TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'SSF_FUNCTION_MODULE_NAME'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;formname = 'ZZZ_TEST1'&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;fm_name = v_form_name&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;no_form = 1&lt;/P&gt;&lt;P&gt;no_function_module = 2&lt;/P&gt;&lt;P&gt;others = 3.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_ctrlop-getotf = 'X'.&lt;/P&gt;&lt;P&gt;w_ctrlop-no_dialog = 'X'.&lt;/P&gt;&lt;P&gt;w_compop-tdnoprev = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION v_form_name&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;control_parameters = w_ctrlop&lt;/P&gt;&lt;P&gt;output_options = w_compop&lt;/P&gt;&lt;P&gt;user_settings = 'X'&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;job_output_info = w_return&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;formatting_error = 1&lt;/P&gt;&lt;P&gt;internal_error = 2&lt;/P&gt;&lt;P&gt;send_error = 3&lt;/P&gt;&lt;P&gt;user_canceled = 4&lt;/P&gt;&lt;P&gt;OTHERS = 5.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_otf] = w_return-otfdata[.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'CONVERT_OTF'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;format = 'PDF'&lt;/P&gt;&lt;P&gt;max_linewidth = 132&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;bin_filesize = v_len_in&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;otf = i_otf&lt;/P&gt;&lt;P&gt;lines = i_tline&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;err_max_linewidth = 1&lt;/P&gt;&lt;P&gt;err_format = 2&lt;/P&gt;&lt;P&gt;err_conv_not_possible = 3&lt;/P&gt;&lt;P&gt;others = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fehlerhandling &lt;/P&gt;&lt;P&gt;if sy-subrc 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_tline.&lt;/P&gt;&lt;P&gt;translate i_tline using '~'.&lt;/P&gt;&lt;P&gt;concatenate wa_buffer i_tline into wa_buffer.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;translate wa_buffer using '~'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;i_record = wa_buffer.&lt;/P&gt;&lt;P&gt;append i_record.&lt;/P&gt;&lt;P&gt;shift wa_buffer left by 255 places.&lt;/P&gt;&lt;P&gt;if wa_buffer is initial.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attachment &lt;/P&gt;&lt;P&gt;refresh:&lt;/P&gt;&lt;P&gt;i_reclist,&lt;/P&gt;&lt;P&gt;i_objtxt,&lt;/P&gt;&lt;P&gt;i_objbin,&lt;/P&gt;&lt;P&gt;i_objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear wa_objhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_objbin] = i_record[.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create Message Body &lt;/P&gt;&lt;P&gt;Title and Description &lt;/P&gt;&lt;P&gt;i_objtxt = 'test with pdf-Attachment!'.&lt;/P&gt;&lt;P&gt;append i_objtxt.&lt;/P&gt;&lt;P&gt;describe table i_objtxt lines v_lines_txt.&lt;/P&gt;&lt;P&gt;read table i_objtxt index v_lines_txt.&lt;/P&gt;&lt;P&gt;wa_doc_chng-obj_name = 'smartform'.&lt;/P&gt;&lt;P&gt;wa_doc_chng-expiry_dat = sy-datum + 10.&lt;/P&gt;&lt;P&gt;wa_doc_chng-obj_descr = 'smartform'.&lt;/P&gt;&lt;P&gt;wa_doc_chng-sensitivty = 'F'.&lt;/P&gt;&lt;P&gt;wa_doc_chng-doc_size = v_lines_txt * 255.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Main Text &lt;/P&gt;&lt;P&gt;wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt ) &lt;/P&gt;&lt;P&gt;*.&lt;/P&gt;&lt;P&gt;clear i_objpack-transf_bin.&lt;/P&gt;&lt;P&gt;i_objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;i_objpack-head_num = 0.&lt;/P&gt;&lt;P&gt;i_objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;i_objpack-body_num = v_lines_txt.&lt;/P&gt;&lt;P&gt;i_objpack-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;append i_objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attachment &lt;/P&gt;&lt;P&gt;(pdf-Attachment) &lt;/P&gt;&lt;P&gt;i_objpack-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;i_objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;i_objpack-head_num = 0.&lt;/P&gt;&lt;P&gt;i_objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Länge des Attachment ermitteln &lt;/P&gt;&lt;P&gt;describe table i_objbin lines v_lines_bin.&lt;/P&gt;&lt;P&gt;read table i_objbin index v_lines_bin.&lt;/P&gt;&lt;P&gt;i_objpack-doc_size = v_lines_bin * 255 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i_objpack-body_num = v_lines_bin.&lt;/P&gt;&lt;P&gt;i_objpack-doc_type = 'PDF'.&lt;/P&gt;&lt;P&gt;i_objpack-obj_name = 'smart'.&lt;/P&gt;&lt;P&gt;i_objpack-obj_descr = 'test'.&lt;/P&gt;&lt;P&gt;append i_objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear i_reclist.&lt;/P&gt;&lt;P&gt;i_reclist-receiver = 'zyz@mailid'.&lt;/P&gt;&lt;P&gt;i_reclist-rec_type = 'U'.&lt;/P&gt;&lt;P&gt;append i_reclist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;document_data = wa_doc_chng&lt;/P&gt;&lt;P&gt;put_in_outbox = 'X'&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;packing_list = i_objpack&lt;/P&gt;&lt;P&gt;object_header = wa_objhead&lt;/P&gt;&lt;P&gt;CONTENTS_BIN = i_objbin&lt;/P&gt;&lt;P&gt;contents_txt = i_objtxt&lt;/P&gt;&lt;P&gt;receivers = i_reclist&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;too_many_receivers = 1&lt;/P&gt;&lt;P&gt;document_not_sent = 2&lt;/P&gt;&lt;P&gt;document_type_not_exist = 3&lt;/P&gt;&lt;P&gt;operation_no_authorization = 4&lt;/P&gt;&lt;P&gt;parameter_error = 5&lt;/P&gt;&lt;P&gt;x_error = 6&lt;/P&gt;&lt;P&gt;enqueue_error = 7&lt;/P&gt;&lt;P&gt;others = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if Helpfull &lt;/P&gt;&lt;P&gt; Naresh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2008 04:40:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899953#M935865</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-06T04:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: smartform</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899954#M935866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This document can be utilized while sending a smartform output as an attachment in the PDF format to any recipient email address in the World Wide Web.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step1:  Call the function module of the smartform and pass the final internal table (output table) into the form interface, also exporting the control parameters output options and user settings importing the structure job_output_info and transfer the contents of STRUC_JOB_OUTPUT_INFO-OTFDATA[] into an internal table I_OTFDATA[] which contains the records in OTF format.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;CALL FUNCTION v_function_module&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;    CONTROL_PARAMETERS      = STRUC_SSFCTRLOP&lt;/P&gt;&lt;P&gt;    OUTPUT_OPTIONS          = STRUC_OUTPUT_OPTIONS&lt;/P&gt;&lt;P&gt;    USER_SETTINGS           = C_NO&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;    JOB_OUTPUT_INFO         = STRUC_JOB_OUTPUT_INFO&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    p_write_file               =   i_write_file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   FORMATTING_ERROR           = 1&lt;/P&gt;&lt;P&gt;   INTERNAL_ERROR             = 2&lt;/P&gt;&lt;P&gt;   SEND_ERROR                 = 3&lt;/P&gt;&lt;P&gt;   USER_CANCELED              = 4&lt;/P&gt;&lt;P&gt;   OTHERS                     = 5&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Transferring the data into an internal table &lt;/P&gt;&lt;P&gt;I_OTFDATA[] = STRUC_JOB_OUTPUT_INFO-OTFDATA[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 2:  Creation of the document to be sent .Populate the exporting structure doc_chng with the text containing the name of the document and the calculated document size and also populate the table objtxt .&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  doc_chng-obj_name = text-001.  "'ACCOUNT_STATEMENT'.&lt;/P&gt;&lt;P&gt;  doc_chng-obj_descr = text-001.  "'ACCOUNT_STATEMENT'.&lt;/P&gt;&lt;P&gt;  objtxt = text-001.  "'ACCOUNT_STATEMENT'.&lt;/P&gt;&lt;P&gt;  APPEND objtxt.&lt;/P&gt;&lt;P&gt;  CLEAR objtxt.&lt;/P&gt;&lt;P&gt;  APPEND objtxt.&lt;/P&gt;&lt;P&gt;  APPEND objtxt.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE objtxt LINES tab_lines.&lt;/P&gt;&lt;P&gt;  READ TABLE objtxt INDEX tab_lines.&lt;/P&gt;&lt;P&gt;  doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 3: Creation of the entry for the compressed document by populating the table objpack.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  CLEAR objpack-transf_bin.&lt;/P&gt;&lt;P&gt;  objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-head_num = 0.&lt;/P&gt;&lt;P&gt;  objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-body_num = tab_lines.&lt;/P&gt;&lt;P&gt;  objpack-doc_type = c_raw.&lt;/P&gt;&lt;P&gt;  APPEND objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 4: Converting the form to PDF format by passing the table in OTF format and storing the returned value in PDF format.&lt;/P&gt;&lt;P&gt;Sample Code &lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'CONVERT_OTF_2_PDF'&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            bin_filesize           = l_numbytes&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            otf                    = i_otfdata&lt;/P&gt;&lt;P&gt;            doctab_archive         = doctab&lt;/P&gt;&lt;P&gt;            lines                  = i_pdf&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            err_conv_not_possible  = 1&lt;/P&gt;&lt;P&gt;            err_otf_mc_noendmarker = 2&lt;/P&gt;&lt;P&gt;            OTHERS                 = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 5: Creation of the document to be attached and storing it in the table objbin to be later on passed on, in the function module. &lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  LOOP AT i_pdf.&lt;/P&gt;&lt;P&gt;    CLEAR l_str.&lt;/P&gt;&lt;P&gt;    l_str+0(2) = i_pdf-tdformat.&lt;/P&gt;&lt;P&gt;    l_str+2(132) = i_pdf-tdline.&lt;/P&gt;&lt;P&gt;    v2 = v1 + c_134.&lt;/P&gt;&lt;P&gt;    IF v2 LE c_255.&lt;/P&gt;&lt;P&gt;      objbin-line+v1(c_134) = l_str.&lt;/P&gt;&lt;P&gt;      v1 = v2.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      v3 = v2 - c_255.&lt;/P&gt;&lt;P&gt;      v2 = c_255 - v1.&lt;/P&gt;&lt;P&gt;      IF NOT v2 IS INITIAL.&lt;/P&gt;&lt;P&gt;        objbin-line&lt;EM&gt;v1(v2) = l_str&lt;/EM&gt;0(v2).&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;      APPEND objbin.&lt;/P&gt;&lt;P&gt;      CLEAR objbin.&lt;/P&gt;&lt;P&gt;      v1 = v3.&lt;/P&gt;&lt;P&gt;      v3 = 134 - v1.&lt;/P&gt;&lt;P&gt;      IF NOT v1 IS INITIAL.&lt;/P&gt;&lt;P&gt;        objbin-line&lt;EM&gt;0(v1) = l_str&lt;/EM&gt;v3(v1).&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  APPEND objbin.&lt;/P&gt;&lt;P&gt;  CLEAR objbin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE objbin LINES tab_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 6: Populating the table objhead to be later on passed in the function module.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  Describe table objbin lines tab_lines.&lt;/P&gt;&lt;P&gt;  objhead = text-001.  "'Account Statement'.&lt;/P&gt;&lt;P&gt;  APPEND objhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 7: Creation of the entry for the compressed attachment&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;  objpack-transf_bin = c_x.&lt;/P&gt;&lt;P&gt;  objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-head_num = 1.&lt;/P&gt;&lt;P&gt;  objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;  objpack-body_num = tab_lines.&lt;/P&gt;&lt;P&gt;  objpack-doc_type = c_pdf.&lt;/P&gt;&lt;P&gt;  objpack-obj_name = text-001.  "''&lt;/P&gt;&lt;P&gt;  objpack-obj_descr = text-001.  "''&lt;/P&gt;&lt;P&gt;  objpack-doc_size = tab_lines * 255.&lt;/P&gt;&lt;P&gt;  APPEND objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 8:  Populating the recipient internet addresses where mails are to be sent in the table reclist to be passed on the function module.&lt;/P&gt;&lt;P&gt;Sample Code&lt;/P&gt;&lt;P&gt;   IF NOT i_reclist[] is initial.&lt;/P&gt;&lt;P&gt;    SELECT  addrnumber&lt;/P&gt;&lt;P&gt;            smtp_addr&lt;/P&gt;&lt;P&gt;    INTO TABLE i_reclist&lt;/P&gt;&lt;P&gt;    FROM adr6&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN i_adrc&lt;/P&gt;&lt;P&gt;    WHERE addrnumber = i_adrc-addrnumber.&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    LOOP AT i_reclist.&lt;/P&gt;&lt;P&gt;    reclist-receiver = i_reclist-smtp_addr.&lt;/P&gt;&lt;P&gt;    reclist-rec_type = c_u.&lt;/P&gt;&lt;P&gt;    APPEND reclist.&lt;/P&gt;&lt;P&gt;    CLEAR  reclist.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 9:  CALL FUNCTION 'SO_DOCUMENT_SEND_API1' and pass the already populated structures and tables. The sender address type is u2018INTu2019 and the sender address can be left as default blank.This will mail the contents of OBJBIN (PDF file containing the smartform output) to the recipient internet addresses stored in the table reclist.&lt;/P&gt;&lt;P&gt;       Sample Code&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;            document_data              = doc_chng&lt;/P&gt;&lt;P&gt;            put_in_outbox              = c_x&lt;/P&gt;&lt;P&gt;            sender_address             = l_sender&lt;/P&gt;&lt;P&gt;            sender_address_type        = c_int&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            packing_list               = objpack&lt;/P&gt;&lt;P&gt;            object_header              = objhead&lt;/P&gt;&lt;P&gt;            contents_bin               = objbin&lt;/P&gt;&lt;P&gt;            contents_txt               = objtxt&lt;/P&gt;&lt;P&gt;            receivers                  = reclist&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            too_many_receivers         = 1&lt;/P&gt;&lt;P&gt;            document_not_sent          = 2&lt;/P&gt;&lt;P&gt;            document_type_not_exist    = 3&lt;/P&gt;&lt;P&gt;            operation_no_authorization = 4&lt;/P&gt;&lt;P&gt;            parameter_error            = 5&lt;/P&gt;&lt;P&gt;            x_error                    = 6&lt;/P&gt;&lt;P&gt;            enqueue_error              = 7&lt;/P&gt;&lt;P&gt;            OTHERS                     = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2008 09:34:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/smartform/m-p/3899954#M935866</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-06T09:34:10Z</dc:date>
    </item>
  </channel>
</rss>

