OTF attachment in IW21

Hi Experts,
I am getting an OTF attachment to SAP inbox while executing IW21 Tcode.Is this a smartform or SAP Script?
Can I make any changes in its display?I want to send a mail along with this modified OTF format.I have written code for triggering mail using BAdi.But was unable to find this OTF form.
Can any one help me in finding this form and making necessary display changes to send it to as an attachment to the users?
Regards,
Sam

Hi K.K,
Thanx for ur inputs.
I tried above method.Eventhough I was unable to open the pdf attachment in mail.
Following is my code
Data:it_otfdata            TYPE STANDARD TABLE OF itcoo,
wa_otfdata            LIKE LINE OF  it_otfdata,
V_PDF_XSTRING    TYPE        XSTRING.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format                = 'PDF'
max_linewidth         = 132
IMPORTING
bin_filesize          = bin_filesize
TABLES
otf                   = it_otfdata
lines                 = it_lines132
EXCEPTIONS
err_max_linewidth     = 1
err_format            = 2
err_conv_not_possible = 3
err_bad_otf           = 4
OTHERS                = 5.
Later I used following functions also
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
      TABLES
        content_in                  = it_lines132
        content_out                 = it_lines255
      EXCEPTIONS
        err_line_width_src_too_long = 1
        err_line_width_dst_too_long = 2
        err_conv_failed             = 3
        OTHERS                      = 4.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        BUFFER     = V_PDF_XSTRING
        TABLES
        BINARY_TAB = it_otfdata.
But I am getting error message:Acrobat could not open pdf because it is either not a supported file type or because the file has been corrupted.
I am using following steps to send attachment through mail
document = cl_document_bcs=>create_document(
                      i_type    = 'PDF'
                      i_hex     = pdf_content
                      i_text    = text
                      i_length  = '12'
                     i_subject = 'Subject').
CALL METHOD send_request->edit(
          i_hide_note     = 'X'
          i_starting_at_x = 12
          i_starting_at_y = 5
          i_ending_at_x   = 97
          i_ending_at_y   = 22 ).
call method send_request->send.
Regards,
Sam
Edited by: sam24 on Sep 5, 2010 2:49 PM

