Send internal table to pdf and then email.

hi experts.
i want to send my alv data or any other data like internal table in pdf through email.
anybody help me out plz.

Hi Harris,
You got to use two FMs to achieve this.
First one to get the contents in to an internal table
Second one to send an e-mail with the content selected already.
So, better search SDN to get more info...

Similar Messages

  • Print to pdf and then email...

    I frequently print a document to pdf and then email it as an attachment.  The print dialog box allows me to save as pdf or email as pdf.  I would like a print plugin that does both actions - allows me to name and save the pdf to a specified location and then adds it as an attachment to a new email.  Any ideas?

    Create a Print Plug in Automator, such as the below, which does exactly as you want. When you set it up, make sure you click the Options that I clicked and this will allow you to name the PDF, and save it wherever you want to.
    I named my Print Plugin "PDF File & Email"

  • Convert internal table to pdf and send the attachment trough bcs method

    Hi everyone , I try to send an pdf attachment trough bcs method but I failed. I use scms_text_to_xstring then use method cl_document_bcs=>xstring_to_solix and then add attachment with the bcs method.
    Thanks in advance.
    Create the attachment
          CLASS cl_abap_char_utilities DEFINITION LOAD.
          CONCATENATE 'PO' 'PO Line'
                      INTO lw_attachment SEPARATED BY
                      cl_abap_char_utilities=>horizontal_tab.
          APPEND lw_attachment TO lt_attachment.
          CLEAR lw_attachment.
          LOOP AT lt_po_data_cons INTO lw_po_data_cons.
            CONCATENATE lw_po_data_cons-bukrs lw_po_data_cons-ename lw_po_data_cons-usrid_long
                        INTO lw_attachment.
                        SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
            CONCATENATE cl_abap_char_utilities=>newline lw_attachment
                        INTO lw_attachment.
            APPEND lw_attachment TO lt_attachment.
          ENDLOOP.
          CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
             EXPORTING
              MIMETYPE         = 'text/bin'
            IMPORTING
              buffer           = buf2
            TABLES
              text_tab         = lt_attachment.
          l_i_attachment = cl_document_bcs=>xstring_to_solix( ip_xstring = buf2 ).
          l_o_document->add_attachment(
          i_attachment_type = 'PDF' " add PDF attachment
          i_attachment_subject = 'PDF attachment'
          i_att_content_hex = l_i_attachment
          l_o_send_request->set_document( l_o_document ).
          l_v_ret = l_o_send_request->send( ).

    Hi,
    You can send the PDF using OOPS abap classes and methods
    for sending it in mail .
    Regards
    Mansi

  • Generating a PDF and then Email it from the report server.....

    All,
    This is my first post on this forum and I have the following question.....
    Please note I am not a DB expert nor a reporting expert but I have done my fair share of reporting using Oracle DB with Oracle Reports or Hyperion.
    I have a report that will be posted to the report server that a user can go out and run at there convenience.
    As a side note we have recently migrated our Database from ORACLE 8i to 10G and the report was created using Oracle ReportBuilder 10.1.
    This report was also mimicked by a Oracle package and emailed out through I believe some PL SQL(?). This is a plain text report in the email.
    As I recently did some big changes to the Original report they want this email report to match as well.
    Well After looking at what they want in the email its basically the exact same thing as the version the user would see on the web. This seems like a waste of time for myself to edit this Package (For the email report - plaint text) and to have a oracle report available on the web server not to mention the DB dealing with the PLSQL..
    So I am asking is there a way to set up Oracle reports to mail a generated PDF or a HTML results file out from the reporting server at a specified time?
    If so how is this accomplished?
    I see that in the help file in Report Builder that you can set rwbuilder.conf file with the SMTP server but how do I set the email address and the time to run the report.
    Thanks for all the help,
    Chris

    Hello,
    Maybe I am not understanding something but we have a reporting server where they basically select the report in a drop down web control and they fill in the necessary parameters and then the report is ran.
    The web links refer to report builder and how to email from it. I am in a web environment that they select the report and its ran. Is this web form a standard product with Oracle for reporting?
    I have seen how to do accomplish my task from the command line. Is this another way of accomplishing this task?
    I think what I am also looking for is a confirmation that what I want to do is possible and that someone has accomplished this task before.
    Thanks,
    Chris

  • Sap script convert to pdf and then send to email

    Hi,
    good day sap guys
    ive dev the sap scipt for customer statemnet one which is used the t.code is f.27.
    i need to convert the sap script to pdf and then send to email.
    plz let me know..
    how to do it.
    regards
    chandu

    Hi,
       I script program use the following (go to the "call function 'CLOSE_FORM'")
    data: binfilesize type i.
      data: pdftab type table of tline with header line.
      data: i_itcpp like itcpp.
      data: g_t_otfdata type standard table of itcoo with header line.
      call function 'CLOSE_FORM'
       IMPORTING
         RESULT  = i_itcpp
          tables
            otfdata = g_t_otfdata[]
          exceptions
            others  = 1.
      if sy-subrc ne 0.
        retcode = sy-subrc.
        perform protocol_update.
      endif.
      call function 'CONVERT_OTF'
    exporting
    format = 'PDF'
    importing
    bin_filesize = binfilesize
    BIN_FILE =
    tables
    otf = g_t_otfdata[]
    lines = pdftab[].
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    concatenate file_path  '.pdf' into filename.
    call function 'GUI_DOWNLOAD'
      exporting
      bin_filesize = binfilesize
      filename = filename
      filetype = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
      tables
      data_tab = pdftab[]
    FIELDNAMES =
      exceptions
      file_write_error = 1
      no_batch = 2
      gui_refuse_filetransfer = 3
      invalid_type = 4
      no_authority = 5
      unknown_error = 6
      header_not_allowed = 7
      separator_not_allowed = 8
      filesize_not_allowed = 9
      header_too_long = 10
      dp_error_create = 11
      dp_error_send = 12
      dp_error_write = 13
      unknown_dp_error = 14
      access_denied = 15
      dp_out_of_memory = 16
      disk_full = 17
      dp_timeout = 18
      file_not_found = 19
      dataprovider_exception = 20
      control_flush_error = 21
      others = 22
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.

  • How to: Add Internal anchors to a PDF and then link from an external webpage?

    Hi,
    I work in email marketing and create html emails that we send through our own web based system. I am just wondering if it is possible at all to create internal anchors with unique urls that I can then link to from my html email as a hyperlink?
    The client has created the PDF and I am wondering if I can create the anchors and when linking to these anchors from my email, it downloads the file and opens to that specific anchor location?
    Thanks in advance.

    I seem to having a new issue with this task. Thanks to Bernd I have managed to create named destinations within the PDF document. From there I have then created the email and linked the pdf url with the destination tag to open to that location. However what we're finding now is that once the PDF has been downloaded once, if you go back to the email and select another link it opens the PDF in the last viewed state.
    This client has created one PDF containing many different articles. In the email she has created a table of contents and wants to link from each listed article to that destination in the PDF. But once you have clicked on one link, shut down browser, go back to the email and select another link it just opens what you were viewing last. Is this a cache issues? Are we using the named destination method in the correct manner?
    We tried suggesting, linking once to the PDF and then from the PDF creating a table of contents with internal anchors however the client doesn't want this.
    Suggestions?

  • How do i sign a document sent in a email and then email the document back to sender?

    How do a sign a document I received in an email, an then email signed document back to the sender?

    The hard way is to print out the document, sign it, then scan it to a PDF, and finally email it back.
    The easy way is to first scan in your signature.  Then you can open a received document, paste in your signature, and return it via email.
    In my case I made several signatures on a blank sheet of paper, scanned in the sheet, then used Graphic Converter to select the best exemplar and saved it to a separate file as a JPEG image.  When I receive emailed documents requiring a signature I have them sent as PDFs.  I then use a third-party application, PDFPenPro, to edit the PDF and to paste in my signature.  I save the edited PDF and return it via email.

  • I have created a pdf and then want to send it to my boss.  When he recieves it it is saved in the 14 X 8.5 inches version.  How can I saved it on my end as a 11 x 8.5 inch so he doesn't have to uncheck "Choose paper source by PDF page size"?

    I have created a pdf and then want to send it to my boss.  When he recieves it it is saved in the 14 X 8.5 inches version.  How can I saved it on my end as a 11 x 8.5 inch so he doesn't have to uncheck "Choose paper source by PDF page size"?

    Hi heathers,
    You would need to print the file to a new PDF with the appropriate page size.
    Best,
    Sara

  • When I save a pages document as a pdf and then try to email the document, it loads as an application octet-stream dat file instead of a pdf. What's happening?

    When I save a Pages document as a pdf and then try to email the document, it loads as an application octet-stream dat file instead of a pdf and recipients can't open it. Some load correctly, but about half don't load as a pdf. What's happening?

    Hi mjmonck-
    Which email provider are you using? There are different solutions possible for different providers. Yahoo is having trouble with attachments, outside of any Firefox issue. I've seen a Google user fix this by manually adding the mail URL to their ad block program- which mistakenly perceived the webmail page as an advertisement.
    Hope this helps.

  • How to Send Internal table to SAP Spool using Function Modules or Methods?

    Hi Experts,
    How to Send Internal table to SAP Spool using Function Modules or Methods?
    Thanks ,
    Kiran

    This is my code.
    I still get the no ABAP list data for the spool, even tho I can see it sp01?
    REPORT  Z_MAIL_PAYSLIP.
    * Declaration Part *
    tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
    infotypes: 0000, 0001, 0105, 0655.
    data: begin of ITAB occurs 0,
      MTEXT(25) type C,
      PERNR like PA0001-PERNR,
      ABKRS like PA0001-ABKRS,
      ENAME like PA0001-ENAME,
      USRID_LONG like PA0105-USRID_LONG,
    end of ITAB.
    data: W_BEGDA like HRPY_RGDIR-FPBEG,
          W_ENDDA like HRPY_RGDIR-FPEND.
    data: RETURN like BAPIRETURN1 occurs 0 with header line.
    data: P_INFO like PC407,
          P_FORM like PC408 occurs 0 with header line.
    data: P_IDX type I,
          MY_MONTH type T549Q-PABRP,
          STR_MY_MONTH(2) type C,
          MY_YEAR type T549Q-PABRJ,
          STR_MY_YEAR(4) type C,
          CRLF(2) type x value '0D0A'.
    data: W_CMONTH(10) type C.
    data: TAB_LINES type I,
          ATT_TYPE like SOODK-OBJTP.
    data: begin of P_INDEX occurs 0,
            INDEX type I,
    end of P_INDEX.
    constants: begin of F__LTYPE, "type of line
       CMD like PC408-LTYPE value '/:',  "command
       TXT like PC408-LTYPE value 's',   "textline
    end of F__LTYPE.
    constants: begin of F__CMD, "commands
      NEWPAGE like PC408-LINDA value '',
    end of F__CMD.
    data: P_LIST like ABAPLIST occurs 1 with header line.
    *data: OBJBIN like SOLISTI1 occurs 10 with header line,
    data: OBJBIN like  LVC_S_1022 occurs 10 with header line,
          DOCDATA like SODOCCHGI1,
          OBJTXT like SOLISTI1 occurs 10 with header line,
          OBJPACK like SOPCKLSTI1 occurs 1 with header line,
          RECLIST like SOMLRECI1 occurs 1 with header line,
          OBJHEAD like SOLISTI1 occurs 1 with header line,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_buffer type string,
          l_no_of_bytes TYPE i,
          l_pdf_spoolid LIKE tsp01-rqident,
          l_jobname     LIKE tbtcjob-jobname.
    data: file_length  type int4,
          spool_id     type rspoid,
          line_cnt     type i.
    *-------------------------------------------------------------------* * INITIALIZATION *
    OBJBIN = ' | '.
    append OBJBIN.
    OBJPACK-HEAD_START = 1.
    data: S_ABKRS like PV000-ABKRS.
    data: S_PABRP like T549Q-PABRP.
    data: S_PABRJ like T549Q-PABRJ.
    * SELECTION SCREEN                                                  *
    selection-screen begin of block BL1.
    parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
    selection-screen end of block BL1.
    START-OF-SELECTION.
      s_ABKRS = PNPXABKR.
      S_PABRP = PNPPABRP.
      s_pabrj = PNPPABRJ.
      w_begda = PN-BEGDA.
      w_endda = PN-ENDDA.
    get pernr.
    *                                 "Check active employees
      rp-provide-from-last p0000 space pn-begda  pn-endda.
      CHECK P0000-STAT2 IN PNPSTAT2.
    *                                 "Check Payslip Mail flag
      rp-provide-from-last p0655 space pn-begda  pn-endda.
      CHECK P0655-ESSONLY = 'X'.
      rp-provide-from-last p0001 space pn-begda  pn-endda.
    *                                 "Find email address
      RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
      if p0105-usrid_LONG ne ''.
        ITAB-PERNR      = P0001-PERNR.
        ITAB-ABKRS      = P0001-ABKRS.
        ITAB-ENAME      = P0001-ENAME.
        ITAB-USRID_LONG = P0105-USRID_LONG.
        append itab.
        clear itab.
      endif.
      "SY-UCOMM ='ONLI'
    END-OF-SELECTION.
    *------------------------------------------------------------------* start-of-selection.
      write : / 'Payroll Area        : ', S_ABKRS.
      write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
      write : / 'System Time         : ', SY-UZEIT.
      write : / 'User Name           : ', SY-UNAME.
      write : / SY-ULINE.
      sort ITAB by PERNR.
      loop at ITAB.
        clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
        refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
    *                                                  Retrieve Payroll results sequence number for this run
        select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
                                        and FPBEG ge W_BEGDA
                                        and FPEND le W_ENDDA
                                        and SRTZA eq 'A'.
    *                                                  Produce payslip for those payroll results
        if SY-SUBRC = 0.
          call function 'GET_PAYSLIP'
            EXPORTING
              EMPLOYEE_NUMBER = ITAB-PERNR
              SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
              PAYSLIP_VARIANT = PAY_VAR
            IMPORTING
              RETURN          = RETURN
              P_INFO          = P_INFO
            TABLES
              P_FORM          = P_FORM.
          check RETURN is initial.
    *                                                 remove linetype from generated payslip
          loop at p_form.
            objbin = p_form-linda.
            append objbin.
            line_cnt = line_cnt + 1.
          endloop.
          file_length = line_cnt * 1022.
    *                                                 create spool file of paylsip
          CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
            EXPORTING
              i_file_length = file_length
            IMPORTING
              e_spoolid     = spool_id
            TABLES
              it_textdata   = objbin.
          IF sy-subrc EQ 0.
            WRITE spool_id.
          ENDIF.
          DESCRIBE table objbin.
          DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
          CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
            EXPORTING
              SRC_SPOOLID                    = spool_id
              NO_DIALOG                      = ' '
              DST_DEVICE                     = 'MAIL'
    *      PDF_DESTINATION                =
    *    IMPORTING
    *      PDF_BYTECOUNT                  = l_no_of_bytes
    *      PDF_SPOOLID                    = l_pdf_spoolid
    *      LIST_PAGECOUNT                 =
    *      BTC_JOBNAME                    =
    *      BTC_JOBCOUNT                   =
            TABLES
              PDF                            = pdf
            EXCEPTIONS
              ERR_NO_ABAP_SPOOLJOB           = 1
              ERR_NO_SPOOLJOB                = 2
              ERR_NO_PERMISSION              = 3
              ERR_CONV_NOT_POSSIBLE          = 4
              ERR_BAD_DESTDEVICE             = 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
              OTHERS                         = 12
          IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *Download PDF file C Drive
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = 'C:\itab_to_pdf.pdf'
          filetype = 'BIN'
        TABLES
          data_tab = pdf.
    * Transfer the 132-long strings to 255-long strings
    *  LOOP AT pdf.
    *    TRANSLATE pdf USING ' ~'.
    *    CONCATENATE gd_buffer pdf 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.
          OBJHEAD = 'Objhead'.
          append OBJHEAD.
    * preparing email subject
          concatenate W_ENDDA(6)
                    ' Payslip-'
                    ITAB-ENAME+0(28)
                    ITAB-PERNR+4(4) ')'
                 into DOCDATA-OBJ_DESCR.
          DOCDATA-OBJ_NAME = 'Pay Slip'.
          DOCDATA-OBJ_LANGU = SY-LANGU.
          OBJTXT = 'Pay Slip.'.
          append OBJTXT.
    *prepare email lines
          OBJTXT = DOCDATA-OBJ_DESCR.
          append OBJTXT.
          OBJTXT = 'Please find enclosed your current payslip.'.
          append OBJTXT.
    * Write Attachment(Main)
    * 3 has been fixed because OBJTXT has fix three lines
          read table OBJTXT index 3.
    *    DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
          clear OBJPACK-TRANSF_BIN.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = 3.
          OBJPACK-DOC_TYPE = 'RAW'.
          append OBJPACK.
    * Create Message Attachment
          ATT_TYPE = 'PDF'.
          describe table OBJBIN lines TAB_LINES.
          read table OBJBIN index TAB_LINES.
    *    OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
          OBJPACK-TRANSF_BIN = 'X'.
          OBJPACK-HEAD_START = 1.
          OBJPACK-HEAD_NUM = 0.
          OBJPACK-BODY_START = 1.
          OBJPACK-BODY_NUM = TAB_LINES.
          OBJPACK-DOC_TYPE = ATT_TYPE.
          OBJPACK-OBJ_NAME = 'ATTACHMENT'.
          OBJPACK-OBJ_DESCR = 'Payslip'.
          append OBJPACK.
    * Create receiver list refresh RECLIST.
          clear RECLIST.
          RECLIST-RECEIVER = itab-USRID_long.
          translate RECLIST-RECEIVER to lower case.
          RECLIST-REC_TYPE = 'U'.
          append RECLIST.
    * Send the document
    *SO_NEW_DOCUMENT_ATT_SEND_API1
          call function 'SO_DOCUMENT_SEND_API1'
            exporting
              DOCUMENT_DATA = DOCDATA
              PUT_IN_OUTBOX = 'X'
              COMMIT_WORK = 'X'
    * IMPORTING
    *   SENT_TO_ALL =
    *   NEW_OBJECT_ID =
            tables
              PACKING_LIST  = OBJPACK
              OBJECT_HEADER = OBJHEAD
              CONTENTS_BIN  = pdf
              CONTENTS_TXT  = OBJTXT
    *   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 NE 0.
            ITAB-MTEXT = 'Message Not Sent to : '.
          else.
            ITAB-MTEXT = 'Message Sent to : '.
          endif.
    *    else.
    *      ITAB-MTEXT = 'Message Not Sent to : '.
    *    endif.
        else.
          "SY-SUBRC Not = 0
          ITAB-MTEXT = 'Payroll data not found : '.
        endif.
        "end of SY-SUBRC = 0.
        modify ITAB.
      endloop. "end loop at ITAB
      sort ITAB by MTEXT PERNR.
      loop at ITAB.
        at new MTEXT.
          uline.
          write : / ITAB-MTEXT color 4 intensified on.
          write : / 'Emp. Code' color 2 intensified on,
                 12 'Emp. Name' color 2 intensified on,
                 54 'Email ID' color 2 intensified on.
        endat.
        write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
      endloop.

  • Spool no. data to PDF and then to mail

    Hi all ,
    My requirement is i have to display all the spool request no.'s for the particular user and from that user will select the particular spool no. . and that particular data has to convert into PDF and that PDF should go to mail id specified in selection screen.
    now my prob. is when i am downloading the PDF on desktop it is opening with right data and when i am sending to mail id with the same internal table with PDF format , the file is corrupted and giving some error.
    for ur reference here i am sending my code , please check and let me know .
    thanks & regards,
    Anil kumar .
    TABLES: tsp01,
            soextreci1.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-020.
    SELECT-OPTIONS : so_date1     FOR sy-datum OBLIGATORY,
                     so_time1     FOR sy-uzeit,
                     so_name1     FOR sy-uname,
                     so_splno     FOR tsp01-rqident.
                    so_email     FOR soextreci1-receiver OBLIGATORY.
    PARAMETER : so_email TYPE soextreci1-receiver OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    DATA : l_addrnumber TYPE adr7-addrnumber,
           l_persnumber TYPE adr7-persnumber,
           l_mail       TYPE adr6-smtp_addr.
    DATA : BEGIN OF it_tsp01 OCCURS 0,
            rqident   TYPE tsp01-rqident,
            rqowner   TYPE tsp01-rqowner,
            rqcretime TYPE tsp01-rqcretime,
            rqclient  TYPE tsp01-rqclient,
            rqo1name  TYPE tsp01-rqo1name,
           END OF it_tsp01.
    DATA : l_date_low   TYPE char8,
           l_date_high  TYPE char8,
           l_time_low   TYPE char8,
           l_time_high  TYPE char8,
           l_final_low  TYPE char16,
           l_final_high TYPE char16,
           markfield VALUE ' '.
    DATA : BEGIN OF l_final OCCURS 0,
           sig  TYPE c,
           opt  TYPE char2,
           low  TYPE char16,
           high TYPE char16,
           END OF l_final.
    *PARAMETERS:
    spoolno LIKE tsp01-rqident,
    download AS CHECKBOX DEFAULT 'X',
    DATA : p_file TYPE rlgrap-filename VALUE 'C:\temp\file.pdf'."#EC NOTEXT
    DATA otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
    DATA cancel.
    DATA pdf LIKE tline OCCURS 100 WITH HEADER LINE.
    DATA it_pdf LIKE pdf OCCURS 0 WITH HEADER LINE.
    DATA doctab LIKE docs OCCURS 1 WITH HEADER LINE.
    DATA: numbytes TYPE i,
          arc_idx LIKE toa_dara,
          pdfspoolid LIKE tsp01-rqident,
          jobname LIKE tbtcjob-jobname,
          jobcount LIKE tbtcjob-jobcount,
          is_otf.
    DATA: client LIKE tst01-dclient,
          name LIKE tst01-dname,
          objtype LIKE rststype-type,
          type LIKE rststype-type.
    AT SELECTION-SCREEN OUTPUT.
      SELECT SINGLE addrnumber
                   persnumber
            FROM   adr7
            INTO  (l_addrnumber,l_persnumber)
            WHERE  uname = sy-uname.
      SELECT SINGLE smtp_addr
            FROM   adr6
            INTO   l_mail
            WHERE  addrnumber = l_addrnumber
            AND    persnumber = l_persnumber.
      so_date1-sign   = so_name1-sign   = 'I'.  "so_email-sign   = 'I'.
      so_date1-option = so_name1-option = 'BT'. "so_email-option = 'BT'.
      so_date1-low = so_date1-high = sy-datum.
      so_name1-low = so_name1-high = sy-uname.
    so_email-low = so_email-high = l_mail.
      APPEND : so_date1,so_name1.",so_email.
    START-OF-SELECTION.
      IF so_date1-low IS NOT INITIAL.
        l_date_low  = so_date1-low.
      ENDIF.
      IF so_date1-high IS NOT INITIAL.
        l_date_high = so_date1-high.
      ENDIF.
      IF so_time1-low IS NOT INITIAL.
        l_time_low  = so_time1-low.
        l_time_low+6(2)  = '00'.
      ENDIF.
      IF so_time1-high IS NOT INITIAL.
        l_time_high = so_time1-high.
        l_time_high+6(2) = '00'.
      ENDIF.
      IF l_time_low IS NOT INITIAL.
        CONCATENATE l_date_low  l_time_low  INTO l_final_low.
      ELSE.
        CONCATENATE l_date_low  '00000000' INTO l_final_low.
      ENDIF.
      IF l_time_high IS NOT INITIAL .
        IF so_date1-high IS NOT INITIAL.
          CONCATENATE l_date_high l_time_high INTO l_final_high.
        ENDIF.
      ELSE.
        CONCATENATE l_date_low '23595959' INTO l_final_high.
      ENDIF.
      l_final-sig  = so_date1-sign.
      l_final-opt  = so_date1-option.
      l_final-low  = l_final_low.
      l_final-high = l_final_high.
      APPEND l_final.
      CLEAR l_final.
      SELECT rqident
             rqowner
             rqcretime
             rqclient
             rqo1name
             FROM tsp01 INTO TABLE it_tsp01
               WHERE rqcretime IN l_final
               AND   rqowner   IN so_name1.
      IF sy-subrc NE 0.
        MESSAGE 'No data for the entered values' TYPE 'E'.
        EXIT.
      ENDIF.
      CLEAR : so_name1,so_name1[],it_tsp01.
      SORT it_tsp01 BY rqident.
      LOOP AT it_tsp01.
        WRITE : /1 sy-vline,
                 3  markfield AS CHECKBOX,
                 5(16)  it_tsp01-rqident,   22 sy-vline,
                 23(10) it_tsp01-rqowner,   34 sy-vline,
                 35(16) it_tsp01-rqcretime, 52 sy-vline.
        HIDE it_tsp01-rqident.
        AT LAST.
          WRITE : /1(52) sy-uline.
        ENDAT.
      ENDLOOP.
    TOP-OF-PAGE.
      WRITE: /1(52) sy-uline.
      WRITE: /1 sy-vline,
              5(16)   'Spool No.' COLOR COL_POSITIVE CENTERED , 22 sy-vline,
              23(10)   'User'     COLOR COL_POSITIVE CENTERED , 34 sy-vline,
              35(16)   'Date'     COLOR COL_POSITIVE CENTERED , 52 sy-vline.
      WRITE: /1(52) sy-uline.
    END-OF-SELECTION.
      SET PF-STATUS '/BAY4/PDF'.
      DATA : l_rqident TYPE tsp01-rqident,
             l_count   TYPE i VALUE '0'.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'PDF'.
          CLEAR l_count.
          DO.
            CLEAR : markfield.
            READ LINE sy-index FIELD VALUE markfield.
            IF sy-subrc NE 0.
              EXIT.
            ENDIF.
            CHECK markfield NE space.
            IF l_count GT 0.
              MESSAGE 'Please select only one check box' TYPE 'E'.
              EXIT.
            ENDIF.
            l_rqident = it_tsp01-rqident.
            l_count = l_count + 1.
          ENDDO.
          PERFORM get_pdf.
        WHEN 'MAIL'.
          CLEAR l_count.
          DO.
            CLEAR : markfield.
            READ LINE sy-index FIELD VALUE markfield.
            IF sy-subrc NE 0.
              EXIT.
            ENDIF.
            CHECK markfield NE space.
            IF l_count GT 0.
              MESSAGE 'Please select only one check box' TYPE 'E'.
              EXIT.
            ENDIF.
            l_rqident = it_tsp01-rqident.
            l_count = l_count + 1.
          ENDDO.
          PERFORM get_pdf.
          PERFORM send_mail.
      ENDCASE.
    *&      Form  get_pdf
          text
    -->  p1        text
    <--  p2        text
    FORM get_pdf .
      READ TABLE it_tsp01 WITH KEY rqident = l_rqident.
    LOOP AT it_tsp01.
      client = it_tsp01-rqclient.
      name   = it_tsp01-rqo1name.
      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.
      IF is_otf = 'X'.
        CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
            EXPORTING
              src_spoolid                    = l_rqident
              no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
            IMPORTING
              pdf_bytecount                  = numbytes
              pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
              btc_jobname                    = jobname
              btc_jobcount                   = jobcount
            TABLES
              pdf                            = pdf
            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.
      ELSE.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
            EXPORTING
              src_spoolid                    = l_rqident
              no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
            IMPORTING
              pdf_bytecount                  = numbytes
              pdf_spoolid                    = pdfspoolid
          LIST_PAGECOUNT                 =
              btc_jobname                    = jobname
              btc_jobcount                   = jobcount
            TABLES
              pdf                            = pdf
            EXCEPTIONS
              err_no_abap_spooljob           = 1
              err_no_spooljob                = 2
              err_no_permission              = 3
              err_conv_not_possible          = 4
              err_bad_destdevice             = 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.
      ENDIF.
    PERFORM download_w_ext(rstxpdft) TABLES pdf
                                       USING p_file
                                             '.pdf'
                                             'BIN'
                                             numbytes
                                             cancel.
    ENDFORM.                    " get_pdf
    *&      Form  send_mail
          text
    -->  p1        text
    <--  p2        text
    FORM send_mail .
      DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE.
      DATA: it_attach  TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE.
    *DATA: PIT_ATTACH LIKE table of IT_ATTACH.
      DATA: t_packing_list  LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents      LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_receivers     LIKE somlreci1  OCCURS 0 WITH HEADER LINE,
            t_attachment    LIKE solisti1   OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA :  w_cnt         TYPE i,
              w_sent_all(1) TYPE c,
              w_doc_data    LIKE sodocchgi1,
              gd_error      TYPE sy-subrc,
              gd_reciever   TYPE sy-subrc.
      DATA: a TYPE string,
            t TYPE string.
      a = 'FILE.PDF'.
      t_object_header = a .
      APPEND t_object_header.
      DATA: p_email TYPE string.
      CONSTANTS:
         con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
         con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
      LOOP AT pdf.
        TRANSLATE pdf USING ' ~'.
        CONCATENATE pdf-tdformat pdf-tdline INTO it_attach SEPARATED BY space.
        APPEND it_attach.
        CLEAR : it_attach,pdf.
      ENDLOOP.
      DATA: ld_error               TYPE sy-subrc,
            ld_reciever            TYPE sy-subrc,
            ld_mtitle              LIKE sodocchgi1-obj_descr,
            ld_email               LIKE somlreci1-receiver,
            ld_format              TYPE so_obj_tp ,
            ld_attdescription      TYPE so_obj_nam,
            p_attdescription       LIKE ld_attdescription,
            ld_attfilename         TYPE so_obj_des ,
            ld_sender_address      LIKE soextreci1-receiver,
            p_sender_address       LIKE ld_sender_address,
            ld_sender_address_type LIKE soextreci1-adr_typ,
            p_sender_addres_type   LIKE ld_sender_address_type,
            ld_receiver            LIKE sy-subrc.
    RANGES : ld_email FOR somlreci1-receiver OCCURS 0.
    ld_email[]       = so_email[].
    append ld_email.
      ld_email       = so_email.
      ld_mtitle      = 'PDF file for the Spool no'.
      ld_format      = 'pdf'.
      ld_attfilename = 'filename'.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
      ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type = ld_format.
      t_packing_list-obj_descr = ld_attdescription.
      t_packing_list-obj_name = ld_attfilename.
      t_packing_list-doc_size = t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = w_doc_data
          put_in_outbox              = 'X'
          sender_address             = ld_sender_address
          sender_address_type        = ld_sender_address_type
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = w_sent_all
        TABLES
          object_header              = t_object_header
          packing_list               = t_packing_list
          contents_bin               = t_attachment
          contents_txt               = it_message
          receivers                  = t_receivers
        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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
      SUBMIT rsconn01
    WITH mode = 'INT'
      WITH output = 'X'
      AND
      RETURN.
      IF sy-subrc EQ 0.
        MESSAGE 'PDF sent to specified mail id' TYPE 'I'.
        LEAVE SCREEN.
      ENDIF.

    Hi,
    Try this program, it works for me perfectly:
    REPORT  Z_SENDFAX line-size 46 no standard page heading message-id so.
    data g_list_content type solix_tab.
    data g_text_content type soli_tab.
    parameters:spool like sy-spono.
    parameters:rec_fax type sadrfd-rec_fax.
    parameters:title like sadrfd-rec_title.
    parameters:name1 like sadrfd-rec_name1.
    parameters:cover type c.
    PARAMETERS: Zvbeln LIKE likp-vbeln.
    start-of-selection.
      perform create_text_content changing g_text_content.
      perform create_list_content changing g_list_content.
      perform send using g_text_content
                         g_list_content.
    *&      Form  create_list_content
    form create_list_content changing list_content type solix_tab.
      perform get_list_from_spool changing list_content.
    endform."create_list_content''
    *&      Form  create_text_content''
    form create_text_content changing text_content type soli_tab.
      data:z_lin(200) type c.
    append 'To,'  to text_content.
      concatenate 'To:' name1 into z_lin separated by space.
      append z_lin to text_content.
      concatenate 'End of delivery Notice for ' Zvbeln
        into z_lin separated by space.
      append z_lin to text_content.
    convert the content from RAW to TXT''
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = text_content
          objcont_new = text_content
        EXCEPTIONS
          others      = 0.
    endform."create_text_content''
    *&      Form  SEND''
          Create the list-document and send it via FAX, Mail and RML''
    form send using text_content type soli_tab
                     list_content type solix_tab.
      data:z_lin(200) type c.
    structures and internal tables for the send data''
      data document_data    type sodocchgi1.
      data packing_list     type table of sopcklsti1.
      data receivers        type table of somlreci1.
      data contents_txt     type soli_tab.
      data contents_hex     type solix_tab.
      data packlist_wa      type sopcklsti1.
      data receiver_wa      type somlreci1.
      data packlist_counter type i.
      data sent_to_all      type sonv-flag.
      data msg_ex(200) type c.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    main document''
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    document data contains information for the whole message''
      document_data-obj_descr = 'Miscellaneous Delivery Notice'.
    some text for the main document''
      append 'Hi,' name1 to contents_txt.
      concatenate 'To:' name1 into z_lin separated by space.
      append z_lin to contents_txt.
      concatenate 'Attached you will find the Delivery Notice for ' Zvbeln
        into msg_ex separated by space.
      append  msg_ex to contents_txt.
    append 'Attached you will find the Delivery Notice for ' Zvbeln to contents_txt.
      packlist_counter = 1.
      perform create_packlist_entry using contents_txt
                                          'RAW'
                                 changing packlist_wa
                                          packlist_counter.
    append packlist_wa to packing_list.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    add a text attachment of type TXT''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      perform create_packlist_entry using text_content
                                          'TXT'
                                 changing packlist_wa
                                          packlist_counter.
    append packlist_wa to packing_list.
    append lines of text_content to contents_txt.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    add the list attachment of type ALI''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      packlist_counter = 1."because we will fill the hex table now''
      perform create_packlist_entry using list_content
                                          'ALI'
                                 changing packlist_wa
                                          packlist_counter.
      append packlist_wa to packing_list.
      append lines of list_content to contents_hex.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    fill recipients tables''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      perform create_fax_recipient changing receiver_wa.
      append receiver_wa to receivers.
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
    Send the document by calling the API1''
    as of 6.10 either the flag 'commit_work' has to be set''
    or a commit work statement has to be set somewhere after the call''
    Sending won't work without this!''
    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~''
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = document_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = sent_to_all
        TABLES
          packing_list               = packing_list
          contents_txt               = contents_txt
          contents_hex               = contents_hex
          receivers                  = receivers
        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.
      case sy-subrc.
        when 0.
          if sent_to_all is initial.
            read table receivers index 1 into receiver_wa.
            message i865 with receiver_wa-retrn_code.
          else.
            message s022.
          endif.
        when 1.
          message i552.
        when 2.
          message i023 with document_data-obj_descr.
        when 4.
          message i471.
        when others.
          message i619.
      endcase.
    endform." SEND''
    *&      Form  USE_SUBMIT''
    <nowiki>*   Use "submit <report> exporting list to memory"
    form use_submit changing contents_hex type solix_tab.
      data listobject type table of abaplist.
    get the list object by calling the list in another report
    F1 on submit gives more information
      submit balvsd03 exporting list to memory and return.
    import the list from memory and store it in table listobject
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = listobject
        EXCEPTIONS
          not_found  = 1
          others     = 2.
      if sy-subrc <> 0.
        message e105 with 'LIST_FROM_MEMORY'.
      endif.
    free memory
      CALL FUNCTION 'LIST_FREE_MEMORY'
        TABLES
          listobject = listobject
        EXCEPTIONS
          others     = 1.
      if sy-subrc <> 0.
        message e105 with 'LIST_FREE_MEMORY'.
      endif.
    it's always necessary to compress the table.
    SAPconnect will decompress it
      CALL FUNCTION 'TABLE_COMPRESS'
        TABLES
          in             = listobject
          out            = contents_hex
        EXCEPTIONS
          compress_error = 1
          others         = 2.
      if sy-subrc <> 0.
        message e105 with 'TABLE_COMPRESS'.
      endif.
    endform." USE_SUBMIT
    *&      Form  WRITE_A_LIST
          Create a new list within this report.
    form write_a_list changing contents_hex type solix_tab.
      data listobject type table of abaplist.
      perform write_list.
    Save the list and store table listobject
      CALL FUNCTION 'SAVE_LIST'
        EXPORTING
          list_index         = sy-lsind
        TABLES
          listobject         = listobject
        EXCEPTIONS
          list_index_invalid = 1.
      if sy-subrc = 1.
        message e105 with 'SAVE_LIST'.
      endif.
    It's always necessary to compress the table
    SAPconnect will decompress it
      CALL FUNCTION 'TABLE_COMPRESS'
        TABLES
          in             = listobject
          out            = contents_hex
        EXCEPTIONS
          compress_error = 1
          others         = 2.
      if sy-subrc <> 0.
        message e105 with 'TABLE_COMPRESS'.
      endif.
    endform." WRITE_A_LIST
    *&      Form  GET_LIST_FROM_SPOOL
          Get list from spool
    form get_list_from_spool changing contents_hex type solix_tab.
      data spool_number     type rspoid.
      data contents_bin     type soli_tab.
      data print_parameters type pri_params.
      data valid            type c.
    write a list into spool
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
       IMPORTING
         out_parameters         = print_parameters
         valid                  = valid
       EXCEPTIONS
         archive_info_not_found = 1
         invalid_print_params   = 2
         invalid_archive_params = 3
         others                 = 4.
    if sy-subrc <> 0.
       message e105 with 'GET_PRINT_PARAMETERS'.
    elseif valid is initial.
       return.
    endif.
    new-page print on parameters print_parameters no dialog.
    perform write_list.
    new-page print off.
      spool_number = spool.
      DATA:REAL_TYPE     LIKE     SOODK-OBJTP.
      DATA:BUFFER_PDF     LIKE     TLINE OCCURS 0 WITH HEADER LINE.
    you can also send OTF documents from spool with this function
    module. The importing parameter real_type gives you the doc type
    that you have to give to the send interface. The parameter is not
    used here
      CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
        EXPORTING
          rqident              = spool_number
         desired_type         = 'RAW'
        IMPORTING
           REAL_TYPE           = REAL_TYPE
        TABLES
          buffer               = contents_bin
         BUFFER_PDF           = BUFFER_PDF
        EXCEPTIONS
          no_such_job          = 1
          job_contains_no_data = 2
          selection_empty      = 3
          no_permission        = 4
          can_not_access       = 5
          read_error           = 6
          type_no_match        = 7
          others               = 8.
    *clear contents_bin[].
      if sy-subrc <> 0.
        message e105 with 'RSPO_RETURN_SPOOLJOB'.
      endif.
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = contents_bin
          objcont_new = contents_bin
        EXCEPTIONS
          others      = 0.
      data:TRANSFER_BIN        TYPE      SX_BOOLEAN."   occurs 0.
      data:CONTENT_BIN         TYPE      SOLIX_TAB."   occurs 0.
      data:OBJHEAD             TYPE      SOLI_TAB.
      data:LEN     TYPE     SO_OBJ_LEN.
    *len = '255'.
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PRT'
       EXPORTING
         FORMAT_SRC   = 'OTF'
         FORMAT_DST   = 'PRT'
         devtype = 'POSTSCPT'
       CHANGING
         TRANSFER_BIN = TRANSFER_BIN
         CONTENT_TXT  = contents_bin
         CONTENT_BIN  = contents_hex
         OBJHEAD      = OBJHEAD
         LEN          = len.
      CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
        EXPORTING
          FORMAT_SRC   = 'OTF'
          FORMAT_DST   = 'PDF'
          devtype = 'PRINTER'
        CHANGING
          TRANSFER_BIN = TRANSFER_BIN
          CONTENT_TXT  = contents_bin
          CONTENT_BIN  = contents_hex
          OBJHEAD      = OBJHEAD
          LEN          = len.
    convert to hex table
    CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
       EXPORTING
         ip_solitab  = CONTENT_BIN
       IMPORTING
         ep_solixtab = contents_hex.
    endform." GET_LIST_FROM_SPOOL
    *&      Form  WRITE_LIST
          Write a list of SAPconnect conversion rules
    form write_list.
      data lt_scarr type table of scarr.
      data carr type scarr.
      select * from scarr into table lt_scarr.
      format color = 1.
      uline at /1(46).
      write: / sy-vline,
             'CARRID',   10 sy-vline,
             'CARRNAME', 35 sy-vline,
             'CURRCODE', 46 sy-vline.
      format color = 2.
      uline at /1(46).
      loop at lt_scarr into carr.
        write: / sy-vline,
               carr-carrid,   10 sy-vline,
               carr-carrname, 35 sy-vline,
               carr-currcode, 46 sy-vline.
      endloop.
      uline at /1(46).
      new-line.
    endform." WRITE_LIST
    *&      Form  create_packlist_entry
          text
    form create_packlist_entry  using  contents type standard table
                                       format type so_obj_tp
                             changing  packlist_wa type sopcklsti1
                                       packlist_counter type i.
      data tab_lines type i.
      clear packlist_wa.
      DATA FORM2 TYPE so_obj_tp.
    get the table length of the attachment
      describe table contents lines tab_lines.
    set binary flag for binary content to mark that this packlist entry
    is meant for table contents_hex and not for contents_bin
      FORM2 = FORMAT.
      if format = 'ALI'.
      FORM2 = 'PRT'.
        FORM2 = 'PDF'.
        packlist_wa-transf_bin = 'X'.
      endif.
    attchment's description and format
      concatenate form2 'Document' into
         packlist_wa-obj_descr separated by space.
      packlist_wa-doc_type   = form2.
    describe start and length in contents_txt or contents_hex
    which table is meant is decided by the transf_bin flag set above
      packlist_wa-body_start = packlist_counter.
      packlist_wa-body_num   = tab_lines.
    increase counter to have the starting line for the next attachment
      packlist_counter = packlist_counter + tab_lines.
    endform." create_packlist_entry
    *&      Form  create_int_recipient
          text
    *form create_int_recipient changing receiver type somlreci1.
    field-symbols <receiver> type c.
    data recipient_int type sadrud.
    clear receiver.
    fill address type specific recipient structure
    cast structure to generic receiver field
    assign recipient_int to <receiver> casting.
    receiver-receiver = <receiver>.
    set address type for INT
    receiver-rec_type = 'U'.
    *endform."create_int_recipient
    *&      Form  create_fax_recipient
          text
    form create_fax_recipient changing receiver type somlreci1.
      field-symbols <receiver> type c.
      data recipient_fax type sadrfd.
      data name type soud3.
      clear receiver.
      name-sapnam = sy-uname.
      CALL FUNCTION 'SO_NAME_CONVERT'
        EXPORTING
          name_in  = name
        IMPORTING
          name_out = name
        EXCEPTIONS
          others   = 1.
      if sy-subrc <> 0.
        name-adrname = sy-uname.
      endif.
    fill address type specific recipient structure
      recipient_fax-rec_fax    = rec_fax."'7152414031'.
      recipient_fax-rec_state  = 'US'.
      recipient_fax-rec_title  = title."'Mr.'.
      recipient_fax-rec_name1  = name1."'Ytamar Fondeur'.
      recipient_fax-send_nam   = name-adrname.
      recipient_fax-send_cover = cover.
      recipient_fax-FORM_LANGU = sy-langu.
    cast structure to generic receiver field
      assign recipient_fax to <receiver> casting.
      receiver-receiver = <receiver>.
    set address type for FAX
      receiver-rec_type = 'F'.
    endform."create_fax_recipient
    *&      Form  create_rml_recipient
          text
    form create_rml_recipient changing receiver type somlreci1.
      field-symbols <receiver> type c.
      data recipient_rml type sadr7d.
      clear receiver.
    fill address type specific recipient structure
      recipient_rml-sdest = 'C11'.
      recipient_rml-umand = '001'.
      recipient_rml-uname = 'MYUSER'.
    cast structure to generic receiver field
      assign recipient_rml to <receiver> casting.
      receiver-receiver = <receiver>.
    set address type for RML
      receiver-rec_type = 'R'.
    endform."create_rml_recipient

  • Send oracle table to pdf file through forms 6i

    please dear sirs,
    I want to send oracle table to pdf file through forms 6i
    waiting help
    thanks in advance
    Yasser

    dear Francois
    i use this code which sarah give it to me
    and i write as the following put not give me the pdf file
    DECLARE
         PL_ID PARAMLIST;
    BEGIN     
         PL_ID := GET_PARAMETER_LIST('TEMPDATA');
         IF NOT ID_NULL(PL_ID) THEN
              DESTROY_PARAMETER_LIST(PL_ID);
         END IF;
         PL_ID := CREATE_PARAMETER_LIST('TEMPDATA');
         ADD_PARAMETER(PL_ID, 'PARAMFORM', TEXT_PARAMETER, 'NO');
         ADD_PARAMETER(pl_id, 'DESTYPE', TEXT_PARAMETER, 'FILE');
         ADD_PARAMETER(pl_id, 'DESFORMAT', TEXT_PARAMETER, 'PDF');
         ADD_PARAMETER(pl_id, 'DESNAME',          TEXT_PARAMETER, 'D:\YASSER');
         RUN_PRODUCT(REPORTS, 'D:\YASSER\crm02002.rep', ASYNCHRONOUS, RUNTIME, FILESYSTEM, PL_ID, NULL);
    END;
    pls help me and tell me where is the error which i did
    thanks in advance dear

  • Error while converting Image -to- PDF and then to PDF/A

    Hi,
    I'm trying to convert a Image format(JPEG,bmp,tiff) to PDF and then to PDF/A. I could able to convert Image to PDF successfully.
    I'm getting the below error while converting the PDF(that was generated) to PDF/A.
    Caused by: com.adobe.livecycle.output.exception.OutputException: Input Document is a already flat PDF Document
    at com.adobe.printSubmitter.PrintServer.transformPDF(PrintServer.java:307)
    at com.adobe.printSubmitter.service.OutputServiceImpl.transformPDFInTxn(OutputServiceImpl.ja va:518)
    at com.adobe.printSubmitter.service.OutputServiceImpl$4.doInTransaction(OutputServiceImpl.ja va:481)
    ... 106 more
    Error OCCURRED: ALC-DSC-000-000: com.adobe.idp.dsc.DSCException: Internal error.
    Please give me the solution to convert PDF to PDF/A?

    I've just read a footnote in the API documentation which indicates that the transformPDF function cannot be used for this purpose:
    "GS_Enterprise said on Nov 24, 2007 at 12:03 PM :
    Please note that the parameter "inPdfDoc" for transformPDF assumes that the stream content is an XFA-based PDF, and that it's not an XFA-based PDF with a PDF background (also known as "XFA foreground"). In other words, this function does not convert any input PDF to PDF/A, but only those PDFs generated from an XFA template which does not include any static PDF content as a background."

  • Internal table with Import and Export

    Hi All,
    Hi all
    Please let me know the use of <b>Internal table with Import and Export parameters and SET/GET parameters</b>, on what type of cases we can use these? Plese give me the syntax with some examples.
    Please give me detailed analysis on the above.
    Regards,
    Prabhu

    Hi Prabhakar,
    There are three types of memories.
    1. ABAP MEMORY
    2. SAP MEMORY
    3. EXTERNAL MEMORY.
    1.we will use EXPORT/ IMPORT TO/ FROM MEMORY-ID when we want to transfer between ABAP memory
    2. we will use GET PARAMETER ID/ SET PARAMETER ID to transfer between SAP MEMORY
    3. we will use EXPORT/IMPORT TO/FROM SHARED BUFFER to transfer between external memory.
    ABAP MEMORY : we can say that two reports in the same session will be in ABAP MEMORY
    SAP MEMORY: TWO DIFFERENT SESSIONS WILL BE IN SAP MEMORY.
    for ex: IF WE CALL TWO DIFFERENT TRANSACTIONS SE38, SE11
    then they both are in SAP MEMORY.
    EXTERNAL MEMORY: TWO different logons will be in EXTERNAL MEMORY.
    <b>Syntax</b>
    To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.
    ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.
    To fill one, use:
    SET PARAMETER ID <pid> FIELD <f>.
    This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.
    To read an SPA/GPA parameter, use:
    GET PARAMETER ID <pid> FIELD <f>.
    This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.
    To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.
    The relevant fields must each be linked to an SPA/GPA parameter.
    On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.
    On a screen, you link fields to parameters in the Screen Painter. When you define the field attributes of an input field, you can enter the name of an SPA/GPA parameter in the Parameter ID field in the screen attributes. The SET parameter and GET parameter checkboxes allow you to specify whether the field should be filled from the corresponding SPA/GPA parameter in the PBO event, and whether the SPA/GPA parameter should be filled with the value from the screen in the PAI event.
    When an input field is linked to an SPA/GPA parameter, it is initialized with the current value of the parameter each time the screen is displayed. This is the reason why fields on screens in the R/3 System often already contain values when you call them more than once.
    When you call programs, you can use SPA/GPA parameters with no additional programming overhead if, for example, you need to fill obligatory fields on the initial screen of the called program. The system simply transfers the values from the parameters into the input fields of the called program.
    However, you can control the contents of the parameters from your program by using the SET PARAMETER statement before the actual program call. This technique is particularly useful if you want to skip the initial screen of the called program and that screen contains obligatory fields.
    Reading Data Objects from Memory
    To read data objects from ABAP memory into an ABAP program, use the following statement:
    Syntax
    IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.
    This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.
    Saving Data Objects in Memory
    To read data objects from an ABAP program into ABAP memory, use the following statement:
    Syntax
    EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.
    This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.
    Check this link.
    http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm
    Thanks,
    Susmitha.
    Reward points for helpful answers.

  • Dowloading Internal table into pdf formate

    Hi,
      I want to know how to conert an internal table into pdf file  is there any fm avaliable for this  .
    regards,
    zafar

    try this sample code--
    tables:tsp01.
    TYPE-POOLS : vrm.
    DATA : vrm_val TYPE vrm_values,
           wa_vrm  LIKE LINE OF vrm_val,
           g_name  LIKE wa_vrm-text.
    data: w_pdf like table of tline.
    data:
      print_parameters like pri_params,
      valid_flag(1) type c,
      w_spono type tsp01-rqident.
      CLEAR wa_vrm.
      wa_vrm-key  = 'M'.
      wa_vrm-text = 'Mango'.
      APPEND wa_vrm TO vrm_val.
      CLEAR wa_vrm.
      wa_vrm-key  = 'P'.
      wa_vrm-text = 'Pineapple'.
      APPEND wa_vrm TO vrm_val.
      CLEAR wa_vrm.
      wa_vrm-key  = 'A'.
      wa_vrm-text = 'apple'.
      APPEND wa_vrm TO vrm_val.
    call function 'GET_PRINT_PARAMETERS'
    exporting
         no_dialog          = 'X'
         user               = sy-uname
    importing
       out_parameters       = print_parameters
       valid                = valid_flag
    exceptions
       invalid_print_params = 2
       others               = 4.
    if valid_flag = 'X' and sy-subrc = 0.
      new-page print on parameters print_parameters
                          no dialog.
    LOOP AT vrm_val into wa_vrm.             " your internal table
      WRITE :wa_vrm-key.
    ENDLOOP.
    LOOP AT vrm_val into wa_vrm.
      WRITE : wa_vrm-text.
    ENDLOOP.
    new-page print off.
    endif.
    w_spono = sy-spono.
    call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
      exporting
        src_spoolid                    = w_spono
    tables
       pdf                            = w_pdf[]
    if sy-subrc  EQ 0.
    endif.
    call function 'GUI_DOWNLOAD'
      exporting
        filename                        = 'C:\w_pdf.pdf'
       filetype                        = 'BIN'
      tables
        data_tab                        = w_pdf[]
    if sy-subrc EQ 0.
    endif.
    Sumit

Maybe you are looking for