Converting ALV grid into PDF file

Hi,
I have searched for a way to convert my ALV output into a PDF file, and then e-mail it, but I haven't succeeded in using what I found so far:
CONVERT_OTFSPOOLJOB_2_PDF - I don't want it to work only when I run the report in the background.
CONVERT_OTF - I don't have a sapscript input to provide the function with.
What are the options available for me? I am forced to use any of these alternatives, eventually ?
Thanks
Avraham

Hello,
You can make use of the param IS_PRINT. But if you read the long text, it will create the spool but not display the ALV.
A small code snippet for your ready reference:
TYPE-POOLS slis.
DATA: itab TYPE STANDARD TABLE OF t001,
      v_repid TYPE sy-repid,
      st_print TYPE slis_print_alv,
      v_spono TYPE rspoid.
v_repid = sy-repid.
st_print-print = 'X'. "Will create a spool req. but not diplay the ALV
SELECT * FROM t001 INTO TABLE itab UP TO 20 ROWS.
IF sy-subrc = 0.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = v_repid
      i_structure_name   = 'T001'
      is_print           = st_print
    TABLES
      t_outtab           = itab
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc = 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    v_spono = sy-msgv1. "You have the Spool No., create the PDF :-)
    CLEAR st_print.
*   As the previous call will not display ALV, call the FM again
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = v_repid
        i_structure_name   = 'T001'
        is_print           = st_print
      TABLES
        t_outtab           = itab
      EXCEPTIONS
        program_error      = 1
        OTHERS             = 2.
    IF sy-subrc = 0.
*   So Nothing
    ENDIF.
  ENDIF.
ENDIF.

