Problem in converting smart form into PDF

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

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

Similar Messages

  • How to convert Smart Form into PDF format and return the result in BAPI?

    I want to convert a Smart Form into PDF format and return the result in BAPI.
    can anyone tell me how it can be done with related example
    regards
    pranay

    hi,
    smart form to pdf--
    All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:
    DATA: p_output_options TYPE ssfcompop,
    p_control_parameters TYPE ssfctrlop.
    p_control_parameters-no_dialog = 'X'.
    p_control_parameters-getotf = 'X'.
    CALL FUNCTION v_func_name "call your smartform
    EXPORTING
    output_options = p_output_options
    control_parameters = p_control_parameters
    IMPORTING
    job_output_info = s_job_output_info.
    call function 'CONVERT_OTF_2_PDF'
    tables
    otf = s_job_output_info-otfdata
    lines = t_pdf
    and if u need more u can check below links also
    Check the below links..
    Re: Smartforms to PDF
    Re: smartform (otf) as pdf and sending as email-attachment
    VISIT THIS LINK
    Re: Smartforms to PDF
    PLZ REWARD POINTS IF IT HELPS YOU
    rgds
    anver

  • Alignment problem in converting smartform printpreview into PDF

    Hi all,
    I am getting some alignment problem in converting smartform printpreview into PDF format, i.e the format of PDF is different from printpreviw of smartform.
    kindly suggest something so that alignment is not changed while converting to PDF.
    Regards,
    Sumalatha

    use below f.m to convert it into 255 characters....
         CALL FUNCTION 'QCE1_CONVERT'
            TABLES
              t_source_tab         = i_tline
              t_target_tab         = so_ali[]
            EXCEPTIONS
              convert_not_possible = 1
              OTHERS               = 2.

  • How to convert Infopath forms into pdf or word ?

    I have an urgent requirement. I need to covert approx 50k infopath forms into pdf/word.
    Is there any way to convert it without using a third party software?
    Is this possible via Powershell script ? 

    Not with Microsoft tools. This would be something supplied by a 3rd party, if available at all.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • 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

  • Problem With Converting PO Smartform into PDF

    Hi All,
    I am trying to email the Smartform PO. I developed the program after reading several discuusions and blogs in forum. The PO is successfully created in PDF format and stored in the local directory. When i tried to view the pdf the PO is creatd twice in the PDF. I mean the original pdf is of 3 pages with PO and terms and conditons. But in the pdf which was created it has 6 pages. I am unable to understand why it has 2 copies of same PO.
    When i tried to email the pdf as attachement the email is delivered successfully. But when i tried to view the pdf its given an error that "the file is corrupted (For example the attachemnt is not coded properly)or the fle type is not supported. Even in the attachment also i have the two files one is of pdf another is also of the .pdf but the image is showing as Unknown file format.
    Any suggestions to resolve these issues.
    Thanks

    My code is as follows:
    FORM print_form .
    *Calling FM to retrieve the function module associated with the Smartform
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZMMS_MEDRUCK_LS'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = v_form_name
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    control_parameters-langu = sy-langu.
      control_parameters-no_dialog = 'X'.
      control_parameters-getotf    = 'X'.
    Excuting the FM associated with the SmartForm by input required internal tables
    CALL FUNCTION v_form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = control_parameters
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
        OUTPUT_OPTIONS             = output_options
      USER_SETTINGS              = 'X'
        IS_NAST                    = it_nast
        IS_PEKKO                   = it_pekko
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = output_data
       JOB_OUTPUT_OPTIONS         =
      TABLES
        IT_EKPO                    = it_ekpo
        IT_EKET                    = it_eket
        IS_EKKO                    = it_ekko
        IT_DRAW                    = it_draw
        IT_BUYER                   = it_buyer
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    tab_otf_final[] = output_data-otfdata[].
    **removing the initial and final markers from the OTF data*********
    DELETE output_data-otfdata WHERE tdprintcom = '//'.
    searching for the end-of-page in OTF table************
    DATA : my_tabix TYPE sy-tabix.
    READ TABLE tab_otf_final WITH KEY tdprintcom = 'EP'.
    my_tabix = sy-tabix + 1.
    appending the modified OTF table to the final OTF table****
    INSERT LINES OF output_data-otfdata INTO tab_otf_final INDEX my_tabix.
      CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
          FORMAT                      = 'PDF'
        MAX_LINEWIDTH               = 132
        ARCHIVE_INDEX               = ' '
        COPYNUMBER                  = 0
        ASCII_BIDI_VIS2LOG          = ' '
        PDF_DELETE_OTFTAB           = ' '
    IMPORTING
          bin_filesize                = bin_filesize
        TABLES
          OTF                         = tab_otf_final
          LINES                       = lt_lines
      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.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        BIN_FILESIZE                    = bin_filesize
        FILENAME                        = 'D:TEST.PDF'
        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                      = ' '
      WRITE_EOL                       = ABAP_TRUE
    IMPORTING
        FILELENGTH                      = file_size
      TABLES
        DATA_TAB                        = lt_lines
      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.
    loop at LT_LINES INTO wa_lines.
    translate wa_LINES using '~'.
    concatenate WA_BUFFER wa_LINES 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[].
    APPEND I_RECORD.
    Create Message Body Title and Description****************
    I_OBJTXT = 'test with pdf-Attachment!'.
    append I_OBJTXT.
    describe table I_OBJTXT lines V_LINES_TXT.
    read table I_OBJTXT index V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    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 = 'PDF'.
    append I_OBJPACK.
    Attachment (pdf-Attachment)*************
    I_OBJPACK-TRANSF_BIN = 'X'.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 1.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_BIN.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    I_OBJPACK-OBJ_NAME = 'smartform'.
    concatenate I_OBJPACK-OBJ_NAME I_OBJPACK-DOC_TYPE into I_OBJPACK-OBJ_DESCR separated by '.'.
    I_OBJPACK-OBJ_DESCR = 'test'.
    I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    append I_OBJPACK.
    Länge des Attachment ermitteln
    clear I_RECLIST.
    I_RECLIST-RECEIVER = '[email protected]'.
    I_RECLIST-REC_TYPE = 'U'.
    I_RECLIST-EXPRESS = 'X'.
    data: TAB_LINES like SY-TABIX.
    describe table I_OBJBIN lines TAB_LINES.
    append I_RECLIST.
    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    exporting
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X'
    tables
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_RECLIST
    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.
    if SY-SUBRC <> 0.
    write:/ 'Error When Sending the File', SY-SUBRC.
    else.
    write:/ 'Mail sent'.
    endif.
    ENDFORM.                    " print_form

  • Problem in converting Word Document into PDF after inserting EMF file

    Hi
    I have VB 6.0 program, which automatically inserts an EMF file in to MS-Word and converts it in to Post Script file and finally to PDF.
    But the Size of the generated PDF file is too large i.e., 8MB
    If am inserting an .PNG file in MS-Word and conveting it in to Post Script and finally in to PDF, the size of PDF file is somewhere around 330KB.
    I am using Acrobat Distiller 6.0 for this conversion
    Can any one let me how I can reduce the file size of PDF, if I insert an EMF file.
    Thanks in Advance
    Vijay Kumar

    Saying a WMF file does not mean much. It could be a bitmap with 2400dpi or a vector graphic. WMF and EMF are wrappers that can include both. You may be best to open the WMF in PhotoShop or Illustrator and see if you can get a consistent size, possibly doing a copy and paste to WORD.

  • 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

  • Converting smart forms as a pdf in different languages

    Hi Experts,
    I have been created a smart form and later on i converted it to in pdf also, but how can i convert a smart form output into different languages (English(defualt), German, Italian, French, Spanish,). Can anyone tell me about the idea behind this or a simple demo program???????????
    do i need to maintain each text on the smart form into these languages already through SE63 or somewhere any idea that can help me without translating the whole text into those languages, could be able to do pdf conversion.
    Thanks and Regards,
    Shakun

    The OTF data needs to already be in the target language - the conversion process is a process of changing the document format only, not a translation tool.

  • How to print form into pdf format using smart forms in abap

    please let me know how to print form into pdf format using smart forms in abap.
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 25, 2011 2:04 PM

    Hi ,
    refer this link
    <removed by moderator>
    Regards,
    Dhina..
    Moderator message: please do not reply to questions that violate forum rules.
    Edited by: Thomas Zloch on Mar 25, 2011 2:04 PM

  • How to programatically convert XDP form into Dynamic PDF form

    Hi,
    Is there a way to programatically convert XDP form into Dynamic PDF form using LiveCycle Service APIs?
    Thanks,
    lcfun

    Take a look at http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.html and the API Quick Starts > Output Service API Quick Starts.
    Quick Start (EJB mode): Creating a PDF document based on an application XDP file using the Java API
    http://help.adobe.com/en_US/livecycle/9.0/programLC/help/000243.html#1645763
    I think this will get it done. Give it a go.
    Steve

  • How To Get The Smart Form Into The PDF File

    Hello Friends,
    Can Any One Tell How To Get Smart Form in PDF.
    I used this RSTXPDFT4 Program.
    It is asking The Spool Number.
    How to get the Spool Number.

    the steps are
    SmartForms Output to PDF
    There is a way to download smartform in PDF format.
    Please do the following:
    1. Print the smartform to the spool.
    2. Note the spool number.
    3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the
    noted spool number.
    how  to get spool number
    The simplest method is to read the spool table directly, table TSP01
    example code
    REPORT zsuresh_test.
    * Variable declarations
    DATA:
    w_form_name TYPE tdsfname VALUE 'ZSURESH_TEST',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    * Internal tables declaration
    * Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    * Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    * Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    * This function module call is used to retrieve the name of the Function
    * module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    * VARIANT = ' '
    * DIRECT_CALL = ' '
    IMPORTING
    fm_name = w_fmodule
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Calling the SMARTFORM using the function module retrieved above
    * GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    * format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
                                                        " for print preview
    w_cparam-getotf = 'X'.
    * Printer name to be used is provided in the export parameter
    * OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    * ARCHIVE_INDEX =
    * ARCHIVE_INDEX_TAB =
    * ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    * MAIL_APPL_OBJ =
    * MAIL_RECIPIENT =
    * MAIL_SENDER =
    output_options = w_outoptions
    * USER_SETTINGS = 'X'
    IMPORTING
    * DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    * JOB_OUTPUT_OPTIONS =
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    t_otf[] = t_otf_from_fm-otfdata[].
    * Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    * ARCHIVE_INDEX = ' '
    * COPYNUMBER = 0
    * ASCII_BIDI_VIS2LOG = ' '
    * PDF_DELETE_OTFTAB = ' '
    IMPORTING
    BIN_FILESIZE = W_bin_filesize
    * BIN_FILE =
    TABLES
    otf = T_OTF
    lines = T_pdf_tab
    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.
    * To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    * EXPORTING
    * WINDOW_TITLE =
    * DEFAULT_EXTENSION =
    * DEFAULT_FILE_NAME =
    * FILE_FILTER =
    * INITIAL_DIRECTORY =
    * WITH_ENCODING =
    * PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    * USER_ACTION =
    * FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    * Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    * presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    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 = T_pdf_tab
    * 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.
    Do reward if helpful
    Edited by: sharad narayan on Apr 4, 2008 2:14 PM
    Edited by: sharad narayan on Apr 4, 2008 2:18 PM

  • Display smart form in PDF

    Hi all,
    I have created a smart form , and I can down load it to the local drive in PDF format.
    But  I want to display my smart form in PDF first , then if the user want to save , he should be able to do so. How can i do thtat.
    Many thanks ,
    Sandeep.

    hi friend,
    pls go through the code
    rewards are expecting .
    vivek
    *& Report  Y_SD_PRE_SHIPMENT
    REPORT  y_sd_pre_shipment.
    **************DATA DECLARATION****************************************
    DATA : BEGIN OF i_vbrk OCCURS 0,
           vbeln TYPE vbrp-vbeln,
           END OF i_vbrk.
    DATA:  prog TYPE sy-repid,
           dynnr TYPE sy-dynnr,
           FNAM  TYPE RS38L_FNAM,
           v_vbeln type ZSDTANNXINV-vbeln,
           idx type i,
           cnt type i.
    DATA: I_FINAL TYPE TABLE OF YPSHIP,
          W_FINAL TYPE YPSHIP.
    DATA: I_HEAD TYPE TABLE OF YPSHIP1,
          W_HEAD TYPE YPSHIP1.
    DATA: it_otf   TYPE STANDARD  TABLE OF itcoo,
          it_docs  TYPE STANDARD  TABLE OF docs,
          it_lines TYPE STANDARD  TABLE OF tline,
          st_job_output_info      TYPE ssfcrescl,
          st_document_output_info TYPE ssfcrespd,
          st_job_output_options   TYPE ssfcresop,
          st_output_options       TYPE ssfcompop,
          st_control_parameters   TYPE ssfctrlop,
          v_len_in                TYPE so_obj_len,
          v_language              TYPE sflangu VALUE 'E',
          v_e_devtype             TYPE rspoptype,
          v_bin_filesize          TYPE i,
          v_name                  TYPE string,
          v_path                  TYPE string,
          v_fullpath              TYPE string,
          v_filter                TYPE string,
          v_uact                  TYPE i,
          v_guiobj                TYPE REF TO cl_gui_frontend_services,
          v_filename              TYPE string.
    ******USER INTERACTION OPTION FOR THE INVOICE NO
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE r.
    PARAMETERS:  invoice LIKE ZSDTANNXINV-vbeln obligatory .
    SELECTION-SCREEN : END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR invoice.
      REFRESH i_vbrk.
      SELECT vbeln FROM vbrk INTO TABLE i_vbrk.
      IF sy-subrc IS INITIAL.
        prog = sy-repid.
        dynnr = sy-dynnr.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
    DDIC_STRUCTURE         = ' '
           retfield               = 'VBELN'
           dynpprog               = prog
           dynpnr                 = dynnr
           dynprofield            = 'INVOICE'
           value_org              = 'S'
           TABLES
           value_tab              = i_vbrk.
      FIELD_TAB              =
      RETURN_TAB             =
      DYNPFLD_MAPPING        =
       exceptions
      parameter_error        = 1
      no_values_found        = 2
       others                 = 3
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    at selection-screen on invoice.
    if invoice is not initial.
    clear v_vbeln.
    select single vbeln from ZSDTANNXINV into v_vbeln where vbeln = invoice.
    if sy-subrc is not initial.
    message 'Enter Valid Document No' type 'E'.
    endif.
    endif.
    START-OF-SELECTION.
    perform get_data.
    perform process_data.
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    form get_data .
    IF INVOICE IS NOT INITIAL.
    SELECT  VBELN
            VTEXT
            NETWT
            GROSSWT
            vsslname
            kindofpack
            INCO1
            INCO2
            REMDATE
            DESTINATION
            SHPNGLIN1
            CNTRNO
            TRAILERNO1
            ETDDATE
            ETADATE
            baanr
            FROM ZSDTANNXINV
            INTO  TABLE I_HEAD
            WHERE VBELN = INVOICE.
    ENDIF.
    IF I_HEAD[] IS NOT INITIAL.
    select  vbeln
            POSNR
            MATNR
            MAKTX
            meins
            RATE
            VALUE
            WAERK
            PRPOSNR
            from zsafii
            into corresponding fields of table i_final
            for all entries in i_head
            where vbeln = i_head-vbeln.
    ENDIF.
    describe table i_final lines cnt.
    idx = 1.
    loop at i_final into w_final.
    if idx le cnt.
    read table i_head into w_head with key vbeln = w_final-vbeln.
    if sy-subrc is initial.
    move-corresponding w_head to w_final.
    modify i_final from w_final index idx.
    idx = idx + 1.
    endif.
    endif.
    endloop.
    endform.                    " get_data
    *&      Form  process_data
          text
    -->  p1        text
    <--  p2        text
    form process_data .
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
      EXPORTING
        i_language    = v_language
        i_application = 'SAPDEFAULT'
      IMPORTING
        e_devtype     = v_e_devtype.
    st_output_options-tdprinter = v_e_devtype.
    *st_output_options-tdprinter = 'locl'.
    st_control_parameters-no_dialog = 'X'.
    st_control_parameters-getotf = 'X'.
    sort i_final by vbeln.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname                 = 'Y_SSF_PRESHIPMENT'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
        FM_NAME                  = FNAM
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if fnam is not initial.
    CALL FUNCTION FNAM
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = st_control_parameters
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = st_output_options
      USER_SETTINGS              = 'X'
    IMPORTING
       DOCUMENT_OUTPUT_INFO       = st_document_output_info
       JOB_OUTPUT_INFO            = st_job_output_info
       JOB_OUTPUT_OPTIONS         = st_job_output_options
      TABLES
        itab                       = I_FINAL
        i_head                     = I_HEAD
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    .........................CONVERT TO OTF TO PDF.......................
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize           = v_bin_filesize
        TABLES
          otf                    = st_job_output_info-otfdata
          doctab_archive         = it_docs
          lines                  = it_lines
        EXCEPTIONS
          err_conv_not_possible  = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ........................GET THE FILE NAME TO STORE....................
      CONCATENATE 'smrt' '.pdf' INTO v_name.
      CREATE OBJECT v_guiobj.
      CALL METHOD v_guiobj->file_save_dialog
        EXPORTING
          default_extension = 'pdf'
          default_file_name = v_name
          file_filter       = v_filter
        CHANGING
          filename          = v_name
          path              = v_path
          fullpath          = v_fullpath
          user_action       = v_uact.
      IF v_uact = v_guiobj->action_cancel.
        EXIT.
      ENDIF.
    ..................................DOWNLOAD AS FILE....................
      MOVE v_fullpath TO v_filename.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize            = v_bin_filesize
          filename                = v_filename
          filetype                = 'BIN'
        TABLES
          data_tab                = it_lines
        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.
    ENDIF.
    ********************************************************************8
    endform.                    " process_data

  • Converting oracle forms into java forms

    Hi all,,
    would help me plz on how to convert oracle forms into java using any tool;
    Is Jheadstart is the tool,, im having jeveloper version 10.1.2.1.0

    There are at least two companies that are marketing Forms to Java conversion tools. I'm sure that a good Google search will locate them, and they are frequent exhibitors at Oracle-oriented conferences like Collaborate and ODTUG Kaleidoscope. But there are problems associated with doing this. I urge anyone who is considering such a project to read this article by Grant Ronald: http://www.oracle.com/technology/products/forms/pdf/10gR2/formsmigration.pdf
    You should carefully ask yourself and your clients and management, "Why do you want to do this?", "What benefits are you trying to realize?", "Does this make sense, and are there other options that we should be exploring?"
    For instance, many people are trying to protect themselves because "Forms is going away". Oracle has stated again and again that Forms is NOT going away. In fact the recent Fusion Middleware 11g release included a new version of Forms with some significant enhancements. You may do very well just by upgrading to the latest version of Forms.
    If you do decide that it still makes sense to convert, I suggest that rather that converting, you may want to redevelop from scratch. Keep the database if it is well designed - a well designed, stable database will outlast any front end that you may use against it. Then take full advantage of the capabilities of your new toolset, and leave behind the limitations and inapplicable methodologies of your old one. Oh, by the way, don't use JDeveloper 10.1.2. Use 11g if you can, or 10.1.3.5 if you must.

  • 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

Maybe you are looking for

  • Forget song last played after using iPod as a disk (Win)

    Hi, I use my nano as a hard disk to store some info. Each time I do so, then I go back to music it comes back to the very first song in the list and doesn't remember where it used to be. This means that each time I disconnect it from my PC, I have to

  • Using an LDAP server as a data source?

    I'm evaluating data services and one of our requirements is to be able to retrieve data from an LDAP server. This isn't for authentication. We store information about users in an LDAP directory. The workflow I'm testing retrieves a customer number fr

  • Inspection lot for certificates

    Hi Is it possible to generate inspection lots for goods receipt inspection for a purcahse order only on absence of quality certificate . Thanks

  • No symbol for tools.

    My tools suddenly stopped displaying the relevant symbol (circle for the brush, etc.) whenever I move it to cover the photo I want to manipulate. Photoshop 8 used to do the same thing.

  • Failed to initialise

    Hello.  Everytime I am prompted to update Adobe Flash Player or Reader I download the installer, start to install, but then the installer "fails to initialise".  My o.s. is XP.  How can this be fixed?