Convert spool to OTF format

Hi All,
My requirement:
I have a report which generates PDF format for all the employees provided on the selection screen ,for this i used the FM :
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
    exporting
      src_spoolid = max_spool
      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.
Now i want to create an RFC function module which has  to generate  PDF binary data using the PDF generation report .
The process which i am following is :
.       Creating  RFC function module with the import parameter u2018PERNRu2019
·         call this report YREPORT inside the RFC using the PERNR and receive the OTF data from report using buffer.
·         Then convert the OTF data into PDF lines using the function module u2018CONVERT_OTFu2019
·         And then convert the PDF lines in to PDF binary data.
Please suggest how to get OTF data format from report using buffer .Please provide any FM for this & also provide PDF lines into PDF binary data
Regards,
Bharat

what below code does is:
1: it creates a job hence spool is generated.
2: it call  a ADOBE form hence PDF object is generated . (which you may not need)
3: it converts PDF to SOLIX or binary PDF for sending as an mail attachment.
  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = wa_outputparams
    EXCEPTIONS
      cancel          = 0
      usage_error     = 0
      system_error    = 0
      internal_error  = 0
      OTHERS          = 0.
* Processing should continue inspite of errors
* so made Sy-Subrc as 0
* Set form language and country (->form locale)
  wa_docparams-langu   = lc_language.
  wa_docparams-country = lc_country.
* Pass Data to the Form Interface
  CALL FUNCTION lv_form_name
    EXPORTING
      /1bcdwb/docparams  = wa_docparams
      t_stud_data        = wa_mailtab1
    IMPORTING
      /1bcdwb/formoutput = wa_pdfobject
    EXCEPTIONS
      usage_error        = 1
      system_error       = 2
      internal_error     = 3
      OTHERS             = 4.
* Convert PDF Object to type SOLIX
  CALL METHOD cl_document_bcs=>xstring_to_solix
    EXPORTING
      ip_xstring = wa_pdfobject-pdf
    RECEIVING
      rt_solix   = it_attachment.
ags.

