Uploading smartforms converted file (pdf) to BDS

Hi Experts,
I have the following requirements:
1. Convert the smartforms to pdf data.
2. Upload the file to (pdf data) to BDS.
I have no problem in step 1 but my concern is uploading the file to BDS directly after converting the otf data of the form to pdf. How can I upload the pdf data to BDS directly?
Points will be awarded. Thanks!
Leo

HI
<u><i><b>1. Convert the smartforms to pdf data.</b></i></u>
Please check this code and replace the variables as per ur reqt.
This is the code which is working perfectly .
event handler for checking and processing user input and
for defining navigation
        DATA: cached_response TYPE REF TO if_http_response.
        DATA: response TYPE REF TO if_http_response.
        DATA: guid TYPE guid_32.
generated result: PDF format
        DATA: l_pdf_xstring  TYPE xstring,
              lt_lines       TYPE TABLE OF tline,
              ls_line        TYPE tline,
              l_pdf_len      TYPE i.
        DATA: lf_fm_name            TYPE rs38l_fnam ,
              e_ssfcrescl           TYPE ssfcrescl,
              lv_spool              TYPE tsfspoolid,
              e_ssfctrlop           TYPE  ssfctrlop,
              e_ssfcompop           TYPE  ssfcompop.
        DATA w_printer TYPE rspopname."user01-spld.
        DATA:l_doc_output_info TYPE ssfcrespd,              "#EC NEEDED
             l_job_output_info TYPE ssfcrescl,              "#EC NEEDED
             l_job_output_options TYPE ssfcresop.           "#EC NEEDED
        DATA :l_devtype TYPE rspoptype.
Get the function module name of Smartform
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname           = '/BSHP/FW_SF_LIST_DEL'
            variant            = ' '
            direct_call        = ' '
          IMPORTING
            fm_name            = lf_fm_name                           "/1BCDWB/SF00000084
          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.
Set print parameters
        e_ssfctrlop-no_dialog  = 'X' .
Setting of output options
language
        language = sy-langu.
        TRANSLATE language TO UPPER CASE.
        e_ssfctrlop-langu = language.
set control parameters to get the output format (OTF) from Smart Forms
        e_ssfctrlop-no_dialog = 'X'.
        e_ssfctrlop-getotf    = 'X'.
get device type from language
        CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
          EXPORTING
            i_language                   = language
    i_application                = 'SAPDEFAULT'
          IMPORTING
            e_devtype                    = l_devtype
          EXCEPTIONS
            no_language                  = 1
            language_not_installed       = 2
            no_devtype_found             = 3
            system_error                 = 4
            OTHERS                       = 5.
        IF sy-subrc <> 0.
  error handling
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
set device type in output options
        e_ssfcompop-tdprinter = l_devtype.
Call the func module of the Smartform
        CALL FUNCTION lf_fm_name                              " '/1BCDWB/SF00000084'
          EXPORTING
            control_parameters         = e_ssfctrlop
            output_options             = e_ssfcompop
            user_settings              = space
           sf_werks                   = p_werks
            sf_lifnr                   = p_lifnr
            sf_matnr_low               = s_matnr_low
            sf_matnr_high              = s_matnr_high
            sf_vbeln_low               = s_vbeln_low
            sf_vbeln_high              = s_vbeln_high
            sf_lfdat_low               = s_lfdat_low
            sf_lfdat_high              = s_lfdat_high
            sf_vgbel_low               = s_vgbel_low
            sf_vgbel_high              = s_vgbel_high
          IMPORTING
            document_output_info       = l_doc_output_info
            job_output_info            = l_job_output_info
            job_output_options         = l_job_output_options
          TABLES
            gt_final_fi                = gt_final
         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.
Conversion of output format OTF into PDF format
now convert the final document (OTF format) into PDF format
        CALL FUNCTION 'CONVERT_OTF'
             EXPORTING
               format                      = 'PDF'
       MAX_LINEWIDTH               = 132
       ARCHIVE_INDEX               = ' '
       COPYNUMBER                  = 0
             IMPORTING
               bin_filesize                = l_pdf_len
               bin_file                    = l_pdf_xstring       " binary file
             TABLES
               otf                         = l_job_output_info-otfdata
               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 EQ 0.
          CREATE OBJECT cached_response TYPE cl_http_response EXPORTING add_c_msg = 1.
          l_pdf_len = XSTRLEN( l_pdf_xstring ).
          cached_response->set_data( data   = l_pdf_xstring
                              length = l_pdf_len ).
          cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                             value = 'application/pdf' ).
          cached_response->set_status( code = 200 reason = 'OK' ).
          cached_response->server_cache_expire_rel( expires_rel = 180 ).
          CALL FUNCTION 'GUID_CREATE'
            IMPORTING
              ev_guid_32 = guid.
          CONCATENATE runtime->application_url '/' guid '.pdf' INTO display_url.
          cl_http_server=>server_cache_upload( url      = display_url
                                               response = cached_response ).
        ENDIF.
REGARDS
NAVJOT
REWARD IF HELPFULL

