Regarding the uploading the pdf file to the application server

hi,
iam getting this error while uploading the pdf file to the applicatioin server.
"There was an error while trying to parse an image"
to convert smartform into PDF file we ll use convert_otf FM.
If see that FM data ll be stored in it_tline structure ok.
For sending to application server we ll use
OPEN DATASET p_arch for OUTPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
  LOOP AT it_tline.
  TRANSFER it_tline to p_arch.
  ENDLOOP.
  CLOSE DATASET p_arch.
Ok
For getting data from internal table we ll use
OPEN DATASET p_arch FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS
do.
  READ DATASET p_arch INTO it_tline.
  if sy-subrc = 0.
    APPEND it_tline.
    ELSE .
      exit.
      endif.
  enddo.
CLOSE DATASET p_arch.
      LOOP AT it_tline.
    TRANSLATE it_tline USING '~'.
    CONCATENATE wa_buffer it_tline INTO wa_buffer.
  ENDLOOP.
  TRANSLATE wa_buffer USING '~'.
  DO.
    i_record = wa_buffer.
    APPEND i_record.
    SHIFT wa_buffer LEFT BY 255 PLACES.
    IF wa_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.
Attachment
  REFRESH:
    i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
  CLEAR wa_objhead.
  i_objbin[] = i_record[].
Create Message Body
Title and Description
  i_objtxt = 'COMMERCIAL INVOICE'.
  APPEND i_objtxt.
  DESCRIBE TABLE i_objtxt LINES v_lines_txt.
  READ TABLE i_objtxt INDEX v_lines_txt.
  wa_doc_chng-obj_name   = 'COMMERCIAL INVOICE'.
  wa_doc_chng-expiry_dat = sy-datum + 10.
  wa_doc_chng-obj_descr  = 'COMMERCIAL INVOICE'.
  wa_doc_chng-sensitivty = 'F'.
  wa_doc_chng-doc_size   = v_lines_txt * 255.
  CLEAR i_objpack-transf_bin.
  i_objpack-head_start = 1.
  i_objpack-head_num   = 0.
  i_objpack-body_start = 1.
  i_objpack-body_num   = v_lines_txt.
  i_objpack-doc_type   = 'RAW'.
  APPEND i_objpack.
Attachment
(pdf-Attachment)
  i_objpack-transf_bin = 'X'.
  i_objpack-head_start = 1.
  i_objpack-head_num   = 0.
  i_objpack-body_start = 1.
  DESCRIBE TABLE i_objbin LINES v_lines_bin.
  READ TABLE i_objbin INDEX v_lines_bin.
  i_objpack-doc_size =  v_lines_bin * 255 .
  i_objpack-body_num  = v_lines_bin.
  i_objpack-doc_type  = 'PDF'.
  i_objpack-obj_name  = 'COMMERCIAL INVOICE'.
  i_objpack-obj_descr = 'COMMERCIAL INVOICE'.
  APPEND i_objpack.
BREAK-POINT.
  IF it_adr6[] IS NOT INITIAL.
    LOOP AT it_adr6 INTO wa_adr6.
      CLEAR i_reclist.
      i_reclist-receiver = wa_adr6-smtp_addr.
      i_reclist-rec_type = 'U'.
      i_reclist-com_type = 'INT'.
      APPEND i_reclist.
    ENDLOOP.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data = wa_doc_chng
        put_in_outbox = 'X'
      TABLES
        packing_list  = i_objpack
        object_header = wa_objhead
        contents_bin  = i_objbin
        contents_txt  = i_objtxt
        receivers     = i_reclist.
  ENDIF.
The above error I am getting.
Please give your suggestions
Thanks in advance

U can use this code
Reward if useful
REPORT  ZMN_PDF_UPLOAD.
data: begin of itab occurs 0,
field(256),
end of itab.
data: dsn(100) value '\usr\sap\DEV\DVEBMGS00\work\testpdf',
length like sy-tabix,
lengthn like sy-tabix.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\test.pdf'
filetype = 'BIN'
importing
filelength = length
tables
data_tab = itab.
open dataset dsn for output in binary mode.
loop at itab.
transfer itab-field to dsn.
endloop.
close dataset dsn.
clear itab.
refresh itab.
*To crosscheck if it went well
open dataset dsn for input in binary mode.
do.
read dataset dsn into itab-field.
if sy-subrc = 0.
append itab.
else.
exit.
endif.
enddo.
call function 'GUI_DOWNLOAD'
exporting
filename = 'c:\temp\testn.pdf'
filetype = 'BIN'
bin_filesize = length
importing
filelength = lengthn
tables
data_tab = itab.
*Or
*Use the TCode
*CG3Z or CG3Y
*for downloading to Application Server.