Similar Messages

  • How to upload a PDF file and convert it to OTF format

    We have come across rquirements like converting OTF to PDF but my requirement is to read a PDF file in SAP and convert it to OTF format for printing.
    Can anyone please help me with the Function Modules to do so.

    Hello,
    Try the following FM:
    CONVERT_OTF Convert SAP documents (SAPScript) to other types.
    Example:
    CALL FUNCTION "CONVERT_OTF"
    EXPORTING FORMAT = "PDF"
    IMPORTING BIN_FILESIZE = FILE_LEN
    TABLES OTF = OTFDATA
    LINES = PDFDATA
    EXCEPTIONS ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    OTHERS = 4.
    Hope this helps.
    Reward if helpful.
    Regards,
    Vasanth

  • Convert SPOOL to BIN format

    Is there any function module to convert spool to BIN format
    Thanks,
    V

    Hi ,
    Try this link:
    https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-GettingPDFfilefromspooling+list
    This is a good example of saving files from splooing list.
    May it helps you.
    Regards.
    DS

  • ABAP spool to OTF format

    Hi,
    Is there any function module available to convert ABAP spool Job to OTF format?.
    Final requirement is to convert this to PDF, however CONVERT_ABAPSPOOLJOB_2_PDF  is not found suitable for this requirement, since the converted output needs to be of  type  XSTRING.
    For WebDynpro, application, I have one solution. Please see the below URL
    http://****************/Tutorials/Smartforms/SFinEPasPDF/Page1.htm
    I could convert ABAP spool to RTF format, now I would like to have a solution for converting this RTF file to OTF and then use function module CONVERT_OTF. This function module give converted result in export parameter of type XSTRING.
    Please advice any solution for this
    Regards
    Sujith

    Hi,
    Try with the report program RSTXPDFT4(ECC6).
    With Regards,
    Sakthi

  • Error in converting Spool to HTML format.

    Hi Gurus,
    I am reading SPool and converting that into HTML formt. Please do find below code for the same.
    Submit report to convert the spool to HTML format
      SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN
      WITH rqident = p_spoolno.
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = gt_listobj
        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.
    Convert the spool to HTML format
      CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
       EXPORTING
       REPORT_NAME         =
         template_name       = 'WEBREPORTING_REPORT'
        TABLES
          html                = p_html_tab
          listobject          = gt_listobj.
    >>>>>>>>>>>>>>>>>>>
    And i send p_html_tab as attachement to email.
    When I opened the attachement, i can view only half page in htm.
    How can i get the full page in htm.

    First convert the spool to internal table by using FM
    RSPO_RETURN_ABAP_SPOOLJOB
    Next from internal table to HTML....
    Link: /people/rammanohar.tiwari/blog/2006/01/29/abap-utility-print-screen-to-html
    or try the following
    Please try the follwoing:
    1. define HTML internal table with ref to type W3HTML
    2. download it as BIN type and give total lenght of the strings as a parameter in the down load.
    See the code extract below:
    describe table html lines entries.
    read table html into w_html index entries.
    size = ( entries - 1 ) * 255 + strlen( w_html ).
    concatenate p_path file into file.
    call function 'WS_DOWNLOAD'
    exporting
    bin_filesize = size
    filename = file
    filetype = 'BIN'
    tables
    data_tab = html

  • Converting Spool to Pdf format

    Hi,
    How do you convert a SAP Script Spool in TCode SP01 to a pdf format?
    Any helpw would be greatly appreciated.
    Thanks in advance.
    Mick

    Just today someone has posted this link somewhere
    https://wiki.sdn.sap.com/wiki/display/sandbox/Conversion%20of%20Spool%20Request%20Data%20into%20PDF%20and%20Excel%20Format%20and%20Send%20it%20into%20Mail

  • Convert spools to Pdf format

    Hi,
    I know a standard program  RSTXPDFT4 which converts a single spool to PDF.
    Do we have any thing for multiple spools? My requirement is I will key in Spool numbers via Selection options and I want Pdf file separetly to be dumped for each file
    in to folder on to my hard drive.
    Regards
    Vara

    You can start with this:
    PARAMETERS: spoolid LIKE tsp01-rqident OBLIGATORY.   "DEFAULT 9429.
    DATA BEGIN OF pdf_table OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA END   OF pdf_table.
    DATA pdf_fsize TYPE i.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
         EXPORTING
              src_spoolid   = spoolid
              no_dialog     = 'X'
         IMPORTING
              pdf_bytecount = pdf_fsize
         TABLES
              pdf           = pdf_table
         EXCEPTIONS
              OTHERS        = 0.
    CALL FUNCTION 'DOWNLOAD'
         EXPORTING
              bin_filesize = pdf_fsize
              filetype     = 'BIN'
         TABLES
              data_tab     = pdf_table.
    Rob

  • Reg : Converting a report list to OTF format.

    Hi Folks,
        Is there any function module which converts spool of (report)  list type to OTF type? As we need to merge multiple spools (list types) into single PDF file. We have
    1) RSPO_RETURN_SPOOLJOB,
    2) CONVERT_OTF_2_PDF
    which can merge multiple spools  into single PDF file, but these function modules accepts only spools of OTF format.
    Any help will be rewarded.....

    Hi ,
    See this code , this gets smartform output pages into the jobinfo document "ls_job_info' , then converts it into OTF format and then PDF. See if this can  give u some idea.
    CALL FUNCTION lf_fm_name
          EXPORTING
            archive_index      = toa_dara
            archive_parameters = arc_params
            control_parameters = ls_control_param
            mail_recipient     = ls_recipient
            mail_sender        = ls_sender
            output_options     = ls_composer_param
            user_settings      = space
            is_bil_invoice     = ls_bil_invoice
            is_nast            = nast
            is_repeat          = repeat
          IMPORTING
            job_output_info    = ls_job_info
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
        IMPORTING
          bin_filesize          = v_len_in
        TABLES
          otf                   = i_otf
          lines                 = i_tline
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          OTHERS                = 4.
      IF sy-subrc <> 0.
      ENDIF.
      LOOP AT i_tline.
        TRANSLATE i_tline USING '~'.
        CONCATENATE wa_buffer i_tline INTO wa_buffer.
      ENDLOOP.
      TRANSLATE wa_buffer USING '~'.
      DO.
        i_record = wa_buffer.
        APPEND i_record.
        SHIFT wa_buffer LEFT BY 255 PLACES.
        IF wa_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    Attachment
      REFRESH: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = i_record[].
    Create Message Body Title and Description
      i_objtxt = 'Invoice output Attached!'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name = 'Invoice'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'Invoice'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Attachment (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-doc_size = v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'Invoice'.
      APPEND i_objpack.
    Regards,
    Uma

  • Problem in converting Spool to PDF file, having non-English characters

    Hi All,
            I have problem in converting Spool to PDF format.
    Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF  FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
    I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
    Regards,
    Navin.

    Hi All,
            I have problem in converting Spool to PDF format.
    Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF  FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
    I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
    Regards,
    Navin.

  • Problem in converting Spool Request into PDF format

    Hi,
      I am facing problem to convert spool request (which store output of sap script) in to PDF format. Actually I have converted it with function module 'CONVERT_OTFSPOOLJOB_2_PDF' and it is working properly but the problem occurs where the BOLD fonts are used. I am unable to see the Text/Address where i have used Bold Font in script (PDF FORMAT). Even though in (SPO1) spool request shows every thing perfectly (along with Bold Font). It will great if you could suggest me something.
    Thanks,
    Pradeep

    Hi Pradeep,
    Use ,
    Closing the Sapscript, we save data (OTF) in a table
    CALL FUNCTION 'CLOSE_FORM'
    TABLES
    otfdata = t_otfdata
    EXCEPTIONS
    unopened = 1
    bad_pageformat_for_print = 2
    send_error = 3
    spool_error = 4
    OTHERS = 5.
    DATA: BEGIN OF t_otfdata2 OCCURS 0.
    INCLUDE STRUCTURE solisti1.
    DATA: END OF t_otfdata2.
    Move OTF data to another table with lenght 255
    LOOP AT t_otfdata.
    CONCATENATE t_otfdata-tdprintcom t_otfdata-tdprintpar INTO t_otfdata2.
    APPEND t_otfdata2.
    ENDLOOP.
    Convert OTF format to PDF
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
    format_src = 'OTF'
    format_dst = 'PDF'
    devtype = 'PRINTER'
    FUNCPARA =
    len_in = len_in
    IMPORTING
    len_out = len_out
    TABLES
    content_in = t_otfdata2
    content_out = t_pdfdata
    EXCEPTIONS
    err_conv_failed = 1
    OTHERS = 2.
    Have a look at Progs. RSTXPDF4 and RSTXPDFT2 for converting the Spool to PDF.
    Regards,
    Raj
    Message was edited by: Rajasekhar Dinavahi
    Message was edited by: Rajasekhar Dinavahi

  • Convert the spool to xls format and email through attachment to the user

    Hi all,
    When I execute a report in background, I get spool. I need to convert the spool to xls format and email through attachment to the user.The xls file should not be saved on local system.
    If I use the Spool Recepient tab in SM37 it mails the spool list as .txt file to the mail receipient. But I need to send it as an .xls file.
    Can any one help me on this

    Did you get the solution? i have the same problem.

  • Converting the layout from OTF format into PDF

    Hi Experts,
    I am new to SMART FORMS,I don't have a clue about how to convert the layout from OTF format into PDF format and how to store it in Presentation server.
    Please send me a Model program or step by step approach of the same.
    Useful inputs will be rewarded higher points.
    Thanks in Advance,
    Dharani

    Hi,
    The steps are given below:-
    1) First get the name of your generated function module for the smartforms.
    2) Then call the generated function module.
    3) Then use the FM:CONVERT_OTF' to convert into PDF as shown below:-
    call function 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
        IMPORTING
          bin_filesize          = w_pdf_len
          bin_file              = w_pdf_xstring
        TABLES
          OTF                   = OUTPUT_DATA-OTFDATA
          LINES                = LT_LINES
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 4
          others                = 5.
    Hope this is clear.
    Pravat.
    <i>*Reward points if helpful.</i>

  • How to convert spool request to pdf format (to send mail) - SAP 3.1H

    Hi,
       I am working in 3.1H version. How to convert spool request into pdf cormat to send a mail?. Spool request is in TEXT format.
    regards,
    sundaram J.

    Hi sundaram,
    1. I suppose u know how to send
        mail with attachment.
    2. If that is the case,
       then no need to do anything.
    3. Bcos
       There is setting in SCOT,
       for INTERNET
       ABAP List ---> PDF
       Raw TEXT  -
    PDF
      (Your basis team will help u)
    4.  text data will get automatically converted
       to pdf and get mailed.
    regards,
    amit m.

  • OTF formatted Spool and ABAP spool to be merged into a pdf

    I am creating a program which merges two spools into one pdf document. Now, the two spools are different, one is in otf format since its a SAP script. Other is a ABAP list. I use function modules CONVERT_ABAPSPOOLJOB_2_PDF & CONVERT_OTFSPOOLJOB_2_PDF to get data in internal table in pdf format. Then I append one after the other & then download. The problem with this is only one of the spools can be seen in output(pdf file) and not both.
    Can somebody assist.
    Thanks.
    Shiv

    Hi Shiv,
    We have similar issue when merging two smartforms.
    We have applied the following logic :
    First populated an internal table OTFDATA1 with OTF data of both forms:
    Ex:
        LOOP AT JOB_OUTPUT_INFO-OTFDATA INTO WA_OTFDATA.
          APPEND WA_OTFDATA TO OTFDATA1.
          CLEAR OTFDATA1.
        ENDLOOP.
    The we have called the following function:
    First populated an internal table
         CALL FUNCTION 'CONVERT_OTF'
            EXPORTING
              FORMAT                = 'PDF'
            IMPORTING
              BIN_FILESIZE          = G_FILESIZE
            TABLES
              OTF                   = OTFDATA1
              LINES                 = I_PDF_TAB
            EXCEPTIONS
              ERR_MAX_LINEWIDTH     = 1
              ERR_FORMAT            = 2
              ERR_CONV_NOT_POSSIBLE = 3
              ERR_BAD_OTF           = 4.
    Then send to File syatem :
    CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
        EXPORTING
          LOGICAL_PATH               = L_LOGICALPATH
          FILE_NAME                  = L_INFILE
        IMPORTING
          FILE_NAME_WITH_PATH        = L_FILE
        EXCEPTIONS
          PATH_NOT_FOUND             = 1
          MISSING_PARAMETER          = 2
          OPERATING_SYSTEM_NOT_FOUND = 3
          FILE_SYSTEM_NOT_FOUND      = 4
          OTHERS                     = 5.
      IF SY-SUBRC <> 0.
        MESSAGE S000(ZV) WITH 'Unable to download PDF file'.
      ELSE.
        MESSAGE S000(ZV) WITH 'PDF file downloaded Successfully'.
      ENDIF.
    May be this will help.
    Lanka

  • Converting raw data from memory to OTF format

    hi all,
         i have a requirment where i need to submit a report and move the corresponding output to memory get the same back in OTF format and export it in an RFC.  i tried using different function modules but could not find the exact where i can convert from memory to OTF format or directly at the time of submit can store it in OTF format.
          tried converting list to asci but could not get the same report output,
    thanks,
    raju,

    Hi krishnam,
    You can try this function module
    SX_OBJECT_CONVERT_OTF_RAW
    Regards
    Sumit Bhutani

Maybe you are looking for

  • Setup problem - sql server 2014 - "could not find the database engine startup handle" - 0x851a0019

    I tried to install ,deleted and re-installed several times and no help at all. visual studio 2013 with update 2 rc and adk installed in my computer. error code: 0x851a0019 error messege in setup: could not find the database engine startup handle edit

  • The sims 2 expansion packs?

    i have the sims 2 and 9 of the expansion packs, i got mac os x snow leopard version 10.6.3 because it said on the boxes that i need version 10.3.9 or later, the sims 2 works on its own, and still works when i add pets to the game but it won't work if

  • How to create MDI form in flex4 ?

    Hi to all .....i am new to this flex world i am trying to create MDI form can any one help me pls if u have samll program pls send me with full runnable source. pls help me

  • Remote control service

    On computer with XP SP2, The remote control service does not start up. It is set to automatic, but does not start. When I try remote conrtol, I get remote agent not found. If I click on it and select start, then everything works. Does anyone have a s

  • Wifi freeze! MBP will freeze entire wireless network on "join network"

    This took a quite time to prove. My MacBook Pro on connecting to WiFi or on renewal of IP via wireless will freeze entire LAN (cut off) all other devices! And of course it will not connect it self. I think it would work if a static IP assigned. Now o