List to PDF

Hi..,
How to convert the list output (either the normal list or ALV output ) to PDF format ??
what are the function modules we use to get the spool request and to submit the program to background ??
its urgent..

Hi Sai
Go through this program whcih will explain you everything.
REPORT  z_mail_send                             .
Spool request
PARAMETERS:
  spoolno LIKE tsp01-rqident,
  ebeln LIKE ekko-ebeln.
Spool to PDF data
DATA: numbytes TYPE i,
      pdfspoolid LIKE tsp01-rqident,
      jobname LIKE tbtcjob-jobname,
      jobcount LIKE tbtcjob-jobcount,
      p_frgab type t161f-frgab.
DATA: submit_return_code TYPE sy-subrc.
DATA: memory_id(10)."  LIKE itcpp-tdspoolid.
Download data
DATA i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.
DATA otf LIKE itcoo OCCURS 1000 WITH HEADER LINE.
DATA lines LIKE tline OCCURS 100 WITH HEADER LINE.
DATA: filesize TYPE i VALUE '8866',
      fullpath TYPE string
      VALUE 'C:\purchase.pdf'.
DATA : s_otf_tab TYPE soli,
        otf_tab  TYPE soli OCCURS 0,
        gd_buffer TYPE string.
Send mail data
DATA: document_data   LIKE sodocchgi1,
      contents_txt LIKE  solisti1 OCCURS 0 WITH HEADER LINE.
     it_mess_att LIKE  SOLIx OCCURS 0 WITH HEADER LINE,
DATA:  it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      count TYPE i,
      objbin  TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE,
      objhead TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
     object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      reclist TYPE STANDARD TABLE OF somlreci1  WITH HEADER LINE.
DATA tdspoolid TYPE itcpp-tdspoolid.
START-OF-SELECTION.
  IMPORT  tdspoolid FROM MEMORY ID 'memory_id1'.
  import p_frgab from memory id 'memory_id4'.
  spoolno = tdspoolid.
  PERFORM convert_to_pdf.
  PERFORM download_pdf.
  PERFORM send_mail.
*&      Form  convert_to_pdf
      text
-->  p1        text
<--  p2        text
FORM convert_to_pdf .
  CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
       EXPORTING
         src_spoolid                    = spoolno
         no_dialog                      = ' '
        DST_DEVICE                     = 'PDF1'
      PDF_DESTINATION                =
       IMPORTING
         pdf_bytecount                  = numbytes
         pdf_spoolid                    = pdfspoolid
      OTF_PAGECOUNT                  =
         btc_jobname                    = jobname
         btc_jobcount                   = jobcount
       TABLES
         pdf                            = i_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.
  CASE sy-subrc.
   WHEN 0.
     WRITE: / 'Converted OTF to PDF successfully'(001)
           COLOR COL_POSITIVE.
    WHEN OTHERS.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDCASE.
  LOOP AT i_pdf .
    s_otf_tab-line = i_pdf-tdline.
    APPEND s_otf_tab TO otf_tab .
  ENDLOOP.
  DESCRIBE TABLE i_pdf LINES count.
  LOOP AT i_pdf.
    TRANSLATE i_pdf USING ' ~'.
    CONCATENATE gd_buffer i_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.
ENDFORM.                    " convert_to_pdf
*&      Form  download_pdf
      text
-->  p1        text
<--  p2        text
FORM download_pdf .
  CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    bin_filesize                  = filesize
    filename                      = fullpath
    filetype                      = 'BIN'
  APPEND                        = ' '
  CODEPAGE                      = ' '
  NO_BYTEORDER_MARK             = ' '
IMPORTING
   FILELENGTH                    = c
  TABLES
    data_tab                      = i_pdf
  FORMAT_TAB                    =
  EXCEPTIONS
    file_write_error              = 1
    no_batch                      = 2
    gui_refuse_filetransfer       = 3
    invalid_type                  = 4
    no_authority                  = 5
    unknown_error                 = 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.
