SPOOL PDF to application server

Hi
I want to write the spool pdf of a form to application server.
I am using 'convert_spool_to_pdf' FM and getting data in an internal table.
The data in this internal table is of different format, I am not sure how to write this data format to application server.
Please help.
Regards
Manu

This has been asked and answered before...did you search?  PDF data is in binary format, so you need to adapt accordingly...

Similar Messages

  • How to download pdf from application server

    hi all,
    anybody has code to download pdf from application server to presentation server.
    right now i get the pdf file on to the desktop but i get error on opening.
    gui_download gives error if i use xstring.
    pl advice.
    thanks.
    sap fan.

    Hi,
    use the below code to download file from app server to presentation server
    PARAMETERS: S_file TYPE SAPB-SAPPFAD
    default '\folder1\abc,pdf'.
    PARAMETERS: t_lfile TYPE SAPB-SAPPFAD
    default 'c:\temp\xyx.pdf'.
    START-OF-SELECTION.
      CALL FUNCTION 'ARCHIVFILE_SERVER_TO_CLIENT'
        EXPORTING
          path             = source_file
         TARGETPATH        = target_lfile
    EXCEPTIONS
       ERROR_FILE       = 1
       OTHERS           = 2
      IF sy-subrc eq  0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • Unable to view PDF files -application server class CL_GUI_PDFVIEWER- open_d

    Hi
    I have PDF files in application server and trying to display the PDF files by using class CL_GUI_PDFVIEWER->open_document but i am unable to view the pdf files.
    Please let us know any other alternative way to view the PDF files via application server.
    Regards
    G

    Hi,
    steps tu visualize PDF files from app server via html_viewer:
    1. Upload PDF file to table type x255. (using for ecampo FM SCMS_UPLOAD)
    2. Create container (TYPE REF TO cl_gui_custom_container),
        create html_viewer (TYPE REF TO cl_gui_html_viewer).
    3. Load data from ypur xsting table to url:
      CALL METHOD html_viewer->load_data
        EXPORTING
          TYPE                = 'application'
          SUBTYPE           = 'pdf'
         IMPORTING
           assigned_url     = url
        CHANGING
          data_table          =  data_pdf.  "line type x255
    4. Show data from url:
      CALL METHOD html_viewer->show_data
        EXPORTING
          url                    = url.
    Regards,
    MaryM

  • Storing Spool in the Application server.

    Hi,
    I need to place the spool created in a (Raw data format) in the application server. Also I have the spool no. (returns with the FM 'close_form' attributes ... itcpp-tdspoolid).
    Could you please let me know if there is some FM already available for this purpose.
    Thanks and Regards
    satish.

    Hi Ram,
    Thanks for it. But it downloads to the presentaion server.
    Anyway there is a FM used RSPO_RETURN_SPOOLJOB used in
    RSPO_DOWNLOAD_SPOOLJOB which downloads to the internal table.
    With that I can place in the application server.
    Many thanks.
    Satish.

  • Creation of pdf's Application server Forms&Reports services v9.0.4

    When generating pdf documents using the reports server, is there anyway control the margins? All of my reports generated with a destination format of pdf have no left margin. This ok for some reports, but if I want to use a pdf with a pre-printed form, I need to specify a left margin.

    hello,
    margins are controlled by your report layout. in the report builder, while in the paper layout view of the report in question, click on the "Margin" button on the toolbar and you will see where you layout area is in respect to the overall page. it might be that your left edge of the layout area has been moved all the way to the edge of the physical page during report design.
    thanks,
    ph.

  • Get and display saved/archived PDF from application server

    Hi!
    I have a program which uses OPEN DATASET and function modules ARCHIVOBJECT_CREATE_FILE + ARCHIV_CONNECTION_INSERT to save and archive PDF documents.
    How do I <b>retrieve</b> these PDF files (I need to create a list of PDF documents that complies to certain criteria)? Is there a function module I can use?
    How do I <b>display</b> the PDF (selected from my list of PDFs by the user), can method EXECUTE of class CL_GUI_FRONTEND_SERVICES be used?
    Thank you very much for all your help!
    - Mari Virik

    ...

  • Download spool to PDF document on application server

    Hi,
    I am using function CONVERT_OTFSPOOLJOB_2_PDF to convert a sapscript spool and then downloading the internal table provided to a pdf file on the application server. The sapscript form contains company logos.
    After transferring the file from the application server to PC and then opening the pdf document I get the following message:
    "There was an error while trying to parse an image."
    The PDF doc contains everything except the company logo.
    I noticed that this works (i.e. company logo is present in the downloaded file) when I transfer the internal table that contains the PDF contents onto my PC using GUI_DOWNLOAD using mode 'BIN'. However, when I transfer the contents of the same internal
    table to a file on the application server using abap statement:
    'Open Dataset <filename> FOR OUTPUT IN BINARY MODE'
    I get the problem described above.
    I noticed that SAP has provided standard program RSTXPDFT4 to convert a spool and download it into a PC file. However is there a similar program that downloads a spool onto the application server? Perhaps there is a 'special' way in downloading PDF documents onto the application server?
    I don't this problem with sapscripts that do not have a company logo.
    Is there a certain restriction on 'Open Dataset'with transfering logos in PDF documents?
    Any help would be greatly appreciated in the form of reward points.
    Thanks
    Liam

    Hi,
    We convert some of our spools to pdf and store them on the app server using following high level process.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid = p_spool
                no_dialog   = 'X'
                dst_device  = 'LOCL'
           TABLES
                pdf         = lt_pdf
           EXCEPTIONS
                OTHERS      = 0.
    Write PDF file
      CALL FUNCTION 'GUID_CREATE'
           IMPORTING
                ev_guid_32 = l_guid.
      CONCATENATE '/your_path_goes_here/'
                  l_guid
                  INTO l_filename.
      CONCATENATE l_filename '.pdf' INTO l_filename.
    Store
      OPEN DATASET l_filename IN TEXT MODE.
      IF NOT sy-subrc IS INITIAL.   " only write pdf if new
        LOOP AT lt_pdf.
          TRANSFER lt_pdf TO l_filename.
        ENDLOOP.
      ENDIF.
      CLOSE DATASET l_filename.
    If it doesn't work, I would 1st try and play with image type. I'm wondering if it's tripping on image conversion. Perhaps revert to 1st principles and try monochrome bitmap and a few variations thereof. I stand by my code above. Definitely works. HTH, Dave

  • Read PDF Formatted Spool and write PDF File to Application Server

    Hi Experts,
    After ECC 6.0, HR-W2 and W2C Form Spools are getting generated in PDF format.
    We have a requirement wherein we want to read the PDF Spool Programatically and write the PDF file to Application server (Using OPEN DATASET and CLOSE DATASET)
    PARAMETERS : p_spono LIKE tsp01-rqident.
    DATA: pdf_data type FPCONTENT.
    types: lt_pdf_table(1000) type x.
    data:  l_pdf_data type standard table of lt_pdf_table,
           l_pdf_line type lt_pdf_table,
           l_offset type i,
           l_len type i,
           p_file(100) VALUE '\sapout\DVH\pdf2.pdf'.
    *Read the spool content
    CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'
        EXPORTING
             i_spoolid = p_spono
             i_partnum = '1'
        IMPORTING
               e_pdf = pdf_data
    *         e_pdf_file = file
        EXCEPTIONS
             ads_error = 1
             usage_error = 2
             system_error = 3
             internal_error = 4
        OTHERS = 5.
    * Modify the spool  contents to prepare internal table
      l_len = xstrlen( pdf_data ).
      while l_len >= 1000.
        l_pdf_line = pdf_data+l_offset(1000).
        append l_pdf_line to l_pdf_data.
        add 1000 to l_offset.
        subtract 1000 from l_len.
      endwhile.
      if l_len > 0.
        l_pdf_line = pdf_data+l_offset(l_len).
        append l_pdf_line to l_pdf_data.
      endif.
    * GUI DOWNLOAD Works Fine
    * Now pdf contents is ready , lets store in local PC
    *CALL FUNCTION 'GUI_DOWNLOAD'
    *  EXPORTING
    *   filename                        = 'C:\Documents and Settings\Desktop\shital.pdf'
    *   filetype                        = 'BIN'
    *  TABLES
    *    data_tab                        = l_pdf_data.
    OPEN DATASET p_file FOR OUTPUT IN BINARY MODE.
    IF sy-subrc <> 0.
      MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
              ' Error opening file:'(Z03) p_file.
    ENDIF.
    LOOP AT l_pdf_data INTO l_pdf_line.
      TRANSFER l_pdf_line TO p_file.
    ENDLOOP.
    CLOSE DATASET p_file.
    IF sy-subrc <> 0.
      MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
              ' Error closing file:'(Z04) p_file.
    ENDIF.
    Currently as you can see I have commented out GUI_DOWNLOAD Function Module, But it works perfect when I try to Download file to Local Desktop.
    But when I try to pass the same Contents to Application server file and then try to open it by downloading file then it opens BLANK pdf file.
    As per requirements I should be able to write the file correctly on Application server and If I dowload it from there it should open PDF file correctly.
    Let me know if you require further details about the issue.
    Regards
    Shital
    Edited by: shital phadake on Apr 8, 2009 9:39 PM

    Thanks Selçuk for your reply and taking time for understanding the Issue,
    I went thru Functionality of the program you suggested but dont think it matches my requirement.
    Regards
    Shital

  • Spool to PDF stored in application server

    Hi Experts,
    Please, please.....I need help.......
    I have a problem with converting spool to PDF. If I download the spool to presentation, the output is fine, BUT when I download it to application server and try to view it in al11, a set of characters comes out and if I try to save it on my local drive from the application server, an error message pops out stating that it could not read the file because it is either not a supported file type or because the file has been damaged. Please help me. I've tried doing everything I can already. I cannot run the convertion of spool file to presentation because it always ends up as run time error, that's why I have no choice but to run it in background. These files will only be viewed by different offices. This files will NOT be sent via email.  Please, please.......help......I'm really, really desperate......Here's what I did with the program....Please tell me where I went wrong.....Help......I've been on it for days and this is really causing a major headache........
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    PARAMETERS: p_file TYPE LOCALFILE DEFAULT TEXT-F02 OBLIGATORY.
    DATA: gd_buffer TYPE STRING OCCURS 0 WITH HEADER LINE.
    lt_conv LIKE gd_buffer OCCURS 0 WITH HEADER LINE.
    DATA lv_string TYPE string.
    LOOP AT it_pdf_output.
    TRANSLATE it_pdf_output USING '~'.
    CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
    ENDLOOP.
    TRANSLATE gd_buffer USING '~'.
    APPEND gd_buffer.
    DO.
    counter = strlen( gd_buffer ).
    IF counter GE 255.
    lt_conv = gd_buffer(255).
    APPEND lt_conv.
    SHIFT gd_buffer LEFT BY 255 PLACES.
    ELSE.
    lt_conv = gd_buffer(counter).
    APPEND lt_conv.
    EXIT.
    ENDIF.
    ENDDO.
    IF lt_conv[] IS NOT INITIAL.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc EQ 0.
    IF sy-subrc 0.
    MESSAGE e398(00) WITH 'Error creating file' p_file.
    ENDIF.
    LOOP AT lt_conv INTO lv_string.
    TRANSFER lv_string TO p_file.
    ENDLOOP.
    CLOSE DATASET p_file.
    IF sy-subrc EQ 0.
    ELSE.
    MESSAGE e398(00) WITH 'Error closing file' p_file.
    ENDIF.
    ELSE.
    MESSAGE e398(00) WITH 'Error creating file' p_file.
    ENDIF.
    ENDIF.

    Hi,
    maybe a look at Function Module 'CONVERT_ABAPSPOOLJOB_2_PDF' could solve your problem.
    Regards
    Mark-André

  • How to store PDF spool in Application server.

    Hi,
    I have a requirement to send Print form spool in Application server.
    For converting OTF format we have CONVERT_OTFSPOOLJOB_2_PDF.
    How to convert and store Interactive print forms spool number(PDF type) in application server.
    Thanks in advance.

    Hi,
    I have a requirement to send Print form spool in Application server.
    For converting OTF format we have CONVERT_OTFSPOOLJOB_2_PDF.
    How to convert and store Interactive print forms spool number(PDF type) in application server.
    Thanks in advance.

  • Spool to PDF output in application server

    Hi Experts,
               I have a problem with converting spool to PDF.  If I download the spool to presentation, the outputs is fine, BUT when I download it to application server and try to view it in al11, a set of characters comes out and if I try to save it on my local drive, an error message pops out stating that it could not read the file because it is either not a supported file type or because the file has been damaged.  Please help me.  I've tried doing everything I can already.  I cannot run the convertion of spool file to presentation because it always ends up as run time error, that's why I have no choice but to run it in background.  These files needs to be distributed to all branch offices.  Please, please.......help......I'm desperate......

    Hi Nikhil,
            I'm sorry....but I'm still stucked.  If I try to view the pdf output in AL11 this characters are still displayed "&#9552;&#17478;&#11569;&#11827;&#3338;&#9698;&#58319;&#54029;&#2610;‰&#8303;&#25194;&#3338;&#12119;&#26990;&#16750;&#29545;&#17774;&#25455;&#25705;&#28263;&#3338;&#25966;&#25711;&#25194;&#3338;&#13088;&#12320;&#28514;&#27149;&#2620;&#15373;&#2597;&#17509;&#30324;&#31088;&#25888;&#20559;&#21332;&#12832;†&#8262;&#28526;&#29728;&#17231;&#21842;&#18757;&#21024;&#8302;&#28530;&#28001;&#27680;&#19553;&#28263;&#8261;&#19981;&#2607;&#21625;&#28773;&#8239;&#18031;&#28276;&#3338;&#12115;&#30050;&#29817;&#28773;&#8239;&#21625;&#28773;&#12557;&#2607;&#16993;&#29541;&#18031;&#28276;&#8239;&#17263;&#30066;&#26981;&#29197;&#2607;&#20065;&#28005;&#8239;&#17968;", and when the basis transferred it to the local folder the same error came out that the file could not be read either it is corrupted or file type is not supported.  Please.....I've been on it for hours and can't seem to get the problem.  Here's what I did with the program....Please tell me where I went wrong.....Help......
    PARAMETERS: p_file TYPE LOCALFILE DEFAULT TEXT-F02 OBLIGATORY.
    DATA: gd_buffer TYPE STRING OCCURS 0 WITH HEADER LINE.
               lt_conv   LIKE gd_buffer OCCURS 0 WITH HEADER LINE.
    DATA lv_string TYPE string.
            LOOP AT it_pdf_output.
              TRANSLATE it_pdf_output USING '~'.
              CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
            ENDLOOP.
            TRANSLATE gd_buffer USING '~'.
            APPEND gd_buffer.
            DO.
              counter = strlen( gd_buffer ).
              IF counter GE 255.
                lt_conv = gd_buffer(255).
                APPEND lt_conv.
                SHIFT gd_buffer LEFT BY 255 PLACES.
              ELSE.
                lt_conv = gd_buffer(counter).
                APPEND lt_conv.
                EXIT.
              ENDIF.
            ENDDO.
            IF lt_conv[] IS NOT INITIAL.
              OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
              IF sy-subrc EQ 0.
                IF sy-subrc <> 0.
                  MESSAGE e398(00) WITH 'Error creating file' p_file.
                ENDIF.
                LOOP AT lt_conv INTO lv_string.
                  TRANSFER lv_string TO p_file.
                ENDLOOP.
                CLOSE DATASET p_file.
                IF sy-subrc EQ 0.
                ELSE.
                  MESSAGE e398(00) WITH 'Error closing file' p_file.
                ENDIF.
              ELSE.
                MESSAGE e398(00) WITH 'Error creating file' p_file.
              ENDIF.
            ENDIF.

  • How to move PDF file from Spool to Application Server?

    How to move PDF file from Spool to Application Server?
    Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
    RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
    The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.

    Hi Gemini ,
    Please refer the below links.
    [http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
    [http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
    Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM

  • How to get PDF generated by adobe forms on to Application Server

    I have a program which gathers data into an internal table. The program then calls function FP_JOB_OPEN (with relevant outputparams). Then it calls the function module name, of the Adobe Form, passing the internal table across. Then the job is closed.
    This all works fine and we end up with a PDF file on the spool (type ADSP).
    The requirement is, within the program, instead of outputting to the spool, to output the PDF document onto the Application server.
    Any help greatly appreciated.

    If the PDF spool is already generated then,
    You may need to read the PDF data , may be using 'RSPO_RETURN_SPOOLJOB
    Once you get the spool data in internal table , use Open Dataset and close dataset to download , see if that works.
    Cheers,
    VB

  • 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

  • Generate pdf file on application server

    Hi.
    I want to get an pdf file on the application server. i use a new output device "PDF_PRINT" with the device type "PDF1".
    I get files pdf files on the front-end after input filename in the c:\windows\system32 folder, but i need the files on the application server. where can i control the filename and the destination?
    with the host spool access method? and the filename???

    Hi,
    can you look at this
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e71cd560-0a01-0010-18a2-a7391f56b4f4?overridelayout=true]
    Regards,
    Muralidhar

Maybe you are looking for

  • PSE Install problem

    I have not tried a bunch of times to install PSE 10 on my Windows 7 desktop (32-bit).  It keeps getting to the point where it is trying to install the Shared Technologies package and then fails and does a roll back uninstall.  I have looked at the in

  • No i-beam cursor with Flash Text Box in Director

    I am trying to use a Flash Textbox in Director to accept typed user input. While this works okay, the ibeam cursor disappears, leaving the user no clue as to where he is within the Textbox. This happens randomly and unpredictably. Is there a way to s

  • Re getting a 2011 version of Photoshop Elements

    My friends..... I purchased a downloaded version of Adobe Photoshop Elements 9 in 2011.  More recently, due to some problems with OSX Mavericks, I had my operating system re-installed.  During that process, I lost said version of Photoshop Elements 9

  • Multiple Intercompany scenario

    Hi experts,  i have a question. Im trying to create an intercompany process. I have seven company codes (A, B, C, D, E, F,G) and each company code has its own Plant (P1, P2, etc) and one sales organization per company code (SO1, SO2, etc) Co. code-->

  • Run time error when using search

    I get a run time error when using the search in iTunes store. Running current iTunes version.