HTTP AND PDF file download

I have some problems to send a PDF FILE to a http server using if_http_client class with for example methods :
CALL METHOD client->request->set_header_field
CALL METHOD client->send
CALL METHOD client->receive
I don’t want to use FM SO_NEW_DOCUMENT_ATT_SEND_API1, SO_NEW_DOCUMENT_ATT_SEND_MAPI , SO_NEW_DOCUMENT_SEND_API1
Could someone please give me a sample abap program doing this ?
It could be great.
Thanks

Welcome to SDN.
1. upload the pdf file to a itab using GUI_UPLOAD (file type 'BIN') ( i assume that you are doing this abap program and not in BSP page)
2. create a instance of cl_http_client
call method cl_http_client=>create
  exporting
    host          = 'www.server.com'
    service       = '80'
    scheme        = '1'
  importing
    client        = http_client.
3. set header fields.
call method http_client->request->set_header_field
  exporting
    name  = '~request_method'
    value = 'POST'.
call method http_client->request->set_header_field
  exporting
    name  = '~server_protocol'
    value = 'HTTP/1.1'.
call method http_client->request->set_header_field
  exporting
    name  = 'Content-Type'
    value = 'application/pdf' .
call method http_client->request->set_data
  exporting
    data   = <xstring holding the uploaded content>
    offset = 0
    length = rlength.
call method http_client->request->set_header_field
  exporting
    name  = 'Content-Length'
    value = txlen.
call method http_client->send
  exceptions
    http_communication_failure = 1
    http_invalid_state         = 2.
call method http_client->receive
  exceptions
    http_communication_failure = 1
    http_invalid_state         = 2
    http_processing_failed     = 3.
clear wf_string1 .
wf_string1 = http_client->response->get_cdata( ).
Hope this is clear.
Regards
Raja
Message was edited by: Durairaj Athavan Raja