ENDFORM.                    " download_pdf
*&      Form  send_mail
      text
-->  p1        text
<--  p2        text
FORM send_mail .
Sends PDF to external Mail
  document_data-obj_name  = 'Credit Note-MRL'.
  document_data-obj_descr =
  'Warranty Credit Note - Mahindra Renault Ltd. Automotive Sector.'.
Append the body of the mail
  CONCATENATE 'Attention: '
  'Enclosed is a PDF copy of the Realease Note of PR'
   INTO contents_txt.
  APPEND contents_txt.
  contents_txt = ''.
  APPEND contents_txt.
objtxt = 'Enclosed is a PDF copy of the Credit Note  .'.
APPEND objtxt.
  CONCATENATE 'Credit Note number is: ' ebeln INTO contents_txt.
  APPEND contents_txt.
  contents_txt = ''.
  APPEND contents_txt.
  contents_txt = ''.
  APPEND contents_txt.
  DESCRIBE TABLE contents_txt LINES count.
  READ TABLE contents_txt INDEX count.
  document_data-doc_size = ( count - 1 ) * 255 + STRLEN( contents_txt )
Creation of the entry for the compressed document
  objpack-transf_bin = space.
  objpack-head_start = 1.
  objpack-head_num = 4.
  objpack-body_start = 1.
  objpack-body_num = count.
  objpack-doc_type = 'RAW'.
  APPEND objpack.
  LOOP AT it_mess_att .
    objbin-line = it_mess_att.
    APPEND objbin.
  ENDLOOP.
  DESCRIBE TABLE objbin LINES count.
  objhead = 'PR.txt'.
  APPEND objhead.
Creation of the entry for the compressed attachment
  objpack-transf_bin = 'X'.
  objpack-head_start = 1.
  objpack-head_num = 1.
  objpack-body_start = 1.
  objpack-body_num = count.
  objpack-doc_type = 'PDF'.
  CONCATENATE 'IV' ebeln INTO objpack-obj_name.
  CONCATENATE 'MRL Credit Note - ' ebeln INTO objpack-obj_descr.
  objpack-doc_size = count * 255.
  APPEND objpack.
Completing the recipient list - Internet User
if P_FRGAB = 'S1' OR P_FRGAB = 'R1'.
  reclist-receiver = '[email protected]'.
  ELSE.
  RECLIST-RECEIVER = '[email protected]'.
  endif.
  reclist-rec_type = 'U'.
  reclist-com_type = ' '.
  APPEND reclist.
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = document_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    TABLES
      packing_list               = objpack
      object_header              = objhead
      contents_bin               = it_mess_att
      contents_txt               = contents_txt
      receivers                  = reclist
    EXCEPTIONS
      too_many_receivers         = 1
      document_not_sent          = 2
      operation_no_authorization = 4
      OTHERS                     = 99.
ENDFORM.                    " send_mail
Reward if useful!