Similar Messages

  • Download PDF File to SAP Application Server

    Hi,
    I need to download the PDF file to SAP Application Server. Can any one please help me to Solve this Issue?
    Thanks in Advance,
    Kannan

    You can read and upload the file to the PC:
    report ztest.
    data: begin of itab occurs 0,
            field(256),
          end   of itab.
    data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
          length  like sy-tabix,
          lengthn like sy-tabix.
    call function 'GUI_UPLOAD'
         exporting
              filename   = 'c:temptest.pdf'
              filetype   = 'BIN'
         importing
              filelength = length
         tables
              data_tab   = itab.
    open dataset dsn for output in binary mode.
    loop at itab.
      transfer itab-field to dsn.
    endloop.
    close dataset dsn.
    clear   itab.
    refresh itab.
    open dataset dsn for input in binary mode.
    do.
      read dataset dsn into itab-field.
      if sy-subrc = 0.
        append itab.
      else.
        exit.
      endif.
    enddo.
    call function 'GUI_DOWNLOAD'
         exporting
              filename     = 'c:temptestn.pdf'
              filetype     = 'BIN'
              bin_filesize = length
         importing
              filelength   = lengthn
         tables
              data_tab     = itab.
    Rob

  • Upload new pdf file with the same name

    We are trying to upload a pdf file with a specific name (i.e
    file.pdf) that has links to it on many pages of a website. We need
    the pdf file to keep the same name but when we try to upload it,
    Contribute is being 'smart' and changing the name so as to not
    overwrite the file on the server. But we WANT to overwrite the file
    on the server. Any ideas on how we can achieve this in Contribute?
    Thanks so much (in advance) for your help!

    Actually, we have the same problem and I believe the answer
    lies in the abilities that your role has assigned to it. The
    solution that ThinkInk gave works *if you are allowed to delete
    files*. If your role doesn't have that permission, then it will
    just upload another copy of the file and rename it.
    It's rather irritating that there isn't more control over
    this...our server is littered with *thousands and thousands* of
    duplicate files that originate from this situation.
    If your administrator wants you to be able to delete files as
    well, then you could get him/her to give you that permission, and I
    believe this will allow you to overwrite the file by using the
    "Publish file from my computer" option described above.

  • Upload the doc , pdf  file presentation to application server

    When upload file from presentaion to application server other then text
    file data is corruption in wed dynpro application using the UI element
    of UPLOAD. we used the code in custom application when we checked in
    T.Code : 'AL11'. only text file is showing file other then text file
    data is showing as corrupt.
    code:
    elem_sel_opt_1->get_attribute(
    EXPORTING
    name = 'DATASOURCE'
    IMPORTING
    value = gd_data ).
    CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
    EXPORTING
    in_xstring = gd_data
    IMPORTING
    out_string = gd_filedata.
    SPLIT gd_filedata AT cl_abap_char_utilities=>newline INTO TABLE
    ist_data.
    Opening the File
    OPEN DATASET gd_file_appl IN TEXT MODE FOR OUTPUT ENCODING DEFAULT. IF sy-subrc NE 0.
    WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
    EXIT.
    ENDIF.
    Transferring Data
    LOOP AT ist_data INTO wa_data.
    TRANSFER wa_data TO gd_file_appl.
    ENDLOOP.
    Closing the File
    CLOSE DATASET gd_file_appl.
    is it problem with my code. is it problem with UI element.
    for file uploading the prasentation server to appliation.
    we try with binary mode also
    Regards
    Praveen Chetpally.

    You can't tranfer the whole PDF data with just one transfer statement, instead you have to loop that table and transfer the data to the file until you reach the last row.
      open dataset pr_file for output in binary mode."text mode encoding  NON-UNICODE.
      if sy-subrc  0.
        exit.
      endif.
      loop at fp_formoutput-pdf  *****************
        transfer fp_formoutput-pdf  to pr_file.
      endloop.
      close dataset pr_file.
      clear :fp_formoutput-pdf,lv_file.

  • Why can you not upload a pdf file to the cloud?

    Other online storage services allow PDF files to be uploaded; but not iCloud. Why not?

    Winston Churchill wrote:
    You can do it with Air Doc as I've already said, there's an app for the mobile device and an application in the MAS for the MAC.
    As I posted to you already, as far as I can see Air Doc only lets you upload to the iCloud from iOS, not OS X.  I'd would welcome instructions about how to make it upload from OS X if you know how.

  • How can I upload a pdf file into the application server?

    Hi,
    I have the otf data, which i have converted into pdf using the funcation module "Convert_otf". Is it possible to upload the pdf file in application server?

    Dear Srishti,
    Use OPEN DATASET in BINARY MODE.
    following link will help you.
    http://scn.sap.com/thread/1480434
    thanks,
    vidyasagar

  • Open a pdf file located on Application Server from forms 10g

    Dear all,
    I want to open a pdf file which is stored in a folder on Application Server.
    I have the following codes but could not be able to open the file.
    1. host('rundll32 url.dll,FileProtocolHandler C:\REP012.pdf');
    in this code I mentioned the path on local machine which is okey.
    but the question is that how to open the file which is located in a folder on application server?
    the following code don't show and file or error:
    host('rundll32 url.dll,FileProtocolHandler /EMS/MANUALS/ACC001.PDF');
    This is the file on Application Server not on local machine.
    2. web.show_document('//EMS/MANUALS/ACC001.PDF/','_blank');
    This give HTTP 404 NOT FOUND error
    I think the problem is in path, how to mention the path of my Application Server file?
    Regards:
    Muhammad Nadeem

    Hi,
    Did you find a solution to this?
    We are running into the same problem where we need to open a file present on the application server (path /opt/webapps/applications/ISL/)
    When we try this from the local machine it works (path D:/forms) however it does not work while trying to open it from the application server.
    Regards,
    Pooja

  • PDF file write to application server

    Hi All,
    I want to write PDF file to application server while downloading its writing but in this manner
    %PDF-1.6#%####
    108 0 obj#<</First 17/Length 108/Filter/FlateDecode/N 3/Type/ObjStm>>stream
    xڲT0P04Q07W05#2,#ll##K#J*#R#C####Sbq#[^##GjNYjIfr##SN##kr~Jf#~xf#c^q&##Ҧ##agG#a####X###T##XR### ##b#
    Please let me know where i am doing wrong.
    Please see below my code .
    (the scenario is when i download the pdf file i want to write the same file in to app server )
      call function fm_name
        exporting
          /1bcdwb/docparams  = fp_docparams "
          ls_header          = ls_waste
          lt_item            = gt_rkpf
          aufnr              = lv_aufnr
        importing
          /1bcdwb/formoutput = fp_formoutput
        exceptions
          usage_error        = 1
          system_error       = 2
          internal_error     = 3
          others             = 4.
    concatenate 'D:\temp\PROCESSORDER_' ls_waste-rsnum   '.PDF' into lv_file.
        pr_file = lv_file.
      open dataset pr_file for output in binary mode."text mode encoding  NON-UNICODE.
      if sy-subrc  0.
        exit.
      endif.
      transfer fp_formoutput-pdf  to pr_file.
      close dataset pr_file.
      clear :fp_formoutput-pdf,lv_file.
    Please any one help me thanks,
    Thanks,
    Kumar

    You can't tranfer the whole PDF data with just one transfer statement, instead you have to loop that table and transfer the data to the file until you reach the last row.
      open dataset pr_file for output in binary mode."text mode encoding  NON-UNICODE.
      if sy-subrc  0.
        exit.
      endif.
      loop at fp_formoutput-pdf  *****************
        transfer fp_formoutput-pdf  to pr_file.
      endloop.
      close dataset pr_file.
      clear :fp_formoutput-pdf,lv_file.

  • Unale to print pdf files in oracle application server using oracle forms

    Hi
    We are using oracle developer suite 10g(10.1.2.3.0) in Windows vista. (test environment)
    Oracle application server 10g(10.1.2.3.0) in Hp-UX 11iv3 (production environment)
    We are able to print pdf files in test environment from oracle forms using the below command:
    host('/usr/bin/lp -d p9775hplaser '||'/ashome/output/'||:print_file);
    But while declaring to the live environment it is not working
    host('cat '||:pdf_print_file||' | acroread -toPostScript | /usr/bin/lp -dp9775hplaser');
    but when the above command is put in hp-ux cmd prompt it is workinh"'cat '||:pdf_print_file||' | acroread -toPostScript | /usr/bin/lp -dp9775hplaser'";
    Kind ly tell me whether the problem i with the host command and some other command is available for printing files from forms.

    Here is my guess:
    declare
    AppID PLS_INTEGER;
    begin
    AppID := DDE.App_Begin('acroread -toPostScript '||file name,DDE.APP_MODE_MINIMIZED);
    end;

  • How to Generate PDF file on the server

    Hello Everybody !
    I Need to generate a PDF File on the server, and I'm usin the command :
    "OPEN DATASET p_path FOR OUTPUT IN BINARY MODE message l_verro .
           LOOP AT t_lines.
             TRANSFER t_lines-tdline TO p_path.
           ENDLOOP.
           CLOSE DATASET p_path.  "
    The File was generated, but is corrupt . Don't Open the file, It's wrong.
    When I use the function GUI_DOWNLOAD the file is generated  right. But in the server not.
    Can someone help me please ??
    Best Regards,
    Wagner Duarte

    Hi.
    did you check this post?
    Download PDF File to SAP Application Server
    It doest the same as you are asking.
          " Write PDF Binary Data to App Server
        OPEN DATASET lv_filename FOR OUTPUT IN BINARY MODE.
        IF sy-subrc = 0.
          LOOP AT lines INTO ls_data.
            TRANSFER ls_data TO lv_filename.
          ENDLOOP.
        ENDIF.
        CLOSE DATASET lv_filename.
    Regards
    Miguel

  • "  Displaying the Report in PDF file Format "

    Hai Friend's,
    I have Developed a Report in Web-Intelligence .My Report is having 50 Collums and 600 Rows. The Report is too big Report. when the Save the Report in PDF File format, The PDF file Format Report is Consisting of 10 Pages, The Report Output is not coming in One Page. But my user want the Report  all the Field's :: Collumms,Rows in one Page.can Anybody let me know the solution.

    Hi Ashok,
    You can change the page size and orientation in the web.xml in the following folder.
    Web Intelligence default Page size Modification u2013 Follow these steps:
    1. Open the defaultconfig.xml file found in the following directory:
    servername\Program Files\Business Objects\Tomcat\webapps\businessobjects\enterprise115\desktoplaunch\webiApplet\AppletConfig
    2. Look for the following code near the top of the page:
    <KEY VALUE="page*default">
    <FORMAT NAME="A4" ORIENTATION="portrait" />
    </KEY>
    3. Change this to:
    <KEY VALUE="page*default">
    <FORMAT NAME="LETTER" ORIENTATION="portrait" />
    </KEY>
    4. Save the file.
    All the Best,
    Madhu...

  • How to upload data in the pdf file to the R/3 with fileupload element ?....

    Hi Experts,
    I need to upload the data in the pdf file to the R/3 with fileupload element.
    But I am not able to get the correct data(it is confusion code) in the pdf file when I debug the programe. However, I am able to get the data if the data is in the txt or excel file.
    Do you give some hint for this problem ?
    Thanks & Regards,
    Tao

    Hi, experts,
    The version of R/3 : ABAP: 10, BASIS:11.
    Best regards,
    tao

  • How to upload a PDF file, zip it and download the zipped file?

    Hi Experts,
    I have a requirement to upload a PDF file, convert that to a ZIP file and download it. If anyone has worked on this requirement, can you please guide me on this? Thanks.
    Avi

    Here you go.  Hope it helps.
    REPORT  zrich_0004.
    DATA: lt_data TYPE TABLE OF x255.
    DATA: ls_data LIKE LINE OF lt_data.
    DATA: lv_zip_content TYPE xstring.
    DATA: lv_size  TYPE i.
    DATA: lv_filename TYPE string.
    DATA: lv_path TYPE string.
    DATA: lv_fullpath TYPE string.
    DATA: lt_filetab TYPE TABLE OF file_table.
    DATA: ls_filetab LIKE LINE OF lt_filetab.
    DATA: lv_rc TYPE sy-subrc.
    DATA: lv_content TYPE xstring.
    DATA: lo_zip TYPE REF TO cl_abap_zip.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: p_up TYPE string DEFAULT 'C:\upload.pdf' .
    PARAMETERS: p_down TYPE string DEFAULT 'C:\download.zip' .
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_up.
      REFRESH lt_filetab. CLEAR ls_filetab.
      cl_gui_frontend_services=>file_open_dialog(
          CHANGING
            file_table              = lt_filetab
            rc                      = lv_rc
        EXCEPTIONS
          OTHERS                  = 5 ).
      READ TABLE lt_filetab INTO ls_filetab INDEX 1.
      IF sy-subrc = 0.
        p_up = ls_filetab-filename.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_down.
      CLEAR: lv_filename, lv_path, lv_fullpath.
      cl_gui_frontend_services=>file_save_dialog(
         CHANGING
           filename             = lv_filename
           path                 = lv_path
           fullpath             = lv_fullpath
         EXCEPTIONS
           OTHERS               = 4 ).
      p_down = lv_fullpath.
    START-OF-SELECTION.
      CREATE OBJECT lo_zip.
    * Read the data as a string
      cl_gui_frontend_services=>gui_upload(
        EXPORTING
          filename                = p_up
          filetype                = 'BIN'
        IMPORTING
          filelength = lv_size
        CHANGING
          data_tab                = lt_data
        EXCEPTIONS
          OTHERS                  = 19 ).
    * convert binary to xstring
      CLEAR lv_content .
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = lv_size
        IMPORTING
          buffer       = lv_content
        TABLES
          binary_tab   = lt_data
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
    * Get the file name of the uploaded file
      DATA: lv_upfilename TYPE string.
      DATA: lv_tmp TYPE char1024.
      DATA: lv_tmp_file TYPE char1024.
      lv_tmp = p_up.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp.
      SPLIT lv_tmp AT '\' INTO lv_tmp_file lv_tmp.
      CALL FUNCTION 'STRING_REVERSE'
        EXPORTING
          string  = lv_tmp_file
          lang    = sy-langu
        IMPORTING
          rstring = lv_tmp_file.
      lv_upfilename = lv_tmp_file.
    * add to zip file.
      lo_zip->add( name = lv_upfilename content = lv_content ).
      lv_zip_content   = lo_zip->save( ).
    * Conver the xstring content to binary
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          buffer        = lv_zip_content
        IMPORTING
          output_length = lv_size
        TABLES
          binary_tab    = lt_data.
    * download
      cl_gui_frontend_services=>gui_download(
          EXPORTING
            bin_filesize = lv_size
            filename     = p_down
            filetype     = 'BIN'
          CHANGING
            data_tab     = lt_data
          EXCEPTIONS
            OTHERS       = 24 ).
    Regards,
    Rich Heilman

  • I am trying to upload my PDF file from my IBooks but its only giving me the option to upload from my pictures/gallery. How do I get it to where I can upload PDF files from my iBook or how do I transfer my PDF files to my pics?

    I am trying to upload my PDF file from my iBooks but its only giving me the option to upload from my pictures/gallery. How do I get it so I can upload from my iBooks or move my PDF files to my gallery so I can upload it?

    I'm having the same issue. I saved a PDF from an email into iBooks. I'm on apple applying for a job but the only option the upload button has is from the Photos file. How ironic right? Luckily I'm in Logistics and not an IT specialist applying for this job! Lol. Does anyone know the fix?

  • Can not select a PDF file in the file uploader window after clicking the Browse... button for a file type input element.

    After upgrading to 5 (this worked in 4) I can not select a PDF file in the File Upload dialog that appears when I click the Browse button next to an HTML file type input element. The specific HTML element source code has the attribute: ACCEPT="image/*". I can select image files such as jpg, png, tiff, etc. But not PDF. This worked great in Furefox 4 and works in the latest version of Safari.
    The HTML code for the form element is:
    INPUT TYPE="file" NAME="file_1" ACCEPT="image/*" SIZE=35
    The File Upload dialog lists all files with PDF extension as dimmed and not selectable in Firefox 5.
    Can you help?

    Hi Purush
    Unfortunately we couldn't solve the problem. Our IT specialist checked it with SAP directly. SAP doesn't support the SAP KW solution anymore. Therefore we checked-in the document in ".doc"-Format.

Maybe you are looking for

  • Error in creation of custom function module.

    hi,           i am trying to create custom rfc enabled function module by copying the standard function module prgn_profile_name_get. in the export parameter PROFILE_FROM_TPRPROF what is the type i have to associate for this parameter. when i try to

  • Unicode error in program

    I am getting the following error when I do a syntax check when using a PNP logical database with unicode checkbox checked in attributes.  Can someone give me a solution to avoid that.   Thanks in advance In unicode programs the - cannot appear in nam

  • Email attachments and digital signature

    I used to be able to open a email attachment, review it and then digitally sign it. Since the new IT people came it, the digital signature simply disappears. Any way to restore this function? Thanks.

  • Problem in Creating Receiver Agreement

    Hi, I had created a namespace in IR and did a simple idoc to file scenario. In the IR, the MI and MT are not been shown while creating the receiver agreement and receiver determination. Do let me know what would have been wrong. I tried entering it m

  • Migration Tool for Contract & PO from R/3 to SRM 5.0

    Hi gurus, I'm working on an implementation of SAP SRM 5.0 for the following scenario: - Plan driven - Contract Management - Order Management We actually have 2 R/3 system. We want to migrate contract and PO from this system to SRM and then manage con