Sap Script To OTF

Hi Experts,
I am trying to convert a script to pdf data.
In the open_form I set getotf = 'X' and in the close form , i get the OTf data.
I convert this otf to pdf data.
In the pdf output, I only have the static fields and no data.Though the number of pages generated are same in the PDF output and the script.
Please help me to figure it out

try this
Here is some sample code for achieving manual conversion to the OTF format.
In case of more than 10 pages:
- Check the spool request
- Click Edit -> OTF display -> No. of OTF pages
Convert SAP Script to text:
- Display the spool request
- Then click Goto -> List display
Automatic conversion to the OTF format:
tables: tline.
data:   begin of int_tline1 occurs 100.
             include structure tline.
data:   end of int_tline1.
call function 'OPEN_FORM'
                 device         = 'OTF_MEM'
after CLOSE_FORM
call function 'CONVERT_OTF_MEMORY'
     exporting
          format                = 'ASCII'
          max_linewidth         = 132
     tables
           lines                 = int_tline1
     exceptions
          err_max_linewidth        = 1
          err_format                    = 2
          err_conv_not_possible = 3
          others                          = 4.
write the text file to spool
loop at int_tline1.
   if int_tline1-tdline = space.
      skip.
   else.
      write:/ int_tline1-tdline.
   endif.
endloop.
regards,
srinivas
<b>*reward for useful answers*</b>