Similar Messages

  • Download jpeg and pdf files on my iPhone 6

    Why can't I download jpeg and pdf files on my iPhone 6?

    Download from where? Downloading through Safari may work for images but will not work for other types of files.
    ~Lyssa

  • Hyperlinks to XLS, DOC, and PDF files that are included in a .chm file work intermittently.

    SUMMARY
    Hyperlinks to XLS, DOC, and PDF files that are included in a
    .chm file (and the Baggage Files) only work intermittently. The
    only solution appears to be deleting the Temporary Internet Files.
    PROBLEM
    1. I place the XLS, DOC, or PDF file in the Windows
    sub-directory that corresponds to the RoboHelp project sub-folder
    where the topic in which I’ll place the hyperlink exists.
    2. I open the help project in RoboHelp HTML.
    3. I right-click on the project’s Baggage Files
    sub-folder that corresponds to the Windows sub-directory in which I
    placed the XLS, DOC, or PDF file (in step 1).
    4. I import the XLS, DOC, or PDF file.
    5. I open the topic in which I’m going to place the
    hyperlink in the WYSIWYG editor.
    6. I “drag and drop” the Baggage File into the
    topic (in the WYSIWYG editor) to create a link to it.
    7. I save the changes and then generate HTML (.chm) help.
    8. I open the .chm file and click the hyperlink. The XLS,
    DOC, or PDF file may or may not open.
    9. When the hyperlink works correctly, for DOC and XLS files,
    a “File Download – Security Warning” dialog box
    appears asking, “Do you want to open or save this
    file?”. The buttons that are available are
    “Open”, “Save”, and “Cancel”.
    These buttons work then as one would expect. (When the hyperlink
    works correctly for a PDF file, it simply opens the PDF file in a
    new window; there’s no prompt to save, open, or cancel.)
    10. When a hyperlink does NOT work, for DOC, XLS, and PDF
    files, no dialog box or other visual message is displayed. Instead,
    the sound that is associated with the “Exclamation”
    program event is played (the “Windows XP
    Exclamation.wav” file is the WinXP default).
    Other Notes:
    - The hyperlinks ALWAYS work when I view a topic using the
    “View Selected Item” function (Ctrl+W) in the RoboHelp
    HTML project.
    - Once a hyperlink stops working, it will not start working
    again until I delete all the Temporary Internet Files.
    - A hyperlink will stop working even if Internet Explorer
    (iexplore.exe) is closed the entire time.
    WORKAROUND
    Through trial and error, I have discovered that if a
    hyperlink stops working, I can get it to work again using the
    following steps:
    1. Leave the .chm file open.
    2. Open Internet Explorer.
    3. Click Tools>Internet Options….
    4. From the “Internet Options” dialog box, select
    the “General” tab.
    5. Under the “Temporary Internet Files” section,
    click the “Delete Files…” button.
    6. From the “Delete Files” dialog box, select
    “Delete all offline content” and then click
    “OK”. The files are deleted and the “Delete
    Files” dialog box closes.
    7. Click “OK” to close the “Internet
    Options” dialog box.
    8. Without closing Internet Explorer and without re-starting
    the .chm file, all the hyperlinks that didn’t work before
    will now work.
    GENERAL SYSTEM INFORMATION
    - Windows XP Pro, SP2
    - Internet Explorer 6.0.2900.2180
    - RoboHelp X5, 5.0.2 Build 801
    - HTML (.chm) help project files exist on my local machine
    - HTML (.chm) help file is run from my local machine
    - Project is under RoboSource version control
    TEMPORARY INTERNET SETTINGS
    - “Check for newer versions of stored pages” is
    set to “Automatically”
    - “Current location” for the Temporary Internet
    files folder is set to “C:\Documents and Settings\My
    Username\Local Settings\Temporary Internet Files\”
    - “Amount of disk space to use” is set to
    “594” MB
    “View Files…”
    - An XLS or DOC file will be listed here if I click its
    hyperlink and then click either “Open” or
    “Save” from the “File Download – Security
    Warning” dialog box.
    - A file will appear here even if I click “Save”
    and then click “Cancel” from the subsequent “Save
    As” dialog box.
    - If I click “Cancel” from the “File
    Download – Security Warning” dialog box, the file does
    not appear in the Temporary Internet Files folder.
    - When a file does appear in the Temporary Internet Files
    folder, its Internet Address is displayed similar to the following:
    “ms-its:C:\PrimaryProjectFolder\ProjectName.chm::/SubFolderName/FileName.xls”
    “View Objects…”
    Here’s a list of all the program files that appear:
    - “Microsoft Office Template and Media Control”
    (Last Accessed 12/13/06) (Version 12,0,6024,0)
    - “Shockwave ActiveX Control” (Last Accessed
    12/14/06) (Version 10,1,4,20)
    - “Shockwave Flash Object” (Last Accessed
    12/18/06) (Version 9,0,28,0)
    - “Windows Genuine Advantage Validation Tool”
    (Last Accessed 12/14/06) (Version 1,5,722,0)
    - “WUWebControl Class” (Last Accessed 12/13/06)
    (Version 5,8,0,2469)
    Today is 12/18/06 so the only program file that is listed as
    having been “Last Accessed” today is the
    “Shockwave Flash Object”.
    REQUEST FOR HELP
    I really want to include certain PDF, DOC, and XLS files in
    their native format in a .chm file. However, I need a better
    solution to my problem than the one I discovered. What I really
    want is to avoid the entire problem altogether.
    Have anyone seen this before or have any suggestions?

    You wont be able to do that. The embedded objects would appear as images only.

  • I am unable to open the microsoft word and excel and pdf files after upgratding to 4.3.3 os version

    I am unable to open the microsoft word and excel and pdf files after upgratding to 4.3.3 os version. I was able to access them in 4.3.1 .
    Can anybody tell when is this getting resolved.

    http://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile
    Your old Profile is located here in Vista & Win7: <br />
    ''drive'':\Users\''Windows login user name''\AppData\Roaming\Mozilla\Firefox\Profiles\''profile_name''

  • Error while opening PDF file downloaded  from database Blob column

    Hi All,
    I am working on jdev 11.1.1.4.0.
    In my use-case I am using filedownload Actionlistner on a link to get the PDF file stored in the database in blob field. These files are being uploaded from other use-case in adf only.
    After getting the dialog box to open/save/cancel for the PDF file when i click on open then i am getting an error *'Adobe Reader could not open 'abc.pdf' because it is either not a supported file type*
    or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly docoded)' for some files , and to my surprise I am able to open some files.
    When I open these PDF files separately from desktop I am able to view the content of each and every file in adobe reader.
    I dont know where the problem exactly lies , while uploading/downloading the file . Any ideas/thoughts to resolve this issue?
    Thanks
    Kanika

    Thanks a lot Timo...!!!
    I checked the PDF file downloaded directly from the blob column in DB, there only it is corrupted so must be the problem in uploading the file. I am checking the code line by line,, but no problem in setting the file content type,size etc.
    Here is the code snippet ..
    byte[] buff;
    buff = new byte[(int)length]; -- Length is the file size
    int bytesRead = is.read(buff);
    for (int i = 0; bytesRead < buff.length; i++) {
    // int b = is.read();
    int b = is.read();
    if (b == -1)
    break;
    buff[i] = (byte)b;
    BlobDomain blobDomian = new BlobDomain((buff));
    TestVORow = (TestVORow Impl)TestVO.createRow();
    if(blobDomian != null) {
    TestVORow.setAttachment(blobDomian);
    am.getTransaction().commit();
    This seems to be Ok to me..the same issue, file is still corrupting.
    Any thoughts from your side ???
    Thanks
    Kanika
    The problem is resolved.
    Changes made are instead of
    InputStream is;
    used ... BufferedInputStream bis ;
    and after
    for (int i = 0; bytesRead < buff.length; i++) {
    // int b = bis.read();
    int b = bis.read();
    if (b == -1)
    break;
    buff[i] = (byte)b;
    bis.close(); // use this close bufferedInput Stream.
    Able to open each and every file now..Thanks for your suggestions Timo and Frank.
    Edited by: Kanika on Mar 6, 2012 3:15 AM

  • Trouble opening jpeg and pdf files.

    I have a fully current version of Photoshop (ICloud).  When attempting to open some jpeg files and pdf files, they remain ghosted and will not open.  I think it may have to do with the settings in the 'open' window but i don't know what to do.  ?????

    …and no one knows how to help you until you provide details.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers: 
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Just upgraded to Lion, can't open any pdf file downloaded from internet that was fine with Leopard. How can I overcome this obstacle ?

    Just upgraded to Lion, can't open any pdf file downloaded from the internet that was fine with Leopard before. I just got a black screen when I clicked on a pdf icon on a given internet site, and same happened with several sites that I visited. How can I overcome this obstacle ?

    Try two things with Safari not running:
    1) Launch Adobe Reader, open its preferences, select the Internet category, and check the values under "Display PDF in browser using".  If it's checked, try unchecking it.
    2) Look in /Library/Internet Plug-Ins (at the top-level of your boot volume) for something names AdobePDFViewer.plugin.  If you see such a file, try moving it to a folder named "Disabled Plug-Ins" (if such a folder exists) or onto the Desktop.
    Then see how things work.

  • Making .pdf files downloadable

    How do I make .pdf files downloadable in my iWeb page?
    I have several .pdf files on my desktop that I'd like to make available to visitors to my iWebsite for download. Please forgive me if this is "intuitively obvious." I am new to the forum and am also navigationally clumsy until I use it a while.

    You either need to Zip or Compress, as it is in 10.5 and then in iWeb click on Inspector and then Hyperlink and just create a hyperlink to a file. One someone clicks the link, it will then be downloaded as a Zip file containing the pdf.

  • I am having the same problem I think.  With mobileme you simply copy documents to the idisk folder and then synch.  I cannot seem to sink that folder anymore.  Any idea as to how I can simply copy folders to icloud and then access the MS Word and PDF file

    I am having the same problem I think.  With mobileme you simply copy documents to the idisk folder and then synch.  I cannot seem to sink that folder anymore.  Any idea as to how I can simply copy folders to icloud and then access the MS Word and PDF files on my iphone?

    Apple never bopthered to explain that this would happen
    Your iDisk is still accessible after moving to iCloud in exactly the same way as before. Nothing is deleted until June 30th 2012.
    , so I could easily have lost ALL of the files I kept on iDisk.
    No, you couldn't. Firstly, nothing was deleted from your iDisk. Secondly, any files stored on your iDisk should never be your only copy. Even if your iDisk spontaneously combusted, you should keep local backups elsewhere.
    Does Apple WANT people to move their storage elsewhere and stop paying Apple for it?
    Yes. Apple doesn't provide such a service anymore, nor are you paying them for it.
    Apple has made no effort to suggest remedies for the problem it has given iDisk users
    They've provided instructions on how to download your files from your iDisk. What you do with them after that is your choice.

  • Tiff image and pdf file

    Hi,
    I am working with project that requires showing different types of images and pdf files using oracle ADF components. It was so easy to show jpeg and gif, for example, using objectMedia. I tried to use the same component, objectMedia, to show tiff image, but it didn't work and I was unable to find suitable component to show pdf file.
    Is there anyone some can help me in showing tiff image and pdf file.
    Alice

    Correction, PDF is not required to be geneated, but displayed.
    Display PDF and tiff with af:objectImage ?
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/objectImage.html

  • How can I recover my purchased books and PDF files in my library?

    How can I recover my purchased books and PDF files in my library?

    you can re-download all purchases from the iBooks store at any time. PDF's you will need to have kept the PDF on your hard drive or on a service such as Dropbox, then you can re-import them into iTunes.

  • When saving files from the internet, why doesn't Firefox 'know' to put .jpg files in "Photos" and pdf files in "Documents"?

    When saving files from the internet, why doesn't Firefox 'know' to put .jpg files in "Photos" and pdf files in "Documents"? IE always saved photos in the "Photos" file and documents in the "Documents" file. Firefox makes me choose every time. Very annoying.

    How about if Firefox is programmed like IE in this ONE thing...
    When saving files from internet sources, if the file ends in a typical photo extension such as .jpg, .bmp, .tif etc. it defaults to save it in your PHOTOS folder.
    When saving anything like a .doc, .pdf etc. it defaults to save it to your DOCUMENTS.
    You could still change it to 'desktop' if that if really where you want all your photos and documents... or some other folder that you decide, but DEFAULTS to the LOGICAL folder.
    I have carpal tunnel SO bad that even typing this suggestion is painful and having to make the extra click along with moving the mouse EVERY time I want to save something is painful.
    ALSO, I shouldn't need a bunch of ADDONS to accomplish this. I tried downloading one and it did nothing. The problem still exists.

  • How do I load microsoft office and pdf files onto an Ipad

    How do I load microsoft office and pdf files onto an Ipad?

    You can email them, you can use DropBox, SugarSync or another cloud service or you can use iOS file sharing.
    But in all cases you need an app on the iPad that will open and save those types of files. iBooks, Adobe Readers, Good Reader and Save 2 PDF will all save PDF files.
    Documents to Go, Quick Office Pro and the Apple iWorks apps will open and save the MS office files. You can Google - "iPad apps that are compatible with Microsoft Office files" and you will find other alternatives - or search the app store for more.
    You can read this as well for some instruction on getting those files onto an iPad.
    http://online.wsj.com/article/SB10001424052748703899704576204564046912604.html

  • Uploading .doc and .pdf files from iPad

    Is there any such free app in App Store to upload .doc and .pdf files from my iPad mini to Internet?
    I usually upload my Resume on different job portals, but it is not possible from Safari or Chrome browsers on my iPad mini, I have to do it from my PC every time just to upload a single file. Looking for a solution to this reported issue.
    Thank you..

    There is no native ability to upload files other than photos and videos using the built in Safari browser.
    Look into iCab Mobile for file uploads to websites.  Its not free though, and I'm not aware of a free alternative at this point.
    https://itunes.apple.com/en/app/icab-mobile-web-browser/id308111628?mt=8
    You will need to transfer the file to iCab to be able to upload it though.

  • Web Clipping portlet and pdf files

    Hi,
    I have created a web clipping portlet which just includes a set of links to HTML and pdf files. When I try to open a link to a pdf file the web clipping portlet fails, but links to the html content work fine
    Is it possible using web clipping to open the links to the pdf files and display them in the web clipping portlet ?
    Thanks,

    Hi,
    I have created a web clipping portlet which just includes a set of links to HTML and pdf files. When I try to open a link to a pdf file the web clipping portlet fails, but links to the html content work fine
    Is it possible using web clipping to open the links to the pdf files and display them in the web clipping portlet ?
    Thanks,

Maybe you are looking for

  • EJB 3.0 - Destinations not specified

    Hi, I  am trying to deploy a J2EE application supporting EJB 3.0 on SAP CE 7.1 . During the deployment using NWDS , i am getting the error as "Destinations not specified". However , i have already preformed below listed steps : --> I have specified t

  • X61s running external monitor on native (1920x1200) resolution

    Hi, I'm running a X61s with an NEC 2690WUXi monitor. Trouble is that I can't get the Thinkpad to output a 1920x1200 signal (even though I know it is capable). I select the 1920x1200 resolution, but it always outputs 1920x1080 (with panning up an down

  • Lag on key press (key event)

    Hello, I am currently working on a simple game in Java. I've used Java's Key_Pressed in Key Event to control a ship moving back and forth with the up and down keys. I've noticed that when a key is pressed there is a short pause before the ship actual

  • Datagrid scrolls on change or click event - why?

    Hi, How do I stop my datagrid scrolling one line when I click on the top row? This happens with change, itemClick, and itemDoubleClick. It does not scroll on rows other than the top row. private function columnClick(e.ListEvent):void if e.columnIndex

  • Password keeper password?

    when, in the spirit of enquiry, i open password  keeper it wants me  to enter a password what does password keeper do?- i'm going to guess at  what it says on the label and that whenever i enter a password it keeps it there and that the password prev