Similar Messages

  • To convert ALV Grid to PDF format

    Hi Experts,
    We have a requirement where in the output in ALV grid display should be downloaded to PDF format.
    We came across two processes.
    1. To download the output  to Smartform and then convert to PDF format
    2. To send the ALV output directly to spool and then convert it to PDF
    Please let me know which of the above two gives better performance and also please guide me through the process.

    HI Mallika,
       Both the ways are feasible. For conversion of ALV to PDF,
    1. Display ALV output as usual using factory method .
    2. Create a Button 'Download to PDF' in the GUI status
    3. Set the Sy-batch as 'X'.
    4. Call the Factory method for list display
    5. Catch the sy-spono
    6. Use the FM CONVERT_ABAPSPOOLJOB_2_PDF  to convert alv data to PDF.
    7. Use the FM GUI_DOWNLOAD  to dowload the above PDF file

  • How to convert alv list into excel file?

    Hi Experts,
            i have created one report for Due Date Analysis.
    Now My output is displaying in ALV list. But I need to convert the data which in alv list into Excel File. then only i have to send the Excel File to the Customer Thro Email.
         So i need the Function Module to Convert the Data into Excel File.
    Thanks,
    Neptune.M

    Hi,
      U can use function module gui_download.
      CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
        BIN_FILESIZE       =
          filename           = 'C:\Transportaionlane.XLS'
          filetype                       = 'DAT'
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TABLES
          ata_tab                       = t_trans_lane_dis[]
           OTHERS                          = 22
    if u want with header then pass the header.
    regards
    Ahasan

  • Convert ALV output to PDF file , DXF and DWG format

    hi,
        How to convert a ALV report to PDF file, DXF and DWG format, I developed a ALV report which has to be converted as per the selections of above formats,
    Reward points for good & with example answers
    Thanks in advance
    RK

    Hello RK,
       Check this link. It has an example code for PDF Conversion.
    http://www.erpgenie.com/abap/code/abap51.htm
    Regards,
    Deepu.k

  • ALV Grid to PDF File

    I know the FM  - CONVERT_ABAPSPOOLJOB_2_PDF  will convert ALV to PDF but i am not clear with input paramters need to pass to this function module. How to get spool request number. Kinldy give me an example how to convert my current alv output to PDF format file.

    Hello,
    Please check this sample report:
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    Problem in mailing smartforms output using so_new_document_send_API1
    How to email a smartform?
    http://www.sapgenie.com/abap/example_code.htm
    Vasanth

  • Convert ALV report into PDF and mail ( Hierarchical List View )

    Hi All,
    I see many posts of PDF download but none resolve my issue.
    I am writing a report in APO SNP which fetches data and displays an alv using REUSE_ALV_HIERSEQ_LIST_DISPLAY as i need to show the result as a Hierarchical sequential list.
    I need to provide the functionality of PDF download ( online ) and Email with PDF as attachement ( Background ) for the list output.
    I read the post http://www.sapdev.co.uk/reporting/rep_spooltopdf2.htm which provides a sample program and tried to incorporate but the control doesn't come back from the ALV function module.
    How do i trigger the spool creation while still showing the output  and then send email?
    Suggestions and pointers are highly appreciated
    Regards,
    KD

    Hi.,
    Check this wiki: [Convert ALV as PDF  Attachment|http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Problem in converting smart form into PDF

    HI Experts,
                      I am using a Function Module CONVERT_OTF for converting smart form into pdf file for send it to with attachment.
    But i got a error when i am using that FM.
    Runtime Errors         CONVT_NO_NUMBER
    unable to interpret *292 as a no.
    Is that because my file size too large about 13 pages of PDF?
    and when i run it for other smart forms which have 2 or 3 pages of PDF, its working perfectly.
    can anyone tell what is problem with that FM?
    Thanks
    Shakun

    Hi,
    I had the similar issue and after analysis I have that this is the issue by not passing the IMPORTING parameter of the Function Module "BIN_FILESIZE". Please try to pass some variable to this paramter and then this will be completely rectified.
    DATA ; v_filesize     TYPE i.
    *--Convert OTF data to PDF data
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
        IMPORTING
          bin_filesize          = v_filesize
        TABLES
          otf                   = it_otfdata
          lines                 = it_pdfdata
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 4
          OTHERS                = 5.
    Please verify whether this reolves the problem for you.
    Regards,
    SRinivas

  • In smartform word document convert into pdf file

    Hi Experts,
    I have issue on smartform, i have done two page smartform in preview its coming properly but
    when i give to print its not coming properly...output is not coming properly...so please sugest me
    even how to covert smartform word document into PDF file...im waiting for your replay. Thanks in
    Advance....
    Regards
    Ashwini

    Hi,
       I hope its printer problem check with u r basis, and for Smartform to PDF bewlow is my coding in which by using OTF data from Smartform it ill veiw in PDF.
    *& Report  ZSAP_PDF_VIEWER_DEMO_2
    REPORT  ZSAP_PDF_VIEWER.
    DATA: LT_PDF TYPE TABLE OF TLINE,
          LS_PDF LIKE LINE OF LT_PDF,
          LV_URL TYPE CHAR255,
          PDF_FSIZE TYPE  I,
          LV_CONTENT  TYPE XSTRING,
          LT_DATA TYPE STANDARD TABLE OF X255.
    DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
    DATA : LS_CONTROL_PARAM  TYPE SSFCTRLOP.
    DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           G_HTML_CONTROL   TYPE REF TO CL_GUI_HTML_VIEWER.
    DATA: LO_DIALOG_CONTAINER TYPE REF TO CL_GUI_DIALOGBOX_CONTAINER.
    DATA: LO_DOCKING_CONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER.
    DATA : P_VBELN TYPE  VBELN_VL.
    FIELD-SYMBOLS <FS_X> TYPE X.
    INITIALIZATION.
    LS_CONTROL_PARAM-GETOTF = 'X'.
    LS_CONTROL_PARAM-NO_DIALOG = 'X'.
    START-OF-SELECTION.
      CALL FUNCTION '/1BCDWB/SF00000034'
    EXPORTING
       ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
         CONTROL_PARAMETERS         = LS_CONTROL_PARAM
         P_VBELN                    = P_VBELN
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
      OUTPUT_OPTIONS             =
      USER_SETTINGS              = 'X'
    IMPORTING
         DOCUMENT_OUTPUT_INFO  = L_DOCUMENT_OUTPUT_INFO
           JOB_OUTPUT_INFO       = L_JOB_OUTPUT_INFO
         JOB_OUTPUT_OPTIONS    = L_JOB_ OUTPUT_OPTIONS
    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.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE
        TABLES
          OTF                   = L_JOB_OUTPUT_INFO-OTFDATA
          LINES                 = LT_PDF
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
    convert pdf to xstring string
      LOOP AT LT_PDF INTO LS_PDF.
        ASSIGN LS_PDF TO <FS_X> CASTING.
        CONCATENATE LV_CONTENT <FS_X> INTO LV_CONTENT IN BYTE MODE.
      ENDLOOP.
       CALL SCREEN 100.
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS '100'.
    **CREATE OBJECT LO_DOCKING_CONTAINER
    EXPORTING
       REPID     = SY-REPID
       DYNNR     = '100'"SY-DYNNR
       SIDE      = LO_DOCKING_CONTAINER->DOCK_AT_LEFT
       EXTENSION = 1200.
    CREATE OBJECT g_html_container
       EXPORTING
         container_name = 'HTML'.
    *CREATE OBJECT G_HTML_CONTROL
    EXPORTING
       PARENT = LO_DOCKING_CONTAINER.
      CREATE OBJECT G_HTML_CONTAINER
          EXPORTING
            CONTAINER_NAME = 'HTML'.
        CREATE OBJECT G_HTML_CONTROL
          EXPORTING
            PARENT = G_HTML_CONTAINER.
    Convert xstring to binary table to pass to the LOAD_DATA method
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = LV_CONTENT
        TABLES
          BINARY_TAB = LT_DATA.
    *application/
    Load the HTML
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         =  'application'
           SUBTYPE      =   'pdf' "
         IMPORTING
           ASSIGNED_URL         = LV_URL
         CHANGING
           DATA_TABLE           = LT_DATA
         EXCEPTIONS
           DP_INVALID_PARAMETER = 1
           DP_ERROR_GENERAL     = 2
           CNTL_ERROR           = 3
           OTHERS               = 4 ).
    CALL METHOD G_HTML_CONTROL->show_url
         EXPORTING  url        = lv_url
                   in_place    = 'X'
         EXCEPTIONS cntl_error = 1.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    MODULE user_command_0100 INPUT.
      DATA ok_code LIKE sy-ucomm.
      MOVE sy-ucomm TO ok_code.
      CASE ok_code.
        WHEN 'BACK' OR 'EXIT'.
         CALL METHOD LO_DOCKING_CONTAINER->free.
          CALL METHOD g_html_control->free.
          LEAVE TO SCREEN 0.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.                 " USE

  • How can i convert image into pdf  file

    Hi Friends,
    I want to convert image file(i.e. jpeg,bmp,gif) into pdf file using java apis OR is there any tool which can convert it & which we can integrate into our java application
    Thanks in adva.

    Is there any solution to this case.....?

  • No Microsoft files listed in the settings "convert into PDF files"

    Hi, I wanted to convert different Microsoft Office files, but it doesn't work. There are no Microsoft files listed in the settings "convert into PDF files". I had the trial version of Adobe Acrobat Pro XI installed on a MAC in Windows that runs trough Parallels. Hope somebody can help. Thx

    Hi Rahul,
    many thanks for your suggestion.
    Yes, Parallels is a virtual machine on the top of MAC and I can see all files in the Windows Explorer. Also the ones I created on the MAC top with the Microsoft Office Software Word or Excel for MAC as well the ones I created earlier on a Windows PC.
    Unfortunately there is no possibility to convert files into PDF format with a click on the right mouse. And Adobe also doesn't open Word documents because it doesn't support this format.
    But nonetheless it wouldn't be a solution that I prefer to convert in adavance every single file in a PDF format. I need to create a PDF package from different formats.
    I assume this issue has to do something with MAC or Parallels, because this function of the Adobe Versions Acrobat 8 Pro and XI Pro work well on a Windows PC. I just don't understand why there are no Microsoft Office file formats listed in the Adobe settings. This settings also can't be changed. I tried to find out but couldn't find any hint for this problem thus I'm a bit at a loss... Maybe you have another idea?
    Regards
    Ly

  • Converting pictures into PDF files

    How do I convert pictures into PDF files, is this possible?

    If you want to use acrobat reader, you have to pay for it.
    So, I use other free or cheap apps to do so =>
    * powerpdf
    * dragonprinter (draakprinter in dutch)
    * writepdf
    * scanapp (to convert parts of a picture)
    I even think that almost every scan-app can convert pictures into pdf's.

  • Convert XML file into PDF file

    <b>XML to PDF</b>i want to Convert XML file into PDF file pl. any one can suggests API's

    Hi,
    There are many ways to convert XML files to PDFs through java.
    One of the easiest way is by using iText.jar which have classes for conversion.
    The following are the required steps
    1. Create a document object for the XML file ( Using DOM or SAX parser).
    2. Parse the xml document and extract the content to write in PDF.
    3.Create a itext Document object.
    4.Get a PdfWriter instance for the PDF file.
    5.Write in the pdf the extracted text using the document object.
    Refer <a href="http://itextdocs.lowagie.com/examples/com/lowagie/examples/general/HelloWorld.java">here</a> for a simple pdf writer example.
    Refer <a href="http://java.sun.com/developer/codesamples/xml.html">here</a> for examples of XML Parsers.
    Regards,
    Uma

  • CONVERT into PDF  Files

    hi all,
        i have the scenario to convert Purchase Order into PDF Format.
    that PDF format should be stored in app server.
    please help me to solve this problem.
    Your help is greatly appreciated.

    HI ,
    u can get idea on looking this code.
    data: ctrlparams type ssfctrlop.
    data: fm_name type rs38l_fnam,
          fname type string value 'c:\reportpdf.pdf',
          bin_size type i,
          joboutput type ssfcrescl,
         it_result like table of itcoo,"JOBOUTPUT-OTFDATA
          otf like table of itcoo,
          doc like table of docs,
          tlines like table of tline.
    data: begin of struct occurs 0.
            include structure spfli.
    data: end of struct.
    data: itab like table of struct with header line.
                   call function 'SSF_FUNCTION_MODULE_NAME'
                     exporting
                       formname                 = 'ZSIVA_SMARTFORMS'
                       FORMNAME                 = 'SF_TOTALS'
                    importing
                      fm_name                  = fm_name
                   if sy-subrc <> 0.
                   endif.
    ctrlparams-getotf = 'X'.
    call function fm_name
    exporting
        control_parameters         = ctrlparams
    importing
        job_output_info            = joboutput
    tables
       itab                    = itab.
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5.
    *IF SY-SUBRC <> 0.
    *ENDIF.
    call function 'CONVERT_OTF_2_PDF'
    importing
       bin_filesize                 = bin_size
      tables
        otf                          = joboutput-otfdata[] "otf
        doctab_archive               = doc
        lines                        = tlines
      call function 'GUI_DOWNLOAD'
        exporting
          bin_filesize                  = bin_size
          filename                      = 'C:\siva\test.pdf'
          filetype                      = 'BIN'
        tables
          data_tab                      = tlines.
    * Open PDF
    data: program like soxpc-path.
    call function 'SO_PROGNAME_GET_WITH_PATH'
      exporting
        doctype = 'PDF'
      importing
        pathname = program
      exceptions
        path_not_found = 1
        program_not_found = 2
        no_batch = 3
        x_error = 4
        others = 5.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    call function 'WS_EXECUTE'
      exporting
        commandline = 'C:\siva\test.pdf'
        program     = program
      exceptions
        frontend_error = 1
        no_batch = 2
        prog_not_found = 3
        illegal_option = 4
        gui_refuse_execute = 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.
    regards,
    shan

  • Converting binary data into pdf and placing into application server

    Hi Friends,
    I am able to get PO details in binary format and then using GUI_DOWNLOAD  with file type with 'bin' and file name with 'sample.pdf' extension , got  PO in pdf  format.
    But i need to get with pdf extension in application server without using GUI_DOWNLOAD.
    Is there any functional modules for it?
    With Warm Regards,
    Madhu!!!

    Hi Madhu,
    Check this code.
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           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.
      CHECK sy-subrc = 0.
    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.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      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 ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    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,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    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
                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.
    ENDFORM.
    Hope this resolves your query.
    <b>Reward all the helpful answers.</b>
    Regards

  • Convert portfolio to single pdf file

    Hi, I have a portfolio of my email archive which I want to convert to a single pdf file. The way I'm doing it is by combining files and adding the portfolio file and then clicking combine, merge files into a single pdf, adding the portfolio and selecting single pdf file. This 'breaks up' the portfolio into its individual constituents which you can then combing into a single normal pdf file.
    But there is a problem. In the portfolio the original date of the email is retained so you can sort the emails chronologically. However, when the portfolio is broken up the individual files are dated on the date the portfolio is created and so the new file is not sorted in the chronological send/receive order of the emails.
    So my question is: how do I combine emails to a single pdf file in the chronological order of the emails?
    Many thanks
    Ps Since typing this message I've noticed that when printing all files in the portfolio it also doesn't print it in chronological order even though that's how they're sorted in the portfolio.

    Something to try —
    View the open Portfolio in the List or Basic Grid view.
    Select all the files.
    Select File > Sae Files from Portfolio > Use the Browse For Folder dialog to select a destination.
    Click OK.
    A copy of the Portfolio's files will be in the designated location.
    Perform the Combine > Merge Files into a Single PDF action.
    Be well..
    Message was edited by: CtDave

Maybe you are looking for

  • Keeps telling me my session has timed out

    Everytime I try to use my ITunes,it tells me my session has timed out...

  • Order version error

    Hi All, I am facing problem with order version. while adding the cart it is fine, then click on proceed checkout button it is giving following error message. Saving order o200003 failed because doing so would result in data being overwritten. Order d

  • Daylight Savings Time and Alarmsk

    Since the daylight savings time updated over the weekend the alarms I had programmed on my iPhone will not set properly. The phone displays the correct current time so I know the clock has updated but any alarms I have set for the hour of 2am - 3am d

  • Images in Flash Mapping Client??

    Hi, Now, I'm working with Mapviewer using the Flash mapping Client. It works quit well. I'd like to know if you can insert an image like a JPG or GIF. Thanks

  • When i go to sync iphone 4 it freezes during back up and won't work. What to do??

    Everytime i connect my iphone into itunes it goes to syncing it. on step two (backing it up) it completely freezes and does not restart. i can't get music on it ringtones NOTHING. I just bought this a few days ago too what should i do?