Similar Messages

  • Converting SAP Script to OTF

    Hi,
    I am following the below mentioned steps to create a PDF-Output file is to:
    1. Creating a sapscript form
    2. Close the form using the TABLES parameter to receive an OTF-table
    3. Convert OTF to PDF using SX_OBJECT_CONVERT_OTF_PDF
    4. Send the object using SO_DOCUMENT_SEND_API1
    My problem is When the function 'CLOSE_FORM' occurs,
    the OTF- table is empty, i do not know why it does not get filled though i can see a print preview of the script file, so i am unable to go to step 3 and 4.
    Anyone who has come across this issue earlier, Can share their knowledge.
    All inputs are Rewarded!!!
    Cheers!
    K

    Hi
    This is a my simple code:
    TABLES ITCPO.
    DATA: T_OTF TYPE TABLE OF ITCOO.
    ITCPO-TDGETOTF = 'X'.
    CALL FUNCTION 'OPEN_FORM'
         EXPORTING
              DEVICE                      = 'PRINTER'
              DIALOG                      = 'X'
              FORM                        = 'ZTEST'
              OPTIONS                     = ITCPO
         EXCEPTIONS
              CANCELED                    = 1
              DEVICE                      = 2
              FORM                        = 3
              OPTIONS                     = 4
              UNCLOSED                    = 5
              MAIL_OPTIONS                = 6
              ARCHIVE_ERROR               = 7
              INVALID_FAX_NUMBER          = 8
              MORE_PARAMS_NEEDED_IN_BATCH = 9
              SPOOL_ERROR                 = 10
              OTHERS                      = 11.
    IF SY-SUBRC <> 0.
    ELSE.
      CALL FUNCTION 'CLOSE_FORM'
           TABLES
                OTFDATA                  = T_OTF
           EXCEPTIONS
                UNOPENED                 = 1
                BAD_PAGEFORMAT_FOR_PRINT = 2
                SEND_ERROR               = 3
                SPOOL_ERROR              = 4
                OTHERS                   = 5.
    ENDIF.
    It works fine, i.e. I can get the OTF data from CLOSE_FORM, there's only a strange thing: if I set the flag for OTF I can't see any preview (u've written: "though i can see a print preview of the script file"), but the system returns directly the OTF.
    Max

  • It can not displayed sap script

    i have to post invoice in vendor a/c,then run to APP successfully,then execute  spool,actually hear it can displayed ABAP list file, SAP script(otf) file,and SAP script file(otf) but hear only displayed ABAP list file, SAP script(otf) file it can not displayed vendor payment advice list why. pls give me answer

    Hi Shirley,
    I assume the hardware is less on the target than on the source or they are different at least in terms of hardware specs
    If the system is not starting, check the dev_disp.log, the stderr* files, and the dev_w0 log from the work directory to find the exact error. Does the system start if you increase or decrease this value?
    Regards,
    Paul

  • SAP Script OTF data problem

    hello,
    Im trying to convert a script to pdf data.
    In the open_form I set getotf = 'X' and in the close form , i get the OTf data.
    I convert this otf to pdf data.
    In the pdf output, I only have the static fields and no data.Though the number of pages generated are same in the PDF output and the script.
    help me figure it out ..

    Hi,
    There is a very useful post to check how you have converted otf to pdf:
    Emailing Sap Scripts
    Cheers,
    Bhanu

  • Convert OTF along with Print preview in SAP Script

    Hello All,
    I was getting a print Preview for the sap script, now with the new requirement, I had to capture otf data too in OPEN_FORM. so I have added  "TDGETOTF = X", and that gives me otf data which I am converting it to PDF. now the problem is I am not getting preview anymore. my requirement is to have both, Preview and otf data. I have tired serching in forums and also used a function module SSFCOMP_PDF_PREVIEW, but no luck. what am I missing here. Please suggest.
    Thanks-
                                            TDPAGESLCT                                       
                                            TDCOPIES                                             1
                                            TDDEST                                             LOCL
                                            TDPRINTER                                       
                                            TDPREVIEW                                             X
                                            TDNOPREV                                       
                                            TDNOPRINT                                       
                                            TDNEWID                                             X
                                            TDDATASET                                             SAP11
                                            TDSUFFIX1                                             LOCL
                                            TDSUFFIX2                                             1000
                                            TDIMMED                                       
                                            TDDELETE                                       
                                            TDLIFETIME                                             7
                                            TDSCHEDULE                                       
                                            TDSENDDATE                                             00000000
                                            TDSENDTIME                                             000000
                                            TDTELELAND                                       
                                            TDTELENUM                                       
                                            TDTITLE                                       
                                            TDTEST                                       
                                            TDPROGRAM                                       
                                            TDSCRNPOS                                             000000000000000
                                            TDCOVER                                             D
                                            TDCOVTITLE                                       
                                            TDRECEIVER                                             ABCDEFGH
                                            TDDIVISION                                       
                                            TDAUTORITY                                       
                                            TDARMOD      
    TDIEXIT                                       
    TDGETOTF                                             X
    TDFAXUSER                                       
    TDRDIDEV                                       
    TDNOARMCH                                       
    TDFINAL                                       
    RQPOSNAME                                       
    BCS_REQST                                       
    BCS_STATUS

    Maybe you can call the form twice - once with tdgetotf = 'X', the second time with it blank.

  • Get OTF data of an SAP SCRIPT

    Hi,
    I have a situation where I have to call a standard report from my custom report which is based on some condition.
    This is fine. But the standard report which I am calling is print program of an SAP Script.
    So, the requirement now is that my custom report should be able to send an email of the SAP Script output. For this I need to have the OTF data of the SAP Script in my custom report.
    How to get this?
    Your help will be highly appreciated.
    Thanks,
    -Sandeep

    Hi,
    Go through these links,here they mentioned how to capture OTF data into internal table
    http://scn.sap.com/thread/1083143

  • To add Cover page in SAP Script if pages are more than 10.

    Hello Experts,
    I want to print a Cover page first if and only if number of pages exceeds 10 in SAP Script.
    Cover Page should be the first page and then the remaiing pages.

    It's not possible to find the no of pages the script will generate, until it's printed. Again, you need the cover letter as the first page.
    There could be a solution to your requirement. Call the script and get OTF format without printing it to spool. You will get to know the no of pages in the main script . If it's more than 10, call the secondary script to get the OTF data of cover letter. Merge the OTF of main script to OTF of cover letter and print the OTF data to spool using FM PRINT_OTF.
    Check this link for similar code. In your case, the spool of the two sapscripts needs to be merged.
    Re: Smartform to Spool

  • Write Special Characters in PDF file from SAP Script

    Hi there,
    Need a quick help...
    We are converting SAP Script to PDF using the function module CONVERT_OTF
    and saving the file on presentation server using GUI_DOWNLOAD...
    But in certain cases where the item text is maintained with some special
    characters like @#$% u03B1 u03B2 u03B3 u03B4 ®... then, some of these characters are seen
    as junk/garbage characters...
    how do we handle this??
    P.S. Our Forms are already using Korean Font...
    Any help is highly appreciated
    Kind Regards,
    Tanuja

    Hi,
    Use the FM  CONVERT_OTF to get the Binary data and  down load it as PDF .
    sample
    */ Convert the OTF data into PDF.
        call function 'CONVERT_OTF'
         exporting
           format                      = 'PDF'
         importing
           bin_filesize                = lv_bin_filesize
            bin_file                   = lv_xstring
          tables
            otf                        = lt_otf_data-otfdata[]
            lines                      = lt_pdf_data
         exceptions
           err_max_linewidth           = 1
           err_format                  = 2
           err_conv_not_possible       = 3
           err_bad_otf                 = 4
           others                      = 5  .
    */ Convert the Xstring data into PDF
        call method cl_document_bcs=>xstring_to_solix
          exporting
            ip_xstring = lv_xstring
          receiving
            rt_solix   = lt_mess_att .
    Then down load the table lt_mess_att  with extension PDF.
    Edited by: UmaMaheswaraRao Surapaneni on Apr 1, 2009 5:44 PM

  • Converting Script from OTF to PDF format

    Hi Experts,
    Using FM CONVERT_OTF in SAP Script print program I am converting data of Script from OTF to PDF format but the data in PDF document srinks and looks like slightly overlapping one leter on the other, can any ony please tell me that how can I avaoid this.
    Thanks in Advance
    Best Regards
    Venkat

    Dear Venkatesh,
    I have the same scenario. I have to convert Script to PDF and then write it to FTP Server.
    Could you please provide me the code which you have used?
    Regards,
    Chaitanya A

  • How to save the output of sap script to pdf document in sap

    hi abapers
    how to save the output of sap script in sap so that can retrieve the saved document later.
    i have to save the rcia output from sap script in pdf document in sap so that it can be retrieved later
    how to use dms

    Hi deepika,
    This thread will solve ur problem OTF  -> PDF
    Regards,
    Pravin

  • Sap script convert to pdf and then send to email

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

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

  • SAP Script to PDF and then Archeiving

    Hi
    Kindly let me know how to convert SAP Script to PDF. And once it is done, archeiving of data is to be done.
    Regards
    Ramesh Sundaram

    Hi,
    Use the code below
    Before OPEN_FORM
    Data: gi_otf TYPE STANDARD TABLE OF itcoo,
             gi_line TYPE TABLE OF tline,
             bin_file TYPE i.
             itcpo-tdgetotf = 'X'.
    After CLOSE_FORM
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
      IMPORTING
        bin_filesize          = bin_file  
      TABLES
        otf                   = gi_otf
        lines                 = gi_line
      EXCEPTIONS
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        err_bad_otf           = 4
        OTHERS                = 5.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Manish

  • To convert Sap Script output to PDF format and send it via email.

    Hi Friends,
    Could any one please tell me, how to convert the Sap Script output to PDF format and send it via email. If any one have the code, kindly mail me to [email protected]
    Thanks & Regards,
    John

    Plese check this sample code from other thread.
    REPORT zzz_jaytest .
    Types Declaration
    TYPES : BEGIN OF ty_pa0001,
    pernr TYPE pa0001-pernr,
    bukrs TYPE pa0001-bukrs,
    werks TYPE pa0001-werks,
    END OF ty_pa0001.
    Internal Table Declaration
    DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
    i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
    i_content_txt TYPE soli_tab, "Content
    i_content_bin TYPE solix_tab, "Content
    i_objhead TYPE soli_tab,
    Work Area Declaration
    w_pa0001 TYPE ty_pa0001, "For pa0001 Details
    w_res TYPE itcpp, "SAPscript output
    "parameters
    w_otf TYPE itcoo, "For OTF
    w_pdf TYPE solisti1, "For PDF
    w_transfer_bin TYPE sx_boolean, "Content
    w_options TYPE itcpo, "SAPscript output
    "interface
    Variable Declaration
    v_len_in TYPE so_obj_len,
    v_size TYPE i.
    Constants Declaration
    CONSTANTS : c_x TYPE c VALUE 'X', "X
    c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
    c_otf TYPE sx_format VALUE 'OTF', "OTF
    c_pdf TYPE sx_format VALUE 'PDF', "PDF
    c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
    c_bin TYPE char10 VALUE 'BIN', "BIN
    c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
    "File Name
    c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
    START-OF-SELECTION.
    Selecting the records from pa0001
    SELECT pernr bukrs werks FROM pa0001
    INTO TABLE i_pa0001 UP TO 10 ROWS.
    Setting the options
    w_options-tdcopies = 1 ."Number of copies
    w_options-tdnoprev = c_x."No print preview
    w_options-tdgetotf = c_x."Return of OTF table
    w_options-tddest = c_locl."Spool: Output device
    Opening the form
    CALL FUNCTION 'OPEN_FORM'
    EXPORTING
    form = c_form
    device = c_printer
    language = sy-langu
    OPTIONS = w_options
    IMPORTING
    RESULT = w_res.
    LOOP AT i_pa0001 INTO w_pa0001.
    Writting into the form
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
    element = 'MAIN'
    window = 'MAIN'.
    ENDLOOP.
    Closing the form
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
    RESULT = w_res
    TABLES
    otfdata = i_otf
    EXCEPTIONS
    unopened = 1
    bad_pageformat_for_print = 2
    send_error = 3
    spool_error = 4
    codepage = 5
    OTHERS = 6.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Converting OTF data to single line
    LOOP AT i_otf INTO w_otf.
    CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
    INTO w_pdf.
    APPEND w_pdf TO i_content_txt.
    ENDLOOP.
    Converting to PDF Format
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
    format_src = c_otf
    format_dst = c_pdf
    devtype = c_printer
    CHANGING
    transfer_bin = w_transfer_bin
    content_txt = i_content_txt
    content_bin = i_content_bin
    objhead = i_objhead
    len = v_len_in
    EXCEPTIONS
    err_conv_failed = 1
    OTHERS = 2.
    v_size = v_len_in.
    Downloading the PDF File
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    bin_filesize = v_size
    filename = c_name
    filetype = c_bin
    TABLES
    data_tab = i_content_bin.
    The extension is put the it_mailpack-obj_name parameter of 'SO_NEW_DOCUMENT_ATT_SEND_API1'.

  • Sending SAP Script output as a PDF attachment through mail

    Dear Guru,
    I am using SAP 4.0B version, DATABASE Oracle 8i, OS is sun solaris 7.5.
    I want to send SAP script output as a
    PDF attachement through mail.Please suggest a solution.
    Regards,
    Rajesh

    Hi Rajesh,
    In your print program, while calling OPEN_FORM, pass options-TDGETOTF = 'X'. This is used for returning print output in OTF format.
    Then in CLOSE_FORM, get the table OTFDATA returned from the function module. for example
    DATA: OTF_DATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
        CALL FUNCTION 'CLOSE_FORM'
          IMPORTING
            RESULT  = RESULT
          TABLES
            OTFDATA = OTF_DATA.
    now you can convert this OTF data to PDF using function module CONVERT_OTF
    Then send this data as attachment to a mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1
    Regards,
    Komal.

  • SAP Script in Function module

    HI Experts,
    I will get VBELN as an import parameter in my Z-FM.
    Now i have to pass this VBELN to RVORDER01 script and to finally get the OTF data from CLose_form.
    How to sap script processing in function module
    Thanks
    Chandra

    Example
    Definition in the SAPscript form:
    /: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
    /: USING &PAGE&
    /: USING &NEXTPAGE&
    /: CHANGING &BARCODE&
    /: ENDPERFORM
    / &BARCODE&
    Coding of the calling ABAP program:
    REPORT QCJPERFO.
    FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
    OUT_PAR STRUCTURE ITCSY.
    DATA: PAGNUM LIKE SY-TABIX, "page number
    NEXTPAGE LIKE SY-TABIX. "number of next page
    READ TABLE IN_PAR WITH KEY u2018PAGEu2019.
    CHECK SY-SUBRC = 0.
    PAGNUM = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY u2018NEXTPAGEu2019.
    CHECK SY-SUBRC = 0.
    NEXTPAGE = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY u2018BARCODEu2019.
    CHECK SY-SUBRC = 0.
    IF PAGNUM = 1.
    OUT_PAR-VALUE = u2018|u2019. "First page
    ELSE.
    OUT_PAR-VALUE = u2018||u2019. "Next page
    ENDIF.
    IF NEXTPAGE = 0.
    OUT_PAR-VALUE+2 = u2018Lu2019. "Flag: last page
    ENDIF.
    MODIFY OUT_PAR INDEX SY-TABIX.
    ENDFORM.

Maybe you are looking for

  • Material Number is not in table PLPO

    Gurus, I need to pull Material Production standard Time (Setup, Labor and Machine time) data from table PLPO into BW, however i do not see the field MATNR(Material) in this table. There is material group and BOM though. In this scenario, what are my

  • Problem during installation of EHP4 on IDES with preinstalled EHP3

    I have a problem during installation of EHP4 on IDES with preinstalled EHP3(I got it with media sent last year in april). Namely during PREP_EXTENSION/EHP_INCLUSION! phase i got error: Severe error(s) occured in phase PREP_EXTENSION/EHP_INCLUSION! La

  • How to display the err msg in statusbar

    Hi friends,     How to display the error msg (red color) in statusbar and other msg is green color in same report of the status bar . Plz help any one. Thanks in advance.

  • My home button stop working. what to do?

    Hello, i have an ipad2. Suddenly, the home button stop working. Someone could help me please?

  • Single app to complete CC?

    If I bought a single app and want to go to the complete CC do I have to pay full price again?