Similar Messages

  • Separate program to send a smartform converted into pdf, thru mail

    Hi Folks,
    I had created a smartform and converted it into a PDF format.
    Now I want a separate program where in if i submit this program it should sent it throuogh mail.
    Note:-<b>I want a separate program not the one where in you design a smartform,convert into pdf and then send thru mail all in one program</b>
    Points will be given.
    K.Kiran.

    hi kiran
    the program is as follows
    The user is provided with
    a) file name
    b) email address to send mail
    and it sends ANY FILE (.xls,.pdf .xyz..)
    Instantaneously !
    4. Make two things first :
    1. Include with the name : ZAMI_INCLFOR_MAIL
    2. Report with the name : ZAM_TEMP147 (any name will do)
    3. Activate both and execute (2)
    4. After providing filename, email adress
    5. Code for Include :
    Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    OBJECT_PARA =
    object_parb =
    receivers = 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.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    CODE FOR PROGRAM
    5.
    REPORT zam_temp147 .
    INCLUDE zami_inclfor_mail.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    regards,
    navjot
    reward if helpfull

  • Can you help me? a question of smartform convert to PDF file

    when I do a smartform in Polish ,preview and print is ok.but when covert to pdf use report RSTXPDFT4,some words is wrong code(#).
    Can you help me?

    hi,
    if the data which is printing in # might be a included text or Text module if the text contains any " in the text delete that and again insert that with " i.e if we copy the text from word and paste them in the text editor in the print preview it shows correctly but in print it gets converted into #. I also faced this problem so that i came to know this. If it is not the case leave it.
    Thanks,
    Nethaji.

  • The file is damaged and could not be repaired when smartforms convert to pdf

    i m using your code but error is occur
    please  help me
    when i goto sost and open my pdf file at that time give error message
    my whole program is below
    report  ypayment_advice2.
    tables : bsak,skat.
    types : begin of t_bsak,
           belnr type bsak-belnr,
           gjahr type bsak-gjahr,
           augbl type bsak-augbl,
           augdt type bsak-augdt,
           xblnr type bsak-xblnr,
           bldat type bsak-bldat,
    *      DMBTR TYPE BSAK-DMBTR,
    *      WAERS TYPE BSAK-WAERS,
           lifnr type bsak-lifnr,
           saknr type bsak-saknr,
           budat type bsak-budat,
    *      EBELN TYPE BSAK-EBELN,
    *      EBELP TYPE BSAK-EBELP,
           bukrs type bsak-bukrs,
           buzei type bsak-buzei,
           ebeln type bseg-ebeln,
           ebelp type bseg-ebelp,
           hkont type bseg-hkont,
           shkzg type bseg-shkzg,
           werks type bseg-werks,
           dmbtr type bseg-dmbtr,
           bldat1 type bsak-bldat,
           xblnr1 type bsak-xblnr,
    end of t_bsak.
    types : begin of t_bseg,
             belnr type bseg-belnr,
             gjahr type bseg-gjahr,
             ebeln type bseg-ebeln,
             ebelp type bseg-ebelp,
             hkont type bseg-hkont,
             shkzg type bseg-shkzg,
             werks type bseg-werks,
             dmbtr type bseg-dmbtr,
    end of t_bseg.
    types : begin of t_bseg2,
             belnr type bseg-belnr,
             gjahr type bseg-gjahr,
             ebeln type bseg-ebeln,
             ebelp type bseg-ebelp,
             werks type bseg-werks,
      end of  t_bseg2.
    types : begin of t_bseg1,
             augbl type bseg-augbl,
             gjahr type bseg-gjahr,
             hkont type bseg-hkont,
    end of t_bseg1.
    types : begin of t_bkpf,
             bukrs type bkpf-bukrs,
             cpudt type bkpf-cpudt,
             blart type bkpf-blart,
             usnam type bkpf-usnam,
             budat type bkpf-budat,
    end of t_bkpf.
    types : begin of t_bsak1,
             lifnr type bsak-lifnr,
    end of t_bsak1.
    *DATA : IT_FINAL TYPE STANDARD TABLE OF T_FINAL WITH HEADER LINE.
    *DATA : WA_FINAL TYPE T_FINAL.
    data : wrk_answer type c.
    data : it_bsak type standard table of t_bsak.
    data : wa_bsak type t_bsak.
    data : it_bsak_temp type standard table of t_bsak1 with header line,
            wa_bsak_temp type      t_bsak1.
    data : it_bsak_temp1 type standard table of t_bsak1 with header line,
            wa_bsak_temp1 type      t_bsak1.
    data : it_bsak1 type standard table of t_bsak.
    data : wa_bsak1 type t_bsak.
    data : it_bseg type standard table of t_bseg.
    data : wa_bseg type t_bseg.
    data : it_bseg1 type standard table of t_bseg1.
    data : wa_bseg1 type t_bseg1.
    data : it_bseg2 type standard table of t_bseg2.
    data : wa_bseg2 type t_bseg2.
    data : it_bkpf type standard table of t_bkpf.
    data : wa_bkpf type t_bkpf.
    data : l_cntr type i value 1.
    data : op type ssfcompop.
    data : control type ssfctrlop.
    data: formname1  type  tdsfname," value 'YPAYMENT_ADVICE',
           fm_name    type  rs38l_fnam.
    data : i_smtp_addr type adr6-smtp_addr,
              i_adrnr     type lfa1-adrnr.
    data: gd_recsize type i.
    data : it_tsp01 type standard table of tsp01 with header line .
    data : it_pdf like tline occurs 0 with header line .
    data : gd_buffer type string.
    data: gd_spool_nr like tsp01-rqident,
           gd_destination like rlgrap-filename,
           gd_bytecount like tst01-dsize.
    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.
    data : w_emailid type adr6-smtp_addr.
    *  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: t_otfdata type soli_tab,
           t_otfdata_item type soli_tab,
           t_objhex type solix_tab,
           t_objhead type soli_tab,
           w_transfer type sx_boolean,
           w_length type sood-objlen,
           w_length_item type sood-objlen,
           w_lines_txt type i,
           w_lines_bin type i,
           wa_soli type soli,
           wa_solix type solix,
           w_doc_chng type sodocchgi1,
           t_objcont type standard table of soli with header line,
           t_objcont_item type standard table of soli with header line,
           t_objpack like sopcklsti1 occurs 0 with header line,
           t_reclist like somlreci1 occurs 0 with header line,
           t_objtxt like solisti1 occurs 0 with header line.
    data : ls_control type ssfctrlop,
            ls_output  type ssfcrescl,
            ls_output_opt type ssfcompop,
            lt_lines  type table of tline,
            lt_linesx  type table of tdline.
    data : lv_pdf type xstring,
            lv_filelen type i,
            lv_file type string.
    selection-screen begin of block b1 with frame title text-001.
    select-options : p_lifnr for bsak-lifnr.
    select-options : p_augbl for bsak-augbl obligatory,
                      p_year for bsak-gjahr obligatory.
    *                 P_BUDAT FOR BSAK-BUDAT.
    selection-screen end of block b1.
    start-of-selection.
       perform get_data.
       perform process_data .
       perform call_smartforms.
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form get_data .
       select augbl  gjahr budat xblnr
         from bsak
         into corresponding fields of table it_bsak1
         where augbl in p_augbl
           and gjahr in p_year
           and blart = 'KZ'
           and lifnr  in p_lifnr.
       if sy-subrc <> 0.
         message 'No Record Found ' type 'E'.
       endif.
       select augbl augdt belnr gjahr xblnr
                dmbtr lifnr saknr budat bukrs buzei
             from bsak
           into corresponding fields of table it_bsak
           for all entries in it_bsak1
           where augbl = it_bsak1-augbl
             and augdt = it_bsak1-budat
             and blart = 'RE'.
    *    FOR ALL ENTRIES IN IT_BSAK
    *    WHERE AUGBL = '1500000011' "IT_BSAK-AUGBL
    *      AND GJAHR = '2013' "IT_BSAK-GJAHR
    *      AND BLART = 'RE'.
       select belnr gjahr shkzg dmbtr koart
          from bseg
          into corresponding fields of table it_bseg
          for all entries in it_bsak
          where belnr = it_bsak-belnr
            and gjahr = it_bsak-gjahr
            and koart = 'K'.
    *       AND BUKRS = IT_BSAK-BUKRS.
    *       AND BUZEI = IT_BSAK-BUZEI.
       select belnr gjahr hkont
        from bseg
        into corresponding fields of table it_bseg1
           for all entries in it_bsak1
           where belnr = it_bsak1-augbl
             and gjahr = it_bsak1-gjahr
             and koart = 'S'.
       select  belnr gjahr ebeln ebelp werks
         from bseg
         into corresponding fields of table it_bseg2
            for all entries in it_bseg
            where belnr = it_bseg-belnr
              and gjahr = it_bseg-gjahr
              and buzid = 'W'.
    *  BREAK ABAP.
       select bukrs cpudt blart usnam budat
         from bkpf
         into corresponding fields of table it_bkpf
         for all entries in it_bsak
         where belnr = it_bsak-belnr
           and gjahr = it_bsak-gjahr.
    *      AND BUKRS = IT_BSAK-BUKRS
       loop at it_bsak into wa_bsak.
         read table it_bseg into wa_bseg with key belnr = wa_bsak-belnr
                                                  gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bseg-shkzg to wa_bsak-shkzg.
           move wa_bseg-dmbtr to wa_bsak-dmbtr.
           modify it_bsak from  wa_bsak transporting shkzg dmbtr.
         endif.
         read table it_bseg2 into wa_bseg2 with key belnr = wa_bsak-belnr
                                                    gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bseg2-ebeln to wa_bsak-ebeln.
           move wa_bseg2-ebelp to wa_bsak-ebelp.
           move wa_bseg2-werks to wa_bsak-werks.
           modify it_bsak from  wa_bsak transporting ebeln ebelp werks .
         endif.
         read table it_bseg1 into wa_bseg1 with key gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bseg1-hkont to wa_bsak-hkont.
           modify it_bsak from  wa_bsak transporting hkont where gjahr = wa_bsak-gjahr.
         endif.
         read table it_bsak1 into wa_bsak1 with key augbl = wa_bsak-augbl
                                                    gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bsak1-bldat to wa_bsak-bldat1.
           move wa_bsak1-xblnr to wa_bsak-xblnr1.
           modify it_bsak from  wa_bsak transporting bldat1 xblnr1 where augbl = wa_bsak-augbl
                                                                    and  gjahr = wa_bsak-gjahr.
         endif.
       endloop.
       loop at it_bsak into wa_bsak.
         move wa_bsak-lifnr to wa_bsak_temp-lifnr.
         append wa_bsak_temp to it_bsak_temp  .
       endloop.
       loop  at it_bsak_temp into wa_bsak_temp.
         collect wa_bsak_temp into it_bsak_temp1.
       endloop.
    endform.                    " GET_DATA
    *&      Form  PROCESS_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form process_data .
       export it_bsak to memory id 'IT_BSAK'.
       export it_bseg to memory id 'IT_BSEG'.
       export it_bkpf to memory id 'IT_BKPF'.
    *  BREAK ABAP.
    endform.                    " PROCESS_DATA
    *&      Form  CALL_SMARTFORMS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form call_smartforms .
    *  LOOP AT IT_BSAK_TEMP.
       call function 'SSF_FUNCTION_MODULE_NAME'
         exporting
           formname = 'YPAYMENT_ADVICE1'
         importing
           fm_name  = fm_name.
    *    CALL FUNCTION FM_NAME"'/1BCDWB/SF00000442'
    *      EXPORTING
    *         P_LIFNR                   = IT_BSAK_TEMP-LIFNR.
       call function fm_name"'/1BCDWB/SF00000442'
         exporting
             it_bsak                    = it_bsak
             it_bseg                    = it_bseg
             it_bkpf                    = it_bkpf.
       clear wrk_answer.
    *  BREAK ABAP.
       call function 'POPUP_TO_CONFIRM'
         exporting
         titlebar                    = 'LOGOFF'
    *           DIAGNOSE_OBJECT         = ' '
           text_question             = 'Do You Want Send Mail?'
          text_button_1              = 'YES'
    *           ICON_BUTTON_1           = ' '
          text_button_2              = 'NO'
          display_cancel_button      = space
          start_column               = 25
          start_row                  = 6
        importing
          answer                     = wrk_answer
    *         TABLES
    *           PARAMETER               =
        exceptions
          text_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.
    *Mail send coding
       check wrk_answer = '1'.
       loop at it_bsak_temp1 into wa_bsak_temp1.
         break abap.
         select single adrnr from lfa1
             into i_adrnr where lifnr = wa_bsak_temp1-lifnr.
         select single smtp_addr from adr6
         into w_emailid
         where addrnumber = i_adrnr.
         if w_emailid is not initial.
           perform mail.
         else.
           message 'E-Mail Address is not maintained for Vendor' type 'S'.
         endif.
       endloop.
    endform.                    " CALL_SMARTFORMS
    *&      Form  SEND_EMAIL
    *       text
    *      -->P_P_EMAIL1  text
    form send_email  using    p_email.
       check not ( p_email is initial ).
       refresh it_mess_bod.
    *BREAK-POINT.
    *   DEFAULT SUBJECT MATTER
       gd_subject         = 'SUBJECT'.
       gd_attachment_desc = 'Invoice  '.
    *    CONCATENATE 'ATTACH_NAME' ' ' INTO GD_ATTACHMENT_NAME.
       it_mess_bod        = 'Hi,'.
       append it_mess_bod.
       it_mess_bod = 'Kindly Find an attached copy of Sale Invoice : '.
       concatenate it_mess_bod p_lifnr into it_mess_bod separated by space.
       append it_mess_bod.
       it_mess_bod        = 'This is system generated Mail,So do not reply.'
       append it_mess_bod.
       it_mess_bod        = 'Thank you,'.
       append it_mess_bod.
       it_mess_bod        = 'Gokul Refoils & Solvent Ltd.'.
       append it_mess_bod.
       data : p_sender type somlreci1-receiver.
       p_sender = '[email protected]'
    *   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
    'Narendra CHECK Invoice-Gokul Refoils & Solvent Ltd.'
    *'Sale Invoice .pdf document attached'
                                           'PDF'
                                           gd_attachment_name
                                           gd_attachment_desc
                                           p_sender
                                           gd_sender_type
                                  changing gd_error
                                           gd_reciever.
    endform.                    " SEND_EMAIL
    *  &      FORM  SEND_FILE_AS_EMAIL_ATTACHMENT
    *         TEXT
    *        -->P_IT_MESS_BOD  TEXT
    *        -->P_IT_MESS_ATT  TEXT
    *        -->P_P_EMAIL  TEXT
    *        -->P_1395   TEXT
    *        -->P_1396   TEXT
    *        -->P_GD_ATTACHMENT_NAME  TEXT
    *        -->P_GD_ATTACHMENT_DESC  TEXT
    *        -->P_P_SENDER  TEXT
    *        -->P_GD_SENDER_TYPE  TEXT
    *        <--P_GD_ERROR  TEXT
    *        <--P_GD_RECIEVER  TEXT
    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 perror
                                                 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_receivers1 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
    *BREAK-POINT.
       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 = w_emailid.
       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_NEW_DOCUMENT_ATT_SEND_API1'
    **    EXPORTING
    **      DOCUMENT_DATA              =  W_DOC_DATA
    **      PUT_IN_OUTBOX              = 'X'
    **      COMMIT_WORK                = 'X'
    **    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.
    **  COMMIT WORK.
    **  LOOP AT T_RECEIVERS.
    **    LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
    **  ENDLOOP.
    **ENDFORM.                    "SEND_FILE_AS_EMAIL_ATTACHMENT
       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

    Not sure if the flollowing will be of use, but worth a try?…
    Try changing the .ai to .eps or .pdf to see if anything happens to see if it makes a difference to importing or exporting as a pdf?
    If you have Indesign, try importing the file into Indesign then saving that file as a pdf or/and export as a Indesign eps file.
    Sorry I cannot be of any more assistance.
    Good luck!

  • Problem in Smartform convert to PDF with special character

    Hi ABAP Guru,
    While convert smartforms to pdf.Some special character like ( - ) convert to ( # ).In development server there is no problem but the problem arise in quality.Please help

    Hi Palash,
                  Please use PDF! in print preview command field.. it will convert pdf file.
    regards,
           Thangam.P

  • Smartforms  to file  .PDF and download  in Background

    Hi
    Actually  i´m converting  a smartforms in PDF file and doing a download in line , but i need to do the same in background.
    How can i do it??
    Regards
    Gregory

    *& Report  ZSMARTFORM_SPOOL_G
    REPORT  zsmartform_spool_g.
    *************Types Declaration ****************************
    TYPES : BEGIN OF gty_tab,                          " Spool Requests
            rqident   TYPE tsp01-rqident,              " Spool request number
            rqdoctype TYPE tsp01-rqdoctype,            " Spool: document type
            rqo1name  TYPE tsp01-rqo1name,             " TemSe object name
           END OF gty_tab.
    *********Work Area ****************************************
    DATA: form_name TYPE rs38l_fnam,      " Used to get the function module of Smartform
          wa_outopt TYPE ssfcompop,       " SAP Smart Forms: Smart Composer (transfer) options
          gs_tab    TYPE gty_tab.         " Spool Requests
    *******Internal Table Declarations ************************
    DATA: gt_tab TYPE STANDARD TABLE OF gty_tab,       " Spool Requests
          gt_pdf TYPE STANDARD TABLE OF tline,         " SAPscript: Text Lines
          gt_spoolid TYPE tsfspoolid,                  " Table with Spool IDs
          gt_otfdata TYPE ssfcrescl.                 " Smart Forms: Return value at end of form prnt
    *********Variable Declarations ****************************
    DATA: gv_bytecount   TYPE i,               "#EC NEEDED " PDF Byte Count
          gv_file_name   TYPE string,                    " File name
          gv_file_path   TYPE string,                    " File Path
          gv_full_path   TYPE string,                    " Path
          gv_binfilesize TYPE i,                         " Bin File size
          gv_rqident   TYPE tsp01-rqident,               " Spool request number
          gv_name TYPE tst01-dname,                      " TemSe object name
          gv_objtype TYPE rststype-type,                 " TemSe: Object type name
          gv_type TYPE rststype-type.                    " TemSe: Object type name
    START-OF-SELECTION.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZPDF_G'
        IMPORTING
          fm_name            = 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.
    *Get Spool IDs
      wa_outopt-tdnewid = 'X'.
      wa_outopt-tddest = 'LP01'.
      CALL FUNCTION form_name
        EXPORTING
          output_options   = wa_outopt
          user_settings    = 'X'
        IMPORTING
          job_output_info  = gt_otfdata
        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.
    *Assign the spool id
      gt_spoolid = gt_otfdata-spoolids.
    Generate spool and pdf for the output of the form
      PERFORM sub_generate_spool_pdf.
    END-OF-SELECTION.
    *&      Form  sub_generate_spool_pdf
          Generate Spool and PDF output
    FORM sub_generate_spool_pdf .
      DATA: ls_spoolid LIKE LINE OF gt_spoolid.
    *----Get the Spool Number
      CLEAR ls_spoolid.
      READ TABLE gt_spoolid INTO ls_spoolid INDEX 1.
      IF sy-subrc = 0.
        gv_rqident = ls_spoolid.
      ENDIF.
      CLEAR gt_tab.
      SELECT  rqident rqdoctype rqo1name INTO TABLE gt_tab
               FROM tsp01 WHERE rqident = gv_rqident.
      IF sy-subrc = 0.
        CLEAR gs_tab.
    Get the TemSe: Object name into variable gv_name
        READ TABLE gt_tab INTO gs_tab INDEX 1.
        IF sy-subrc = 0.
          gv_name = gs_tab-rqo1name.
        ENDIF.
      ENDIF.
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
        EXPORTING
          authority     = 'SP01'
          client        = sy-mandt
          name          = gv_name
          part          = 1
        IMPORTING
          type          = gv_type
          objtype       = gv_objtype
        EXCEPTIONS
          fb_error      = 1
          fb_rsts_other = 2
          no_object     = 3
          no_permission = 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.
    Check if temse object name type is 'OTF' or 'LIST'
      IF gv_objtype(3) = 'OTF'.
        PERFORM get_otf_spool_in_pdf.
      ELSE.
        PERFORM get_abap_spool_in_pdf.
      ENDIF.
    Generate F4 functionality from spool to pdf
      PERFORM write_pdf_spool_to_pc.
    ENDFORM.                    " sub_generate_spool_pdf
    *&      Form  get_abap_spool_in_pdf
          Generate the Spool number
    FORM get_abap_spool_in_pdf .
      REFRESH gt_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = gv_rqident
        IMPORTING
          pdf_bytecount            = gv_bytecount
        TABLES
          pdf                      = gt_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.
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_abap_spool_in_pdf
    *&      Form  get_otf_spool_in_pdf
          Generate OTF data from the Spool Number
    FORM get_otf_spool_in_pdf .
      REFRESH gt_pdf.
      CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = gv_rqident
        IMPORTING
          pdf_bytecount            = gv_bytecount
        TABLES
          pdf                      = gt_pdf
        EXCEPTIONS
          err_no_otf_spooljob      = 1
          err_no_spooljob          = 2
          err_no_permission        = 3
          err_conv_not_possible    = 4
          err_bad_dstdevice        = 5
          user_cancelled           = 6
          err_spoolerror           = 7
          err_temseerror           = 8
          err_btcjob_open_failed   = 9
          err_btcjob_submit_failed = 10
          err_btcjob_close_failed  = 11
          OTHERS                   = 12.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_otf_spool_in_pdf
    *&      Form  write_pdf_spool_to_pc
          Generate PDF format
    FORM write_pdf_spool_to_pc .
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        CHANGING
          filename             = gv_file_name
          path                 = gv_file_path
          fullpath             = gv_full_path
        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.
    ----DOWNLOADING THE PDF DATA***
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize            = gv_binfilesize
          filename                = gv_full_path
          filetype                = 'BIN'
        TABLES
          data_tab                = gt_pdf
        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.
    ENDFORM.                    " write_pdf_spool_to_pc
    Rewards if useful..............
    Minal

  • Smartform convert to PDF dump - divide by zero

    SAP Version 4.7 Enterprise
    hello all,
    i am trying to do somethign rather basic that is discussed in these forums many times: convert Samrtforms output to PDF. i used the suggested forms but came across a unique (i think) error. my problem is that when i run the CONVERT_OTF_2_PDF function i get a core dump with the error "divide by zero". reading the core dump i see that there appears to be a font issue in the form:
    Code: Select all
    055610   * non-proportional font                                                
    055620   * if charwidth is not equal the default PostScript charwidth,          
    055630   * print string with individual character positioning                   
    055640   * WARNING: The unit used with PDFs (..) xx TJ command for individual   
    055650   * char positioning is 1 EM = 1/1000 fontsize!!!                        
    055660   * ofs_em = 1000 * (charwidth / fontsize_twip)                          
    055670   * WARNING: ...TJ moves current point to the LEFT of character          
    055680                                                                          
    055690   * set word spacing = 0                                                 
    055700     PERFORM PDF_APPEND_STREAM USING '0 Tw'. "#EC NOTEXT                  
    055710     IF CHARWIDTH < FONTINFO-DEF_SPACEWIDTH.                              
    055780   *   a positive value moves charpos to the LEFT!                        
    055790     ELSE.                                                                
    055800   *   OTF character spacing is wider than PostScript default             
    >       OFFSET_EM = 1000 * ( CHARWIDTH - FONTINFO-DEF_SPACEWIDTH )         
    055820                   / FONTINFO-FONTSIZE_TW.                                
    055830       PERFORM PDF_REM_LEAD_ZEROES_I USING 5 OFFSET_EM COORD.             
    055840   *   a negative value moves charpos to the RIGHT!                       
    needless to say this works perfectly when printing to paper. i am not using any non-stnadard fonts. the fonts are Arial with sizes of 6, 8, 10 and 12. any ideas? FYI, the code to call the functions is below. cheers,
    james
    Code: Select all
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          i_language             = sy-langu
          i_application          = 'SAPDEFAULT'
        IMPORTING
          e_devtype              = dev_typ
        EXCEPTIONS
          no_language            = 1
          language_not_installed = 2
          no_devtype_found       = 3
          system_error           = 4
          OTHERS                 = 5.
      ctrl_params-no_dialog = 'X'.
      ctrl_params-getotf = 'X'.
      out_opt-tdnewid = 'X'.
      out_opt-xsfcmode = 'X'.
      out_opt-xsf = ' '.
      out_opt-xdfcmode = 'X'.
      out_opt-xdf = ' '.
      out_opt-tdprinter = dev_typ.
      CALL FUNCTION fm_name
        EXPORTING
          control_parameters         = ctrl_params
        IMPORTING
          job_output_info            = job_info
        TABLES
          i_outtab                   = i_output
          i_header                   = i_header
        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.
      p_otf[] = job_info-otfdata.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize                 = l_bin_filesize
        TABLES
          otf                          = p_otf[]
          doctab_archive               = p_doctab[]
          lines                        = p_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.

    SAP Version 4.7 Enterprise
    hello all,
    i am trying to do somethign rather basic that is discussed in these forums many times: convert Samrtforms output to PDF. i used the suggested forms but came across a unique (i think) error. my problem is that when i run the CONVERT_OTF_2_PDF function i get a core dump with the error "divide by zero". reading the core dump i see that there appears to be a font issue in the form:
    Code: Select all
    055610   * non-proportional font                                                
    055620   * if charwidth is not equal the default PostScript charwidth,          
    055630   * print string with individual character positioning                   
    055640   * WARNING: The unit used with PDFs (..) xx TJ command for individual   
    055650   * char positioning is 1 EM = 1/1000 fontsize!!!                        
    055660   * ofs_em = 1000 * (charwidth / fontsize_twip)                          
    055670   * WARNING: ...TJ moves current point to the LEFT of character          
    055680                                                                          
    055690   * set word spacing = 0                                                 
    055700     PERFORM PDF_APPEND_STREAM USING '0 Tw'. "#EC NOTEXT                  
    055710     IF CHARWIDTH < FONTINFO-DEF_SPACEWIDTH.                              
    055780   *   a positive value moves charpos to the LEFT!                        
    055790     ELSE.                                                                
    055800   *   OTF character spacing is wider than PostScript default             
    >       OFFSET_EM = 1000 * ( CHARWIDTH - FONTINFO-DEF_SPACEWIDTH )         
    055820                   / FONTINFO-FONTSIZE_TW.                                
    055830       PERFORM PDF_REM_LEAD_ZEROES_I USING 5 OFFSET_EM COORD.             
    055840   *   a negative value moves charpos to the RIGHT!                       
    needless to say this works perfectly when printing to paper. i am not using any non-stnadard fonts. the fonts are Arial with sizes of 6, 8, 10 and 12. any ideas? FYI, the code to call the functions is below. cheers,
    james
    Code: Select all
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          i_language             = sy-langu
          i_application          = 'SAPDEFAULT'
        IMPORTING
          e_devtype              = dev_typ
        EXCEPTIONS
          no_language            = 1
          language_not_installed = 2
          no_devtype_found       = 3
          system_error           = 4
          OTHERS                 = 5.
      ctrl_params-no_dialog = 'X'.
      ctrl_params-getotf = 'X'.
      out_opt-tdnewid = 'X'.
      out_opt-xsfcmode = 'X'.
      out_opt-xsf = ' '.
      out_opt-xdfcmode = 'X'.
      out_opt-xdf = ' '.
      out_opt-tdprinter = dev_typ.
      CALL FUNCTION fm_name
        EXPORTING
          control_parameters         = ctrl_params
        IMPORTING
          job_output_info            = job_info
        TABLES
          i_outtab                   = i_output
          i_header                   = i_header
        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.
      p_otf[] = job_info-otfdata.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize                 = l_bin_filesize
        TABLES
          otf                          = p_otf[]
          doctab_archive               = p_doctab[]
          lines                        = p_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.

  • Smartforms - Convert to PDF always displying bold, ignoring styles and font

    Hi out there,
    I'm not new to smartforms. But after creating a new form within a new style I'm not able to design it.
    But mayby it's designed correctly and only pdf conversion failed?
    The courios thing is, that sometimes (hleve font is replayced with standard courier) and all the fonts are displayed in BOLD.
    I also tried with standard sap styles, like hrforms etc...but the text is always displayed in BOLD.
    I just wanna use helve 10,12 px bold and non bold. I'm sure, that the fonts are setr up with se73, cause i have used them in an other form and they never did any problems.
    Regards,
    T

    i did a stupid misstake in getting the device.
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          i_language    = v_language
          i_application = 'SAPDEFAULT'
        IMPORTING
          e_devtype     = v_e_devtype.
    tdprinter was not set properly!

  • PDF wont upload or convert

    When I try to upload or convert a PDF the page just stays on the uploading or converting page cycling for 5+ minutes.  Nothing ever uploads or converts.

    Sorry to hear you're having trouble with the ExportPDF service.
    Could you provide some details about the file you're trying to convert?  What format are you trying to convert it to?  What kind of content is in the PDF? (text, images, hand-written text?)  Have you tried converting with the 'Recognize text' option disabled?

  • Smartform convert to WORD - e-mail/fax

    Hi All,
    Quickly can we convert Smartform output to Word output. Currently I am doing Smartform converted to PDF and sending that as e-mail/fax. New requirement is to send in word format. Can we convert Samrtform to WORD and send as e-mal/fax?
    Thanks in advance.
    Regards,
    Tim

    Check this code below ....
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            FORMNAME                 = 'ZSD_SFM_ATTACH'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
          IMPORTING
            FM_NAME                  = FM_NAME
    EXCEPTIONS
      NO_FORM                  = 1
      NO_FUNCTION_MODULE       = 2
      OTHERS                   = 3
    CALL FUNCTION FM_NAME
        EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
           CONTROL_PARAMETERS         = wa_control
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
           OUTPUT_OPTIONS             = wa_prnctrl
      USER_SETTINGS              = 'X'
        CUST_LINE                  = gl_cust_line
         IMPORTING
           DOCUMENT_OUTPUT_INFO       = wa_doc_info
           JOB_OUTPUT_INFO            = wa_outinfo
           JOB_OUTPUT_OPTIONS         = wa_job_opt
         EXCEPTIONS
           FORMATTING_ERROR           = 1
           INTERNAL_ERROR             = 2
           SEND_ERROR                 = 3
           USER_CANCELED              = 4
           OTHERS                     = 5.
    t_otf[] = wa_outinfo-otfdata[].
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
    EXPORTING
      USE_OTF_MC_CMD               = 'X'
      ARCHIVE_INDEX                =
       IMPORTING
          BIN_FILESIZE                 = g_filesize
        TABLES
          OTF                          = t_otf
          DOCTAB_ARCHIVE               = t_docs
          LINES                        = i_tline
    EXCEPTIONS
      ERR_CONV_NOT_POSSIBLE        = 1
      ERR_OTF_MC_NOENDMARKER       = 2
      OTHERS                       = 3
    convert PDF 132 to 255
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    No translation
    loop at i_tline.
      i_objbin-line = i_tline-tdline.
      append i_objbin.
    endloop.
    Convert PDF from 132 to 255.
      LOOP AT i_tline.
    Replacing space by ~
        TRANSLATE i_tline USING ' ~'.
        CONCATENATE w_buffer i_tline INTO w_buffer.
      ENDLOOP.
    Replacing ~ by space
      TRANSLATE w_buffer USING '~ '.
      DO.
        i_record = w_buffer.
    Appending 255 characters as a record
        APPEND i_record.
        SHIFT w_buffer LEFT BY 255 PLACES.
        IF w_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
      Refresh: i_reclist,  i_objtxt,  i_objbin,  i_objpack.
      clear w_objhead.
    Object with PDF.
      i_objbin[] = i_record[].
    loop at i_record.
       i_objbin-line = i_record-line.
       append i_objbin.
    endloop.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      glt_objpack-head_start = 1.
    Number of lines of an object header in object packet
      glt_objpack-head_num = 0.
    Start line of object contents in an object packet
      glt_objpack-body_start = 1.
    Number of lines of the object contents in an object packet
      glt_objpack-body_num = v_lines_txt.
    Code for document class
      glt_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Packing as PDF.
      glt_objpack-transf_bin = 'X'.
      glt_objpack-head_start = 1.
      glt_objpack-head_num = 1.
      glt_objpack-body_start = 1.
      glt_objpack-body_num = v_lines_bin.
      glt_objpack-doc_type = 'PDF'.
      glt_objpack-obj_name = 'ReturnForm'.
      CONCATENATE 'ReturnForm_output' '.pdf'
      INTO glt_objpack-obj_descr.
      glt_objpack-doc_size = v_lines_bin * 255.
      APPEND glt_objpack.
      glt_objhead = 'Return_form.PDF'. append glt_objhead.
    Document information.
      CLEAR i_reclist.
    Fill the receiver list
      clear gs_reclist.
    condense gl_fax_num.
      gs_reclist-receiver = P_Z_MFR_MAIL.
      gs_reclist-rec_type = co_u.
      append gs_reclist to i_reclist.
    Sending mail.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = gl_doc_chng
          put_in_outbox              = 'X'
          COMMIT_WORK                = 'X'
        TABLES
          packing_list               = glt_objpack
          object_header              = glt_objhead
          CONTENTS_BIN               = i_objbin
        contents_hex               = i_objbin
          contents_txt               = gt_objcont
          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.

  • Converted file not readable

    Why do I get ASCII type characxters instead of text in the converted file (PDF to word for MAC)

    Hi stupidminds,
    The quality of a conversion depends greatly on the quality of the PDF that you start with (and not all PDFs are created equally). Do you happen to know what was used to create the PDF?
    In any case, you may be able to get a better conversion by disabling OCR as described in this document: How to disable Optical Character Recognition (O... | Adobe Community
    Please let us know how that goes.
    Best,
    Sara

  • How do I upload a file into my acrobat cloud?  I am needing to do this in order to convert the pdf to excel.

    How do I upload a file into my acrobat cloud?  I am needing to do this in order to convert the pdf to excel.

    Hi wesm34245063,
    Here's a quick tutorial on using the ExportPDF online service to convert PDF files to Excel: Getting Started with ExportPDF | Adobe Community.
    I think that you'll find it's pretty easy, but if you do run into questions/issues, please let us know.
    Best,
    Sara

  • Is it possible to convert a PDF without uploading the file (i.e. by entering a URL)?

    My work-issued laptop doesn't allow me to upload files so it possible to convert a PDF file to Word bu just entering the URL of the document.I have a feeling this used to be feasible,
    Thanks

    Hi asdfg,
    You guess right! ExportPDF is an online service. Check out this 'Getting Started' guide as well.
    Hope this helps!
    Let us know we would love your feedback!
    Regards, Stacy

  • How can you convert a PDF File into a picture format for uploading?

    How can you convert a PDF File into a picture format for uploading?

    If you have Acrobat 11, you'd select: File > Save As Other > Image
    and select one of the available image formats.

  • How do i convert a PDF uploaded file to MSWord

    How do I convert a PDF file to MSWORD

    To export your PDF files to MS Word files:
    ExportPDF subscriber
    Using Web UI:
    Log into https://exportpdf.acrobat.com/signin.html with your Adobe ID and password
    Select “Export from PDF”
    Click “Select Files” button then choose your PDF file
    Select the format from the list below
    Check ON “Recognized text in” if your PDF file is scanned images to recognize the image to text
    Click “Export” button
    Click “Download” button in the progress bar after completion of exporting to download the file to your computer.
    Using Adobe Reader:
    Launch Adobe Reader X or Reader XI
    Select “Tools” and click “Sign In” link to sign in with your Adobe ID and password
    Select “Export PDF” then click “Select PDF file” link to choose your PDF file
    Select format from “Convert To” pull down menu(docx, doc,rft,xlsx)
    Click “Convert”
    Click “Download Converted File” link to download the file to your computer after the process is completed.
    Download Files:
    All exported/converted files are stored at https://files.acrobat.com and you can login with your Adobe ID and password.
    Or at Web UI you can click “FILES” next to “TOOLS” at top or click “View All files” in the file list of “Export from PDF” tool( or “Convert to PDF” or “Combine Files” tools for PDF Pack users) that will redirect you to the above site(https://files.acrobat.com)
    From Reader you can click “Store Files” under “Tools” and click the link of “Open Acrobat.com Files”
    Hisami

Maybe you are looking for

  • How do i upload word docs to an ipad 2, How do i upload word docs to an ipad 2

    is there any way of getting word documents onto the ipad 2 without having to buy the app as i will only use it occassionally??

  • Programmatically Set ReadOnly in an ADF Table using EL

    I have a requirement to allow updates only on the first record returned in a query returning multiple records - two of columns in the record can be updated and the rest are read-only by default. The records will be ordered so the most recently added

  • Emailing Scans in Acrobat 10

    It is incredably frustrating that I have to save a file before I can email it in Acrobat 10. This was not the case in 9. Does anyone know if you can do this. A lot of the scans I email I do not want a saved copy of because the scan was for someone el

  • Debit/credit indicator in Print document (DBERDL-SHKZG)

    Hi, I noticed that if a print document is reversed, the reversal document containts the same amount as the reversed document rather then the original amount * -1. The debit/credit indicator is initial as well. Is it normal? As I have FI/CO background

  • Multiple remote debugger connections from JDev

    Hello, I'm running JDev Studio Edition Version 11.1.2.3.0 I need to debug an application running on a 2 node WLS Cluster. I have the two servers running in debug mode listening on different hosts/ports. In JDev I click the debug button twice and open