Similar Messages

  • Problem converting ABAP list into PDF

    Hello,
    Having converted a spool request of an abap list into pdf the "intensified" attribute of the list items will disappeare. Text in the list with i.e. COL_BACKGROUND INTENSIFIED would be converted to text with blue and normal font. None of the possible combinations of colours and intenstions have produced an output in bold.
    Any ideas would be appreciated.
    Thank you in advance.
    Best regards,
    Michael Weiskat

    Save Report Output to a PDF File
    This report takes another report as input, and captures the output of that report. The output is then converted to PDF and saved to a local file. This shows how to use some of the PDF function modules, as well as an easy way to create PDF files.
    Source Code Listing
    report zabap_2_pdf.
    *-- Enhancements: only allow to be run with variant.  Then called
    *-- program will be transparent to users
    *-- TABLES
    tables:
      tsp01.
    *-- STRUCTURES
    data:
      mstr_print_parms like pri_params,
      mc_valid(1)      type c,
      mi_bytecount     type i,
      mi_length        type i,
      mi_rqident       like tsp01-rqident.
    *-- INTERNAL TABLES
    data:
      mtab_pdf    like tline occurs 0 with header line,
      mc_filename like rlgrap-filename.
    *-- SELECTION SCREEN
    parameters:
      p_repid like sy-repid, " Report to execute
      p_linsz like sy-linsz default 132, " Line size
      p_paart like sy-paart default 'X_65_132'.  " Paper Format
    start-of-selection.
    concatenate 'c:\'
                p_repid
                '.pdf'
      into mc_filename.
    *-- Setup the Print Parmaters
      call function 'GET_PRINT_PARAMETERS'
       exporting
         authority= space
         copies   = '1'
         cover_page                   = space
         data_set = space
         department                   = space
         destination                  = space
         expiration                   = '1'
         immediately                  = space
         in_archive_parameters        = space
         in_parameters                = space
         layout   = space
         mode     = space
         new_list_id                  = 'X'
         no_dialog= 'X'
         user     = sy-uname
       importing
         out_parameters               = mstr_print_parms
         valid    = mc_valid
       exceptions
         archive_info_not_found       = 1
         invalid_print_params         = 2
         invalid_archive_params       = 3
         others   = 4.
    *-- Make sure that a printer destination has been set up
    *-- If this is not done the PDF function module ABENDS
      if mstr_print_parms-pdest = space.
        mstr_print_parms-pdest = 'LOCL'.
      endif.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
      mstr_print_parms-linsz = p_linsz.
      mstr_print_parms-paart = p_paart.
      submit (p_repid) to sap-spool without spool dynpro
                       spool parameters mstr_print_parms
                       via selection-screen
                       and return.
    *-- Find out what the spool number is that was just created
      perform get_spool_number using sy-repid
                 sy-uname
        changing mi_rqident.
    *-- Convert Spool to PDF
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        exporting
          src_spoolid= mi_rqident
          no_dialog  = space
          dst_device = mstr_print_parms-pdest
        importing
          pdf_bytecount                  = mi_bytecount
        tables
          pdf        = mtab_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.
    call function 'DOWNLOAD'
         exporting
              bin_filesize            = mi_bytecount
              filename                = mc_filename
              filetype                = 'BIN'
         importing
              act_filename            = mc_filename
         tables
              data_tab                = mtab_pdf.
          FORM get_spool_number *
          Get the most recent spool created by user/report              *
    -->  F_REPID               *
    -->  F_UNAME               *
    -->  F_RQIDENT             *
    form get_spool_number using f_repid
         f_uname
                    changing f_rqident.
      data:
        lc_rq2name like tsp01-rq2name.
      concatenate f_repid+0(8)
                  f_uname+0(3)
        into lc_rq2name separated by '_'.
      select * from tsp01 where  rq2name = lc_rq2name
      order by rqcretime descending.
        f_rqident = tsp01-rqident.
        exit.
      endselect.
      if sy-subrc ne 0.
        clear f_rqident.
      endif.
    endform." get_spool_number

  • Func module to convert list to pdf without using memory id

    hi Experts,
    Is there any funct module to convert list to pdf without using memory, as I am using Convert_to_PDF func module which outputs last page only  when its running in Background.
    But my req is to output all the Pages in the PDF format.
    Sample code also appreciable,
    Reward Points are guranteed..
    Cheers
    Santosh

    Check the below postings :
    Re: Convert spool to pdf
    Convert a spooljob to a writeprotected PDF
    Hope this will helpful

  • Hi my question abt 2 convert a list into pdf format

    hi
    experts
    i had problem to convert displayed list into pdf format showing an error cannot open the file file format not supported, but i am have downloaded the file in .pdf format
    please help me
    thank you all

    Hi,
    check out this program. this might help:
    report zabap_pdf.
    tables:
      tsp01.
    data:
      mstr_print_parms like pri_params,
      mc_valid(1)      type c,
      mi_bytecount     type i,
      mi_length        type i,
      mi_rqident       like tsp01-rqident.
    *-- INTERNAL TABLES
    data:
      mtab_pdf    like tline occurs 0 with header line,
      mc_filename like rlgrap-filename.
    *-- SELECTION SCREEN
    parameters:
      p_repid like sy-repid, " Report to execute
      p_linsz like sy-linsz default 132, " Line size
      p_paart like sy-paart default 'X_65_132'.  " Paper Format
    start-of-selection.
    concatenate 'c:\'
                p_repid
                '.pdf'
      into mc_filename.
    *-- Setup the Print Parmaters
      call function 'GET_PRINT_PARAMETERS'
       exporting
         authority= space
         copies   = '1'
         cover_page                   = space
         data_set = space
         department                   = space
         destination                  = space
         expiration                   = '1'
         immediately                  = space
         in_archive_parameters        = space
         in_parameters                = space
         layout   = space
         mode     = space
         new_list_id                  = 'X'
         no_dialog= 'X'
         user     = sy-uname
       importing
         out_parameters               = mstr_print_parms
         valid    = mc_valid
       exceptions
         archive_info_not_found       = 1
         invalid_print_params         = 2
         invalid_archive_params       = 3
         others   = 4.
    *-- Make sure that a printer destination has been set up
    *-- If this is not done the PDF function module ABENDS
      if mstr_print_parms-pdest = space.
        mstr_print_parms-pdest = 'LOCL'.
      endif.
    *-- Explicitly set line width, and output format so that
    *-- the PDF conversion comes out OK
      mstr_print_parms-linsz = p_linsz.
      mstr_print_parms-paart = p_paart.
      submit (p_repid) to sap-spool without spool dynpro
                       spool parameters mstr_print_parms
                       via selection-screen
                       and return.
    *-- Find out what the spool number is that was just created
      perform get_spool_number using sy-repid
                 sy-uname
        changing mi_rqident.
    *-- Convert Spool to PDF
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        exporting
          src_spoolid= mi_rqident
          no_dialog  = space
          dst_device = mstr_print_parms-pdest
        importing
          pdf_bytecount                  = mi_bytecount
        tables
          pdf        = mtab_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.
    call function 'DOWNLOAD'
         exporting
              bin_filesize            = mi_bytecount
              filename                = mc_filename
              filetype                = 'BIN'
         importing
              act_filename            = mc_filename
         tables
              data_tab                = mtab_pdf.
          FORM get_spool_number *
          Get the most recent spool created by user/report              *
    -->  F_REPID               *
    -->  F_UNAME               *
    -->  F_RQIDENT             *
    form get_spool_number using f_repid
         f_uname
                    changing f_rqident.
      data:
        lc_rq2name like tsp01-rq2name.
      concatenate f_repid+0(8)
                  f_uname+0(3)
        into lc_rq2name separated by '_'.
      select * from tsp01 where  rq2name = lc_rq2name
      order by rqcretime descending.
        f_rqident = tsp01-rqident.
        exit.
      endselect.
      if sy-subrc ne 0.
        clear f_rqident.
      endif.
    endform." get_spool_number

  • How to add Attchment list to pdf form

    Hi,
    In my code i have a list of attachment map and a pdf document. At run time i want to add this attachment list to pdf document. Please let me know what process or api is available to do so.
    I want to render the pdf to client browser with some attachment.
    Regards
    Sunil

    hi, i got the solution
    the renderpdf process can be used to add map of the attachments. its not mandatory input parameter nd can be taken along other input parameters.
    different apis are also available
    like renderpdf, renderformhtmletc.
    regards
    Sunil Gupta

  • Refresh list of PDFs in Organizer?

    I use Organizer within Acrobat to see an overview of my PDFs. When I delete PDFs using Windows Explorer and then go back to Organizer, the PDFs still show up in the listing. Is there any way to refresh/update the list of PDFs in Organizer? Also, is there any way to delete PDFs from within Organizer?
    I'm using Acrobat Pro 8.1 on Windows XP. Thanks.

    I agree.  It would be great if Organizer would search out and check for changes in links.
    It would also be great if the organizer remembered some attribute so that if the drive or location of the PDFs changes, Organizer would find the files.  I just added a new hard drive and set it up in a RAID array.  Then I moved 'My Documents' to the mirrored RAID array.  The file structure was the same, but the drive letter changed.  Organizer was lost, and did not show me my collections.  It would be nice if there was an xml file or another database file where links for files could at least be manually updated, using an edior like Notepad++

  • ALV List as PDF

    Guys,
      Can anybody help me out in converting ALV Output List as PDF? Can anyone provide an example plz?
    How do v convert an internal table data into OTF format for PDF output? Help plz.
    Thanks in advance,
    CK

    Hi,
    use FM <b>CONVERT_ABAPSPOOLJOB_2_PDF </b> to convert it in 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.
    use FM <b>CONVERT_OTF_2_PDF</b> to convert ot to OTF Format to PDF..
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
    * EXPORTING
    * USE_OTF_MC_CMD = 'X'
    * ARCHIVE_INDEX =
    IMPORTING
    BIN_FILESIZE = P_BIN_FILESIZE
    TABLES
    OTF = P_OTF
    DOCTAB_ARCHIVE = P_DOCS
    LINES = P_LINES
    Regards,
    Santosh
    Message was edited by: Santosh Kumar P

  • How Automate Dynamically Embedding Customer Names from a List into PDF Footer?

    Mavens,
    After discovering that a PDF training workbook of mine has been widely copied (without authorization), I'd like to "personalize" future versions of this artifact with the customer/user name dynamically embedded in each PDF's footer.
    Based on your experience, what is the easiest, quickest & most economical way to: generate a set of PDFs (from a "Master") where each individual PDF is personalized with a user/customer name in the footer (e.g., "This document is licensed to {FRED BLOTZ} at {BIG COMPANY, Inc.}. Duplication or distribution is not authorized.").
    The desired workflow is:
    1. Create an MS-Excel Workbook with a list of all trainee (user) names.
    2. Open some type of "PDF Personalization" tool.
    3. Provide the path to the "Master PDF" to the tool.
    4. Provide the name of the customer (company) to the tool.
    5. Provide a path to the MS-Excel Workbook with list of individual's names.
    6. Provide a path to a folder where the tool should write the generated PDFs.
    7. Click a button ("Generate Personalized PDFs").
    Then...distribute individualized PDFs to trainees.
    Is there a tool out there somewhere which provides the desired solution?
    Thank you in advance for your experienced-based suggestions.
    Plane Wryter
    PS: While I fully appreciate the on-going discussions regarding the merits/lack-of-merits of DRM, etc...if you elect to reply to this request...please be so kind as to focus on the question as presented and avoid clambering onto a soapbox to "rant" about DRM...or suggest increasing the fee to the customer (a big firm that only pays "per-trainee" fees) to cover distribution. Thank you.

    go to database, show sql query. please paste the query in here it will be easier to help you
    if you cant seem to get it from there, go to database, database expert and edit the command file. (if that is the dataset you are using) copy and paste that.

  • Convert ALV list to PDF and send mails to respective persons

    Hi All,
    I have a requirement ..we have written a program which will give o/p in alv list.Now I got a requirement to download that program to ALV format.Kindly help me how to approch for that we have some standard FM's for that like CONVERT_ABAPSPOOLJOB_2_PDF..what are the necessary inputs I have to give for that FM,
    Second requirement is I have to send an E mail of that list to respective persons.help me on this also
    Regards
      KK

    Hi,
    Try with this program which will send the spool to email.
    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.
    *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.
    Regards,
    Raghav

  • Problems with EC Sales List in PDF-Form

    Hi,
    i have a Problem with the EC Sales List (RFASLM00).
    When i use it with SAP script Form Output (F_ASL_DE) i will be asked
    for a Printer and it works. I get an Spool-No.
    When i use it with PDF Form Output (F_ASL_DE) i will be asked for a Printer
    (i don't use LOCAL). When finished  i get the message:
    Spool number 0000000000 LIST2S - EC sales list for 0888.
    No spool is create and i don't know where i can find the output. 
    Hope anyone can help.
    Regards, Dieter

    no need to take output of PDF.
    do one thing
    run report and generate spool for LOCL
    then
    <b>RSTXPDFT4</b> run this report with that spool number then u will get output in PDF format.
    Regards
    Prabhu

  • Create Spool to convert the list in PDF

    Hi Guru's,
    I try to recover datas from my selection screen for create a list send it by mail. I have a problem when I do my submit 'ksb1' and pass my range as parameter, the error displayed is "Wrong type passing parameters to "KOSTL"" AFter I have to convert it in PDF format before to send it by mail.
      SELECT * FROM  zst_cntrllng_rsp APPENDING TABLE i_cntrllng_rsp
             WHERE zzkostl  = 'X'.
      IF sy-subrc = 0.
        LOOP AT i_cntrllng_rsp INTO wa_cntrllng_rsp.
          CLEAR i_csks.
          SELECT  * FROM  csks APPENDING TABLE i_csks
             WHERE  verak_user  = wa_cntrllng_rsp-bname.
          IF sy-subrc = 0.
            " Construct a range to fill the report.
            LOOP AT i_csks INTO wa_csks.
              wa_r_kostl-sign = 'I'.
              wa_r_kostl-option = 'EQ'.
              wa_r_kostl-low = wa_csks-kostl.
            ENDLOOP.
          ENDIF.
        ENDLOOP.
      ENDIF.
      SUBMIT rkaep000
    * I think my problem is here
      with kostl = i_r_kostl. 
    *  export list to memory
    *  and return.
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject       = wa_spool
    * EXCEPTIONS
    *   NOT_FOUND        = 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.
      ENDIF.
    *  CALL FUNCTION 'EFG_SPOOL_GET_SPOOLIDS'
    *    EXPORTING
    **   X_TAB_RNG_SPOOLIDS         =
    *      x_tab_rng_identifier      =
    **   X_TAB_RNG_TIMESTAMP        =
    ** IMPORTING
    **   Y_TAB_SPOOLIDS             =
    **   Y_TAB_SPOOL_BUFF           =
    ** EXCEPTIONS
    **   NOT_QUALIFIED              = 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.
    *  ENDIF.
    ENDFORM.                    "get_costcenter
    Edited by: rahhaoui mohamed on Jun 12, 2009 4:01 PM
    Edited by: rahhaoui mohamed on Jun 12, 2009 4:02 PM

       SUBMIT rkaep000
    * I think my problem is here
       with KOSTL-LOW = i_r_kostl.    "it is not kostl it is kostl-low press f1 and see the screen field name
    *  export list to memory
    *  and return.
    or try this way..
            LOOP AT i_csks INTO wa_csks.
              wa_r_kostl-sign = 'I'.
              wa_r_kostl-option = 'EQ'.
              wa_r_kostl-low = wa_csks-kostl.
             append wa_r_kostl to i_r_kostl           "add this
            ENDLOOP.
          ENDIF.
        ENDLOOP.
      SUBMIT rkaep000
         with kostl IN i_r_kostl    "Use IN in place of = operator
               EXPORTING LIST TO MEMORY AND RETURN.
    Prabhudas

  • Converting list in pdf to Excel using Adobe ExportPDF

    I have a document in .pdf format that is a list including columns with Town, Name, Address and Phone number, listed on the page in two columns, divided in the center. When I convert the document to Excel format, the first column returns gobblety ****, but the second column formats brilliantly. Is there anyway to modify the scan settings so that it will properly input the data when scanned? I need to do this with 158 pages of data, and returning half as an unusable format isn't working well for me. Any help or direction would be greatly appreciated.

    Hi,
    Please send me your PDF file so that I can review the problem you have and please use below site to share your file:
    https://adobeformscentral.com/?f=qJiclooYWGGNFtWfj8g3wg#
    Thank you.
    Hisami

  • Opening a list item pdf attachment from the display form in a new window

    I have a list setup in which attachments are enabled.
    Users attach pdf's to list items.
    When they go into the display form for a list item and click on a pdf attachment in the "Attachments" area at the bottom of the form, it opens in the same browser window.
    I would like to amend this so it opens in a new window.  Has anyone found a fix for this?
    Thanks in advance,
    Mark

    Hi ,
    Put the code below in your DispForm.aspx page .The you can open the attachments in a new window. Including all the other links on the DispForm.aspx page .
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    $(function(){ 
    $('a').click(function(){
                    window.open(this.href);
                   return false;
    });</script>
    Thanks,
    Entan Ming

  • List oppenned pdf documents in reader, close one and reopen on the same page

    Hi,
    I am working in TeX and that program creates pdf documents for me. What I need when I creating new one and having old one oppened is to close old one, create new one from tex source code and reopen new one. I wish to get some api best .NET method to list all openned PDF documents, to close selected document and remember page it was oppened on. Then I will create a new pdf file (I know how). And then I want to open file on the page the previous file was closed on.
    If I dont close the file, I can not create new one. I can close all instances of acroread32 but I want only to close my document and be able to know page which was openned on. I tried SDK but dont know what functions I can look on. I also need free solution, not paid one (not some functions in .NET classes shipped with Acrobat instalation).
    Thanks for your reply.

    It looks like this:
    I want to click on the check box and get the corresponding value for f02_000X (or could I refer to the class name if I gave it a class)
    There are several tables with the same format as below so it needs to work out the table id in the reference.
    <table id="report_R1641794306363434600" cellspacing="0" cellpadding="0" border="0" summary="">
    <tbody>
    <tr>
    <td></td>
    </tr>
    <tr>
    <th id="BOX"></th>
    <th id="Name"> </th>
    </tr>
    <tr>
    <td colspan="11">
    <table width="100%" cellspacing="0" cellpadding="1" summary="" style="border-bottom:1px #959562 dotted;">
    <tbody>
    <tr>
    <td valign="top" nowrap="nowrap" style="padding:1px;"></td>
    </tr>
    </tbody>
    </table>
    </td>
    </tr>
    <tr>
    <td headers="BOX">
    <label class="hideMeButHearMe" for="f01_0001"> </label>
    <input id="f01_0001_01" class="boxhop" type="checkbox" onclick="if (this.checked) {apex.jQuery('#f01_0001').val('Y');} else {apex.jQuery('#f01_0001').val('');}" value="Y" name="f01_NOSUBMIT">
    <input id="f01_0001" class="boxhop" type="hidden" value="" name="f01">
    </td>
    <td headers="Name">
    Administrator
    <input id="f02_0001" type="hidden" value="2072" name="f02">
    </td>
    </tr>
    <tr>
    <td colspan="11">
    <table width="100%" cellspacing="0" cellpadding="1" summary="" style="border-bottom:1px #959562 dotted;">
    </td>
    </tr>
    <tr>
    <td headers="BOX">
    <td headers="Name">
    Angela Murray
    <input id="f02_0002" type="hidden" value="2082" name="f02">
    </td>
    </tr>
    <tr>
    </tbody>
    </table>

  • List display- PDF- email

    Hi Folks,
      can someone please share how to convert an list display to PDF in LANDSCAPE then email as attachment.
    Best Regards,
    Babu
    Moderator message: FAQ, please search for available information/documentation.
    Edited by: Thomas Zloch on Jul 12, 2011 12:29 PM

    Answer: In Settings, "Mail, Contacts, and Calendars" has an option to preview NONE of the message lines. I don't know if that was there before I tried to download "SBSettings" so I could hide icons on my "desktop" (called SpringBoard on the iPhone). Don't know if I even have SBSettings yet, can't find it, but I now can hide the message content lines.

Maybe you are looking for