Similar Messages

  • Script send as OTF attachment instead of PDF in email

    Hi,
    I am sending a script as email using the FM:
    CALL FUNCTION 'OPEN_FORM' "in background task
    EXPORTING
    device = 'MAIL'
    form = v_script_name
    language = sy-langu
    mail_sender = wa_persistent_sender
    mail_recipient = wa_persistent_recipient
    options = wa_itcpo
    EXCEPTIONS
    canceled = 1
    device = 2
    form = 3
    options = 4.
    But, the user is getting the attachment as OTF instead of PDF.
    Is there is any settings to be done at system level to achieve this?
    Thanks in advance.
    Regards,
    Arun Mohan

    Thanks Ram,
    Solved the issue.
    OTF and PDF were not defined in SCOT.
    Regards,
    Arun Mohan

  • Smartforms as OTF attachment in SAP inbox

    Hi,
    I need to create a smartform which is directly sent to the SAP inbox of the user as an OTF file.
    Can anyone provide me with the code for this.
    thanks and regards
    Aviroop

    Hi Aviroop
    Check this thread,
    smartform (otf) as pdf and sending as email-attachment
    cheers
    sameer

  • Smartform attachment in IW21

    Hi Experts,
    I am trying to send an email notification to outlook in IW21 using QQMA0014 enhancement.I created a function module and written code in it.Its working fine.Can I attach the smartform which is getting generated in this Tcode to mail ids? How can i get the smartform name in the function module?
    Regards,
    Sam

    Hi Experts,
    how to fetch data from standard tcode using RFC function module?
    Regards,
    Sam

  • Remittance Advice to the vendor via mail

    I have to send the Remittance Advice to the vendor via mail.
    I have configured a copy of the FM SAMPLE_PROCESS_00002040 with the business transaction event 2040 . The mail is successfully sent to the vendor as (OTF) attachment, but it want to send it as (PDF) format.
    Can anyone help me in this?
    Regards
    Shahid Rais

    It's there; it just may not be the same menu path or set of keystrokes.  Your email node in SCOT may also be named differently in SAPConnect.  Sorry, we've been off 4.6C for 1.5 years - can't remember the exact location in that version but it's the same principle.  Your SAPConnect config is set to perform no conversion whereas you need to set it to convert OTF to PDF automatically.

  • Payment advice notification mailer

    Hi SAP gurus,
    We are sending out a mail to the vendors as and when their payments are getting processed through F110.
    We are sending out an attachment with the mail. The attachment is an OTF attachment.
    The problem is that we want to send a PDF attachment and not an OTF attachment.
    Can anyone suggest how to aheive this?

    Would someone be willing to give me a quick rundown of what Workflow Mailer is and what it's purpose is?  I have been trying to go through the manual for it but the reading is getting very tedious for something that seems like it should be simple.
    Is it possible to send the email from my process to the workflow email and have it forwarded to wherever the mailer sends to?
    Any thoughts, ideas, comments are welcome.

  • Smartform to OTF to PDF attached to an email ERROR

    Hi everyone... I have this problem... I need to send a smartform attached to an email... I'm doing the following:
    - Create the OTF using the smartform function importing job_output_info.
    - Convert the OTF (job_output_info-otfdata) to PDF using CONVERT_OTF_2_PDF.
    - Change the table line's width using SX_TABLE_LINE_WIDTH_CHANGE.
    - Send the email using SO_NEW_DOCUMENT_ATT_SEND_API1.
    Everything seems to be OK. But When I check the PDF file attached in the email and open it, everything there is a mess. The letters are superimposed over each other and the grills are not painted (instead it shows a black block).
    Any ideas how to solve this???
    Thanks a lot!!!

    Try this out..!
    <removed by moderator>
    To convert the script out put to PDF.
    CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF' u201C FOR out put format
          max_linewidth         = 132 u201CFor ASCII format: Number of lines in LINES-TDLINE
        IMPORTING
          bin_filesize          = gv_bin_filesize u201CFile size reference
        TABLES
          otf                   = gt_otf u201CInput table with OTF format
          lines                 = gt_pdf_tab " Output table with target format
    To mail Order in PDF format:
    Data declaration part :
    DATA: gt_reclist TYPE TABLE OF somlreci1, " SAPoffice: Structure of the API Recipient List
           gt_pdf_tab TYPE TABLE OF tline, " SAPscript: Text Lines
           gt_otf TYPE TABLE OF itcoo, " OTF Structure
           gt_objbin TYPE TABLE OF solisti1, " SAPoffice: Single List with Column Length 255
           gt_objpack TYPE TABLE OF sopcklsti1. " SAPoffice: Description of Imported Object Components
    DATA: gv_form_name TYPE rs38l_fnam, " Used to store the function module generated by Smartform
    gv_bin_filesize TYPE i, " Store the file size
    gv_pos TYPE i,
    gv_len TYPE i,
    gv_tab_lines TYPE i.
    DATA : gc_text(11) TYPE c VALUE 'Form Output',
    gc_tst(3) TYPE c VALUE 'TST',
    gc_testing(30) TYPE c VALUE 'Zellar Sales Document'.
    1. Assigning the Description of the object sent in the mail
      CLEAR gs_docdata.
      gs_docdata-obj_name = gc_tst.
      gs_docdata-obj_descr = gc_testing.
    Assigning the email id to Structure of the API Recipient List table
      CLEAR : gt_reclist, gs_reclist. u201C variables used
      gs_reclist-receiver = mail address'. u201CTo whom this mail should go
      GS_RECLIST-REC_TYPE = 'U'.
      APPEND gs_reclist TO gt_reclist. u201C Internal table for storing mail address
    2.Passing the Smart form  text lines to SAP office: Single List with Column Length 255 table ,this logic is used to get all the data into PDF file while you send an attachment through mail..
    CLEAR: gs_objbin, gs_pdf_tab.
      LOOP AT gt_pdf_tab INTO gs_pdf_tab. u201CLoop the content of PDF table
        gv_pos = 255 - gv_len.
        IF gv_pos > 134. "length of pdf_table
          gv_pos = 134.
        ENDIF.
        gs_objbin+gv_len = gs_pdf_tab(gv_pos).
        gv_len = gv_len + gv_pos.
        IF gv_len = 255. "length of out (contents_bin)
          APPEND gs_objbin TO gt_objbin.
          CLEAR: gs_objbin, gv_len.
          IF gv_pos < 134.
            gs_objbin = gs_pdf_tab+gv_pos.
            gv_len = 134 - gv_pos.
          ENDIF.
        ENDIF.
      ENDLOOP.
      IF gv_len > 0.
        APPEND gs_objbin TO gt_objbin. u201CTable contains Single List with Column Length 255 table
      ENDIF.
    3. Filling the details in SAPoffice: Description of Imported Object Components table
    DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
      CLEAR gs_objbin.
      READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
      IF sy-subrc = 0.
        gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( gs_objbin ).
        gs_objpack-transf_bin = 'X'.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_tab_lines.
        gs_objpack-doc_type = 'PDF'.
        gs_objpack-obj_name = 'ATTACHMENT'.
        gs_objpack-obj_descr = 'test'.
        APPEND gs_objpack TO gt_objpack.
      ENDIF.
    4. Sending the Form Output in the PDF format to email
    data: WK_OBJHEAD TYPE SOLI_TAB.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' u201Cfunction module used for sending mail
        EXPORTING
          document_data              = gs_docdata u201CAttributes of new document
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = gt_objpack u201CInformation about structure of data tables
          OBJECT_HEADER              = WK_OBJHEAD u201CHeader data for document (spec.header)
          contents_bin               = gt_objbin   u201CData which is to be sent as pdf attachment
          receivers                  = gt_reclist  u201Cmailing list
        EXCEPTIONS                                 u201CException Handling
          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.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        WRITE 'Sent Successfully'.
      ENDIF.
    Edited by: Thomas Zloch on Jul 16, 2010 10:38 PM

  • Enable 'Attachment List' in IW21/22/23 - Notification

    Hi All,
    I am trying to enable the link 'Attachment List' from 'Services for Object' in transaction codes: IW21/IW22/IW23. After clicking on this link, i need to display all the email attachment available to the particular notification in the popup which will appear on the screen. I want to enable below marked link.
    Can anyone suggest how to achieve this..
    Thanks,
    Ketan

    Hi Ketan,
    It looks to me an issue with missing authorization.
    Refer SAP note below for required objects to have them enabled
    491271 - Authorizations for generic object services
    Hope this helps.
    Regards,
    Deepak Kori

  • Payment advisory mail attachment in OTF format unable to open

    Hi All,
    We have copied the function module from BTE 00002040 and made the changes c_finaa-nacha = '1'. We have also assigned this FM in FIBF transaction.
    After doing all the settings we are able to send the payment advisory note copy to vendor email id.
    But the issue is vendor is receiving the mail with attachment as SAPscrip.OTF (OTF format) and vendor is not able to open this attachment in his mail.
    Please give your valuble suggestions.
    Thanks in advance,
    DSaya

    Refer SAP Notes
    Note 1391851 - Payment advice note by mail in 4.70: Attachment is incorrect
    Note 1033893 - Payt advice note by mail: Introductory text w/ attachment
    Note 1168342 - Payment advice notes by e-mail and PDF with Unicode
    Note 1223264 - Payt advice notes: No optical archiving and no log

  • Smartform (otf) as pdf and sending as email-attachment

    Hello everybody,
    when trying to convert a smartform to pdf and sending it with the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' i get an error when opening the pdf-file. It says ' a non identified Token w62.10 was found' and the pdf is all empty.
    The problem seems to be somewhere between getting the pdf output data from the FM 'convert_otf' and trying to create a bin-object for the attachment.
    Here is the code:
      call function 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
    *            max_linewidth         = 132
           IMPORTING
                bin_filesize          = v_len_in
           TABLES
                otf                   = i_otf
                lines                 = i_tline
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                others                = 4.
    *   Fehlerhandling
      if sy-subrc <> 0.
      endif.
      loop at i_tline.
        translate i_tline using '~'.
        concatenate wa_buffer i_tline into wa_buffer.
      endloop.
      translate wa_buffer using '~'.
      do.
        i_record = wa_buffer.
        append i_record.
        shift wa_buffer left by 255 places.
        if wa_buffer is initial.
          exit.
        endif.
      enddo.
    * Attachment
      refresh:
        i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
      clear wa_objhead.
      i_objbin[] = i_record[].
    ******* Create Message Body
    **** Title and Description
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
    *  wa_doc_chng-doc_size = v_lines_txt * 255.
    **** Main Text
      i_objtxt = 'test with pdf-Attachment!'.
      append i_objtxt.
      describe table i_objtxt lines v_lines_txt.
      read table i_objtxt index v_lines_txt.
      wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt ).
      clear i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      append i_objpack.
    **** Attachment
    * (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
    * Länge des Attachment ermitteln
      describe table i_objbin lines v_lines_bin.
      read table i_objbin index v_lines_bin.
      i_objpack-doc_size = ( v_lines_bin - 1 ) * 255 + strlen( i_objbin ).
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      append i_objpack.
      clear i_reclist.
      i_reclist-receiver = receiver.
      i_reclist-rec_type = RECEIVER_TYPE.
      append i_reclist.
      if not receiver is initial.
        call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  document_data              = wa_doc_chng
                  put_in_outbox              = 'X'
             TABLES
                  packing_list               = i_objpack
                  object_header              = wa_objhead
                  CONTENTS_BIN               = i_objbin
                  contents_txt               = i_objtxt
                  receivers                  = i_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.

    Hi,
    I just observed the following.
    call function 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
    max_linewidth = 132 IMPORTING
    bin_filesize = v_len_in
    TABLES
    otf = i_otf
    lines = i_tline
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    others = 4.
    i_objtxt = 'test with pdf-Attachment!'.
    append i_objtxt.
    describe table i_objtxt lines v_lines_txt.
    read table i_objtxt index v_lines_txt.
    wa_doc_chng-obj_name = 'smartform'.
    wa_doc_chng-expiry_dat = sy-datum + 10.
    wa_doc_chng-obj_descr = 'smartform'.
    wa_doc_chng-sensitivty = 'F'.
    wa_doc_chng-doc_size = v_lines_txt * 255.
      clear i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      append i_objpack.
    Attachment
    (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
    Länge des Attachment ermitteln
      describe table i_objbin lines v_lines_bin.
      read table i_objbin index v_lines_bin.
    i_objpack-doc_size = v_lines_bin * 255 .
    I just tried with your coding and then changed to the below coding.Now I am able to open the PDF in mail.
    * Internal Table declarations
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          i_tline TYPE TABLE OF tline WITH HEADER LINE,
          i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
          i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    * Objects to send mail.
          i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
          i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    * Work Area declarations
          wa_objhead TYPE soli_tab,
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,
          wa_doc_chng typE sodocchgi1,
          w_data TYPE sodocchgi1,
          wa_buffer TYPE string,"To convert from 132 to 255
    * Variables declarations
          v_form_name TYPE rs38l_fnam,
          v_len_in LIKE sood-objlen,
          v_len_out LIKE sood-objlen,
          v_len_outn TYPE i,
          v_lines_txt TYPE i,
          v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
         exporting
              formname           = 'ZZZ_TEST1'
         importing
              fm_name            = v_form_name
         exceptions
              no_form            = 1
              no_function_module = 2
              others             = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
         EXPORTING
              control_parameters = w_ctrlop
              output_options     = w_compop
              user_settings      = 'X'
         IMPORTING
              job_output_info    = w_return
         EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 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.
    i_otf[] = w_return-otfdata[].
    call function 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = v_len_in
           TABLES
                otf                   = i_otf
                lines                 = i_tline
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                others                = 4.
    *   Fehlerhandling
      if sy-subrc <> 0.
      endif.
      loop at i_tline.
        translate i_tline using '~'.
        concatenate wa_buffer i_tline into wa_buffer.
      endloop.
      translate wa_buffer using '~'.
      do.
        i_record = wa_buffer.
        append i_record.
        shift wa_buffer left by 255 places.
        if wa_buffer is initial.
          exit.
        endif.
      enddo.
    * Attachment
      refresh:
        i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
      clear wa_objhead.
      i_objbin[] = i_record[].
    ******* Create Message Body
    **** Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      append i_objtxt.
      describe table i_objtxt lines v_lines_txt.
      read table i_objtxt index v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    **** Main Text
    *  wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
      clear i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      append i_objpack.
    **** Attachment
    * (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
    * Länge des Attachment ermitteln
      describe table i_objbin lines v_lines_bin.
      read table i_objbin index v_lines_bin.
      i_objpack-doc_size =  v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      append i_objpack.
      clear i_reclist.
      i_reclist-receiver = '[email protected]'.
      i_reclist-rec_type = 'U'.
      append i_reclist.
        call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  document_data              = wa_doc_chng
                  put_in_outbox              = 'X'
             TABLES
                  packing_list               = i_objpack
                  object_header              = wa_objhead
                  CONTENTS_BIN               = i_objbin
                  contents_txt               = i_objtxt
                  receivers                  = i_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 your problem is solved,kindly close the thread and reward points.If you need clarifications,get back.

  • Retrieve mail pdf attachment in xstrinf or otf format.

    Hi,
    as in the Subjesct I must retrieve from mail the attachments that are in pdf format and convert then in xstring or otf format, then archive the documents in DMS server.
    It's possible?
    Thanks for answers.

    Hi,
    In SAP we execute function SX_OBJECT_CONVERT_OTF_PDF which generates binary context for a PDF document.
    Or check the below code
    data: l_pdf_xstring  type xstring,
            lt_lines       type table of tline,
            ls_line        type tline,
            l_pdf_len      type i,
            itab           type TSFOTF,
            witab          type ITCOO,
            tmp_line       type STRING,
            tmp_header     type STRING.
      tmp_header = 'BSP to PDF'.
      tmp_line = file_content.
      CONCATENATE
        tmp_header
        tmp_line
      INTO tmp_line IN CHARACTER MODE.
      APPEND tmp_line TO itab.
      call function 'CONVERT_OTF'
           exporting
             format                      = 'PDF'
           importing
             bin_filesize                = l_pdf_len
             bin_file                    = l_pdf_xstring
          tables
             otf                         = itab
             lines                       = lt_lines
           exceptions
             err_max_linewidth           = 1
             err_format                  = 2
             err_conv_not_possible       = 3
             err_bad_otf                 = 4
             others                      = 5
      if sy-subrc EQ 0.
        response->set_header_field( name  = 'content-type'
                                    value = 'application/pdf' ).
        response->set_header_field(
                           name  = 'cache-control'
                           value = 'max-age=0' ).
          response->set_header_field(
                             name  = 'content-disposition'
                             value = 'attachment; filename=test.pdf' ).
        l_pdf_len = xstrlen( l_pdf_xstring ).
        response->set_data( data   = l_pdf_xstring
                            length = l_pdf_len ).
        navigation->response_complete( ).
      ENDIF.
    Edited by: Raj on Jul 26, 2010 2:02 PM

  • Problem in recieving OTF files as an attachement

    hi Gurus ,
    we have a smart form which generates the payroll of the employee and sends it as an attachement .
    The problem is the document class of the PDF generated are of OTF format .
    when the mail reaches the user , only the message is displayed but the attachement is not avaialble
    where as we have report generating tax to the imployees which belongs to document class RAW ,
    when this mail reaches both the attachement and the message is displayed .
    is that we do any configuration in SMTP node ?
    help me sort this out

    Hi change the below sample as per your requirement.
    <unreadable code removed by moderator>
    Regards
    chitra
    Moderator message: please post only relevant code parts, your posts must contain less than 5000 characters to preserve readable formatting.
    Edited by: Thomas Zloch on Nov 15, 2011 1:03 PM

  • Error while opening a pdf file sent as an attachment in mail

    Dear All,
            We have converted a alv grid into pdf and sent a mail with the attached pdf file. When the attachment is opened in the received mail we get an error " File does not begin with %pdf-". I am pasting the code.
    Select single
      from
        TSP01
      where
        RQIDENT = wa_listident.
      if sy-subrc <> 0.
         exit.
      endif.
      client = tsp01-rqclient.
      name   = tsp01-rqo1name.
    *BREAK-POINT.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
             EXPORTING
                  AUTHORITY     = 'SP01'
                  CLIENT        = client
                  NAME          = name
                  PART          = 1
             IMPORTING
              CHARCO        =
              CREATER       =
              CREDATE       =
              DELDATE       =
              MAX_CREDATE   =
              MAX_DELDATE   =
              NON_UNIQ      =
              NOOF_PARTS    =
              RECTYP        =
              SIZE          =
              STOTYP        =
                  TYPE          = type
                  OBJTYPE       = objtype
             EXCEPTIONS
                  FB_ERROR      = 1
                  FB_RSTS_OTHER = 2
                  NO_OBJECT     = 3
                  NO_PERMISSION = 4.
      if objtype(3) = 'OTF'.
        is_otf = 'X'.
      else.
        is_otf = space.
      endif.
    *BREAK-POINT.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
             EXPORTING
                  rqident              = wa_listident
                  desired_type         = desired_type
             IMPORTING
                  real_type            = real_type
             TABLES
                  buffer               = l_objcont
             EXCEPTIONS
                  no_such_job          = 14
                  type_no_match        = 94
                  job_contains_no_data = 54
                  no_permission        = 21
                  can_not_access       = 21
                  read_error           = 54.
        IF sy-subrc EQ 0.
          attach_type = real_type.
        ENDIF.
    if is_otf = 'X'.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = wa_listident
              NO_DIALOG                      = c_no
          DST_DEVICE                     =
          PDF_DESTINATION                =
            IMPORTING
              PDF_BYTECOUNT                  =  gd_bytecount
              PDF_SPOOLID                    = pdfspoolid
          OTF_PAGECOUNT                  =
              BTC_JOBNAME                    = jobname
              BTC_JOBCOUNT                   = jobcount
            TABLES
              PDF                            = it_pdf_output
            EXCEPTIONS
              ERR_NO_OTF_SPOOLJOB            = 1
              ERR_NO_SPOOLJOB                = 2
              ERR_NO_PERMISSION              = 3
              ERR_CONV_NOT_POSSIBLE          = 4
              ERR_BAD_DSTDEVICE              = 5
              USER_CANCELLED                 = 6
              ERR_SPOOLERROR                 = 7
              ERR_TEMSEERROR                 = 8
              ERR_BTCJOB_OPEN_FAILED         = 9
              ERR_BTCJOB_SUBMIT_FAILED       = 10
              ERR_BTCJOB_CLOSE_FAILED        = 11
      CHECK sy-subrc = 0.
      ENDIF.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    Please guide me to resolve this issue.
    Thanks & Regards,
    Anand

    Hi,
    is the next part of the code correct.
    What i mean is packing of the attachment, finding out the size of pdf file and doc type as PDF.
    You can also try below link..
    Link: [http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
    Hope this helps.
    Regards,
    -Sandeep

  • Error while sendinf pdf file as attachment

    hi all.,
    am trying to send the pdf file of a smartform as attachment thru mail .. but its getting failed am getting error (sy-subrc = 6 ) after calling the fm so_new_document_att_send_api1 .. pls. suggest the possible cause of errors.
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
            IMPORTING
              bin_filesize           = lv_bin_filesize
            TABLES
              otf                    = ls_job_output_info-otfdata
              doctab_archive         = it_docs
              lines                  = it_lines
            EXCEPTIONS
              err_conv_not_possible  = 1
              err_otf_mc_noendmarker = 2
              OTHERS                 = 3.
          IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *--- Get filename to store DYNAMIC
          IF p_lsdir IS NOT INITIAL.
            MOVE p_lsdir  TO lv_path.
          ENDIF.
          CONDENSE wa_kna1-kunnr.
          CONCATENATE 'SOA' wa_kna1-kunnr  '.pdf' INTO lv_name.
          CONCATENATE  lv_path lv_name INTO  lv_fullpath.
          break ibm_prasad.
          CLEAR wa_buffer.
          LOOP AT it_lines.
            TRANSLATE it_lines USING '~'.
            CONCATENATE wa_buffer it_lines INTO wa_buffer.
          ENDLOOP.
          TRANSLATE wa_buffer USING '~'.
          DO.
            i_record = wa_buffer.
            APPEND i_record.
            SHIFT wa_buffer LEFT BY 255 PLACES.
            IF wa_buffer IS INITIAL.
              EXIT.
            ENDIF.
          ENDDO.
          REFRESH: i_reclist,
                   i_objtxt,
                   i_objbin,
                   i_objpack.
          CLEAR wa_objhead.
          i_objbin[] = i_record[].
          i_objtxt = 'SOA test with pdf-Attachment!'.
          APPEND i_objtxt.
          DESCRIBE TABLE i_objtxt LINES v_lines_txt.
          READ TABLE i_objtxt INDEX v_lines_txt.
          wa_doc_chng-obj_name = 'SOA'.
          wa_doc_chng-expiry_dat = sy-datum + 10.
          wa_doc_chng-obj_descr = 'SOA'.
          wa_doc_chng-sensitivty = 'F'.
          wa_doc_chng-doc_size = v_lines_txt * 255.
    *     Maint Text
          CLEAR i_objpack-transf_bin.
          i_objpack-head_start = 1.
          i_objpack-head_num = 0.
          i_objpack-body_start = 1.
          i_objpack-body_num = v_lines_txt.
          i_objpack-doc_type = 'RAW'.
          APPEND i_objpack.
    * Attachment (pdf-Attachment)
          i_objpack-transf_bin = 'X'.
          i_objpack-head_start = 1.
          i_objpack-head_num = 0.
          i_objpack-body_start = 1.
          DESCRIBE TABLE i_objbin LINES v_lines_bin.
          READ TABLE i_objbin INDEX v_lines_bin.
          i_objpack-doc_size = v_lines_bin * 255 .
          i_objpack-body_num = v_lines_bin.
          i_objpack-doc_type = 'PDF'.
          i_objpack-obj_name = 'SOA Eail'.
          i_objpack-obj_descr = 'test'.
          APPEND i_objpack.
          CLEAR i_reclist.
          i_reclist-receiver =  <mail id>
          i_reclist-rec_type = 'U'.
          APPEND i_reclist.
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
            EXPORTING
              document_data              = wa_doc_chng
              put_in_outbox              = 'X'
              commit_work                = 'X'
            TABLES
              packing_list               = i_objpack
              object_header              = wa_objhead
              contents_bin               = i_objbin
              contents_txt               = i_objtxt
              receivers                  = i_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.
    thanks
    suresh

    u need to use this SO_NEW_DOCUMENT_ATT_SEND_API1
    check this code tutorial on how to add pdf file as an attachment
    u need to modify the code to read the pdf from directory then rest of code is same
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/mailsendthroughoutputcontrols
    кu03B1ятu03B9к
    Edited by: kartik tarla on Mar 9, 2009 7:31 PM

  • When sending email PO in a PDF attachment, the attachment can not be openen

    Hi all,
    We are trying to send an email with the PO in PDF format.  We got the email but the attachment can not be opened. 
    Error reads: Adobe could not open test.pdf because  it is either  not a supported file type  or because  the file has been damaged (for example , it was send as a email attachemnet and was not  correctly decoded).
    Could any body bring some light?   We know that everything in SCOT is fine because we can email the PO through configuration to the vendor without problem. It is just these extra copies that do not work.
    a) We are modifying our custom Print program to add the code below after closing the form.
    in few words:
    a) We are getting the OTF from closing the form.
    b) Converting the OTF to PDF
    c) Sending the PDF as attachment.
    data: lt_docs      TYPE TABLE OF docs.
    data: pdf_bytecount TYPE i.
    data: begin of pdfout occurs 0,
       tline type tline,
    end of pdfout.
    Ende Formulardruck --------------------------------------------------*
      CALL FUNCTION 'CLOSE_FORM'
           IMPORTING
                result = result
           tables
                otfdata = otf.
      IF RESULT-TDSPOOLID NE SPACE.
        SPOOLID = RESULT-TDSPOOLID.
        PERFORM PROTOCOL_UPDATE USING '320' SPOOLID SPACE SPACE SPACE.
      ENDIF.
      if result-userexit eq 'C' or
          result-userexit eq 'E'.
        retco = '9'.
      endif.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize           = pdf_bytecount
        TABLES
          otf                    = otf
          doctab_archive         = lt_docs
          lines                  = pdfout
        EXCEPTIONS
          err_conv_not_possible  = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
    Creation of the document to be sent File Name
       maildata-obj_name = 'TEST'.
    Mail Subject
       maildata-obj_descr = 'Subject'.
    Mail Contents
       append mailtxt.
      describe table mailtxt lines tab_lines.
      read table mailtxt index tab_lines.
      maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
    Creation of the entry for the compressed document
      clear mailpack-transf_bin.
      mailpack-head_start = 1.
      mailpack-head_num = 0.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
      mailpack-doc_type = 'RAW'.
      append mailpack.
    Move OTF code to structure SOLI form email
    CLEAR solisti1. REFRESH solisti1.
    LOOP AT otf.
      solisti1-line = otf.
      APPEND solisti1.
    ENDLOOP.
    Move pdf code to structure soli form email
      clear solisti1. refresh solisti1.
      loop at pdfout.
        solisti1-line = pdfout.
        append solisti1.
      endloop.
      loop at solisti1.
         move-corresponding solisti1 to mailbin.
         append mailbin.
      endloop.
      describe table mailbin lines tab_lines.
    mailhead = 'TEST.OTF'.
      mailhead = 'TEST.PDF'.
      append mailhead.
    Creation of the entry for the compressed attachment
      mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 1.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
    mailpack-doc_type = 'OTF'.
      mailpack-doc_type = 'PDF'.
      mailpack-obj_name = 'TEST'.
      mailpack-obj_descr = 'Subject'.
      mailpack-doc_size = tab_lines * 255.
      append mailpack.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type = 'U'.
      append mailrec.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type = 'U'.
      append mailrec.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
              EXPORTING
                   DOCUMENT_DATA              = maildata
              TABLES
                   PACKING_LIST               = mailpack
                   OBJECT_HEADER              = mailhead
                   CONTENTS_TXT               = mailtxt
                   RECEIVERS                  = mailrec
              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.
    ENDFORM.

    Dear Monica,
      You need to configure the system with respect to functional point of view and need to write the following code in print program. i have done this and solution is as follows.
    <b>  Reward me for this solution.</b>
    Process 11 (MM)     Sending RFQs and POs to vendors directly from the system instead of sending thru Courier or Fax     
    Existing Process (AS-IS)     Presently system is not supporting this requirement
    Business Requirements     RFQ’s to be linked with vendor master with e-mail to send enquiries directly through system instead of courier/fax. Vice versa P.O’s.  Specifications, drawings should also go to vendor along with mail.
    To-Be     
    Configuration Settings:                  
    1) Spro – Materials management – Purchasing – Messages – Output control – Message types – Define message types for RFQ/ PO
    •     Created ZEK1,ZMI and ZEK2 for RFQs
    •     Created ZIK,ZOC,ZOK,ZOM,ZSI, ZSK2 and ZSM for Pos
    •     The above New output types Included with existing Print Forms and Programs but modified with External send(5) medium, and added company’s letter head thru ABAP developments (details provided below)
    •     The above new output types also maintained for Fine- tuned control (thru same navigation) for New(1) and Change(2) operations
          2) Spro – Materials management – Purchasing – Messages – Output control – Message   determination schemas – Define message schema for RFQ/ PO
    •     Maintained the new output types in the control data
    3)     Maintain Condition records for the New out put types (copied same document types from the existing old output types)
    Easy access – Logistics – Materials management – Purchasing – Master data – Messages – MN01 (for RFQs)/ MN04 (for Pos)
    4)     Maintain Email id of Vendor in Vendor master.
    Developments (ABAP):
    1)  Copied the existing print programs and forms of the corresponding out types.
    2) Addition of header window in each corresponding form (HEADER window). Uploaded the HEADER3 graphics in the header window.
    INCLUDE HEADER3 OBJECT GRAPHICS ID BCOL LANGUAGE EN
    3) Added the the following code in TOP includes
                       TYPE-POOLs szadr.
               INCLUDE:  LMEDRUCKF09.
    data: intnast         LIKE snast,
          lvs_recipient   LIKE swotobjid,       "Internet
          lvs_sender      LIKE swotobjid,       "Internet
          lvs_comm_type   TYPE ad_comm,
          lvs_comm_values TYPE szadr_comm_values,
          p_retco         TYPE i.
    5)     Addition of the perform to SOS include for header window display
           PERFORM WRITE_FORM_HEADER.
    *&      Form  WRITE_FORM_HEADER
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_FORM_HEADER.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
       ELEMENT                        = 'HE1'
       FUNCTION                       = 'SET'
       TYPE                           = 'BODY'
       WINDOW                         = 'HEADER'
    IMPORTING
       PENDING_LINES                  =
    EXCEPTIONS
       ELEMENT                        = 1
       FUNCTION                       = 2
       TYPE                           = 3
       UNOPENED                       = 4
       UNSTARTED                      = 5
       WINDOW                         = 6
       BAD_PAGEFORMAT_FOR_PRINT       = 7
       SPOOL_ERROR                    = 8
       CODEPAGE                       = 9
       OTHERS                         = 10
    ENDFORM.
    6)     In the corresponding FORM include the following code has been added.
    DATA:  lvs_comm_type     TYPE   ad_comm,
            lvs_comm_values   TYPE   szadr_comm_values,
            xprogramm         type   sy-repid.
      ... use stratagy to get communication type
          CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
               EXPORTING
                    strategy           = nast-tcode
                    address_number     = lfa1-adrnr
               IMPORTING
                    comm_type          = lvs_comm_type
                    comm_values        = lvs_comm_values
               EXCEPTIONS
                    address_not_exist  = 1
                    person_not_exist   = 2
                    no_comm_type_found = 3
                    internal_error     = 4
                    parameter_error    = 5
                    OTHERS             = 6.
          IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    convert communication data
          MOVE-CORRESPONDING nast TO intnast.
          MOVE sy-repid           TO xprogramm.
    7) By using the function module we can get sender and reciepient mail ids to variables lvs_recipient    lvs_sender
          CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
               EXPORTING
                    pi_comm_type              = lvs_comm_type
                    pi_comm_values            = lvs_comm_values
                    pi_country                = lfa1-land1
                    pi_repid                  = xprogramm
                    pi_snast                  = intnast
               IMPORTING
                    pe_itcpo                  = itcpo
                    pe_device                 = xdevice
                    pe_mail_recipient         = lvs_recipient
                    pe_mail_sender            = lvs_sender
               EXCEPTIONS
                    comm_type_not_supported   = 1
                    recipient_creation_failed = 2
                    sender_creation_failed    = 3
                    OTHERS                    = 4.
          IF sy-subrc <> 0.
          Avoids cancellation with message TD421
            p_retco = '1'.                                           "831984
            PERFORM protocol_update USING '740' space space space space.
          dummy message to make the message appear in the where-used list
            IF 1 = 2.
              MESSAGE S740(me).
            ENDIF.
            EXIT.
          ENDIF.
          IF xdevice = 'MAIL'.                                       "885787
        Check validity of email address to avoid cancellation with TD463
            CALL FUNCTION 'SX_ADDRESS_TO_DEVTYPE'                    "831984
              EXPORTING
                recipient_id            = lvs_recipient
                sender_id               = lvs_sender
              EXCEPTIONS
                err_invalid_route       = 1
                err_system              = 2
                OTHERS                  = 3.
            IF SY-SUBRC <> 0.
              p_retco = '1'.
              PERFORM protocol_update USING '740' space space space space.
           dummy message to make the message appear in the where-used list
              IF 1 = 2.
                MESSAGE S740(me).
              ENDIF.
              EXIT.
            ENDIF.
          ENDIF.
    8)     Attaching the new print program and form in NACE transaction.
    Steps for End user:
    1)     Creating the Purchase Order or RFQ with suitable document type through ME21N or ME41 .
    2)     Executing the transaction ME9F and in selecting the suitable output type.
    3)     Executing the transaction ZSEND_PDOC using INT as input.
    4) With above steps we can able to send purchase order or RFQ to vendor as an attachment through e-mail in PDF format.
    Regards
    Badari

Maybe you are looking for

  • When to open and close database connection

    im trying to connect to a oracle database using servlets when should i open and close the connection it works fine when i do both in the doPost() method but when i tried to open connection in init() methd .. it doesnt seem to work what should i do...

  • Price: Oracle 9i Enterprise second Edi. for Linux Redhat 9

    We are planing to use Oracle 9i Second edition for Linux as our DB for our ecommerce website. Can you please tell me How much that will cost me in USD? Also suggest approprate DB version for Linix Redhat9.

  • POID DIRECTORY ID IN RMPS

    Hi everyone, In a badi in SCASEPS we have a parameter IM_CASE. it has a variable called POID DIRECTORY ID (not visible) In debugging we have a route to see it IM_CASE->CL_RMPS_CASE->IF_RMPS_CASE~~G_GENERATABLES_HANDLER->G_POID->POID_DIRECTORY_ID How

  • Transfering Iphone photos to computer from Adobe Photoshop app

    I cannot get the Adobe Photoshop app to show up in the apps I can transfer files from to my computer

  • Client ap Urgent

    I have a UWN architecture with two controllers 2106 and 1242AG access point. My problem is that when I connect a client ( who is an AP Moxa) is not working properly because users that are connected behind that AP can not connect to the network What I