Display PDF from BAPI's binary output

Dear All,
I am struck badly with this scenerio here.
we have a Bapi which is generating an adobe form in the backend and providing that as an attribute of type binary.
i used the following code to display that binary output, to be opened in Acrobet reader.
byte[] pdfContent= wdContext.nodeZhra_Get_Lettertype_Desc_Input().nodeOutput().currentOutputElement().getE_Bin_File();
     IWDCachedWebResource pdfResource = WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);
     IWDWindow win = wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),"PDF in Arabic",true);
     win.setTitle("PDF in Arabic");
     win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
     win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
     win.removeWindowFeature(WDWindowFeature.MENU_BAR);
     win.removeWindowFeature(WDWindowFeature.STATUS_BAR);
     win.show();
the problem is that the acrobet reader opens and says it could not display the file and it may be not supported or might be damaged.BUT
1. the file is being generated and correctly displayed on another system
2. both systems have the same version and updates of acrober reader 9.
Kindly let me know the solution or some work-around to solve this problem. Is there a way,where i should use interactive form to do this...
thanks in advance

Hello!
If it works on one client but not on the other i think it is not a Server problem.
Check th following:
Open the document in the Browser where it is displayed and save it on a thumbdrive and open it on the other client.
-> If it works: it must be Browser settings
-> If not: the generated PDF is not valid for the Adobe Reader of the other client.
If it works on the Server but not on the client, try to dump it to a file on the Webserver to see if the BAPI call (RFC/WS) is the problem. When you use XString for exampe I think there is a problem with the data beeing split into several lines. If you have the file you should be able to open it. Compare the size of the File on the WebAS and the backend.
Kind regards
Matthias
Edited by: Matthias Schneider on Nov 4, 2008 6:19 PM

Similar Messages

  • Display PDF from BAPI in Webdynpro

    Hi all,
    I have a BAPI that returns a PDF file as a TLINE table, and I need to display the result in a Java Webdynpro, do you guys know how I can do that? Thank you in advance.

    Hello SAPer
    The TLINE table is not basically a PDF file but an OTF file. I suggest you to call one more BAPI 'Convert_OTF' that takes this TLINE table as input and returns a pdf_file.
    Then in JAVA Web Dynpro, use the following code in your action handler after calling the respective RFC :-
    byte[] pdfContent;
    String pdfFileName = null;
    pdfContent = wdContext.current<Bapi_name_OutputElement>().getE_Pdf_File();
    pdfFileName = "<name>"
    IWDCachedWebResource pdfResource= WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);                                         
    try
    wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),pdfFileName,true).open();
    } catch (WDURLException e)
    msgMgr.reportException(e.getMessage(),false);
    I hope this helps you.
    Regards
    Kapil.

  • Cannot Display PDF from Documentum in SAP

    Hello Everyone,
    We have linked SAP with Documentum to be able to retrieve documents stored in the content server. We made all the setting required in OAC0, OAC2, OAC3. But when we are posting a document against a Purchase Order from documentum and trying to view that PDF from "ME23" it is giving us an error message as shown below:-
    "The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    An invalid character was found in text content. Error processing resource 'file:///C:/Documents and Settings/gopal.yarlagad...
    But if we go into the "OAOR" I can see the document against the Purchase order. We are not able to figure out the issue regarding this. I would greatly appreciate your help if you can help me in resolving this issue.
    Regards,
    Gopal.

    We also had the same issue. It was working prior, and suddenly we can't view .msg file (in CMOD archived storage) in portal as it no longer recognize mime type for this. This must be a new patch from outlook last week. We ended up implementing config change suggested in note 1840170, and add this mime entry in local registry. As per IBM note http://www-01.ibm.com/support/docview.wss?uid=swg21610741, it looks like there's no other choice but to do it.
    We plan to push this entry to all users' computers soon. 
    Regards.

  • Displaying pdf from file system in OA framework pages

    Hi,
    If anyone could help me with this I would be very grateful.
    We have a number of pdfs containing sensitive information, held on our Unix file system in directories not publicly available.
    I want to create an OA framework page which takes the name of a pdf as a parameter and displays the content of that pdf on the user's browser. I cannot simply do a redirect because the pdfs are not publicly available.
    I've found some sample java code that allows you to set InputStream and OutputStream and read the content of the file. However, I cannot see how to redirect the output stream to the browser. Of course, this may be entirely the wrong approach.
    Can anyone suggest anything or point me to some documentation that might help?
    Many thanks,
    Mike Thorn.

    Hi Shiv,
    Thanks for responding. I'm not sure whether I've explained my problem properly, so I've included a code snipet below.
    I've got my head around how to stream the contents of a file to an output string but cannot see how to bolt this into the controller region for an OA framework page. In the code below, you'll see I have a dofile which reads from my D: drive and streams to the System.out. I'm calling this from the processRequest for the page controller but do not understand how to get the output stream into the OAHTMLWebBean (my inclusion of Google works just fine).
    All this Java is rather new to me I'm afraid.
    public static void dofile()
    try{
    OutputStream outStream = System.out;
    String fileName= (String)"index.htm";
    String filePath = "D:\\Jdeveloper\\jdevdoc\\";
    File f = new File(filePath, fileName);
    String fileType = fileName.substring(fileName.indexOf(".")+1,fileName.length());
    byte[] buf = new byte[8192];
    FileInputStream inStream = new FileInputStream(f);
    int sizeRead = 0;
    while ((sizeRead = inStream.read(buf, 0, buf.length)) > 0) {
    outStream.write(buf, 0, sizeRead);
    inStream.close();
    outStream.close();
         catch (Exception e) {
              System.err.println(e);
              System.err.println("dofile error");
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    dofile(); //but how do I egt the output to the OAHTMLWebBean?
    // the following works fine to include Google
    OAHTMLWebBean outRegion = (OAHTMLWebBean)createWebBean(pageContext, HTML_WEB_BEAN, null, "IFRAME");
    outRegion.setHTMLAttributeValue("src","http://www.google.co.uk");
    outRegion.setHTMLAttributeValue("width", "100%");
    outRegion.setHTMLAttributeValue("height", "60%");
    outRegion.setHTMLAttributeValue("title","My title");
    outRegion.setHTMLAttributeValue("name", "My name");
    pageContext.getPageLayoutBean().addIndexedChild(outRegion);
    Many thanks again for any help you can offer this Java virgin,
    Mike Thorn

  • To Display PDF from BSP

    Hi,
    Im calling a method in my BSP application which gives me PDF output.
    CALL METHOD ref->******
      EXPORTING
        lv_vbeln      = lv_vbeln
      IMPORTING
       l_header      = l_header
       wa_head_right =
       message       =
       l_vbeln_text  =
       with_hold     =
       with_hold_n   =
       g_flag        =
       l_pricekey    =
         formout  = formoutput.
    My formoutput-PDF has the xstring, and to call this PDF file i have written the below code
    l_pdf_xstring = formoutput-pdf.
    CREATE OBJECT cached_response TYPE cl_http_response
                            EXPORTING add_c_msg = 1.
    data = l_pdf_xstring.
    l_pdf_len1 = XSTRLEN( l_pdf_xstring ).
    CALL METHOD cached_RESPONSE->SET_CONTENT_TYPE
      EXPORTING
        CONTENT_TYPE = 'application/pdf'.
    cached_response->set_cdata( data   = data
                                length = l_pdf_len ).
    CALL METHOD cached_response->if_http_response~set_status
      EXPORTING
        code   = 200
        reason = 'OK'.
    CALL METHOD cached_response->if_http_response~server_cache_expire_rel
      EXPORTING
        expires_rel       = 180.
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        ev_guid_32 = guid.
    v_guid = guid.
        call method cl_http_ext_csif=>access_info_get
          changing
            crep_http = lv_crep_http
          exceptions
            failed    = 1
            others    = 2.
        if lv_crep_http-http_port is not INITIAL.
          write lv_crep_http-http_port to lv_crep_http-http_port no-zero.
        else.
          write lv_crep_http-http_sport to lv_crep_http-http_sport no-zero.
        endif.
    CONCATENATE runtime->application_url '/' v_guid '.pdf' INTO display_url.
    cl_http_server=>server_cache_upload( url      = display_url
                                         response = cached_response ).
        if lv_crep_http-http_port is not INITIAL.
          concatenate 'http://' lv_crep_http-http_serv ':'
          lv_crep_http-http_port display_url into display_url.
        else.
          concatenate 'https://' lv_crep_http-http_serv ':'
          lv_crep_http-http_sport display_url into display_url.
        endif.
        data: lv_url1 type string.
        lv_url1 = display_url.
    When I open the generated link, its giving that my PDF file is damaged or cannot be displayed. I have found the same code in many forums, its not working in this particular program. Please help me out with this.
    Thanks in advance.

    With the help of some other posts and blogs.. am able to display the pdf now.
    However, the default magnification(zoom) is always 44.5%. Any ideas as to how this can be increased or set to a default value.
    Sri

  • Display PDF from flex windows application

    Hi,
    I am creating a flex windows application using action script and mxml script.I need help in displaying a PDF document in that windows application from a netwrok drive or local pc.I tried google search it is giving me some open source projects with IFrames.But,they can be only used for browser applications(web).So,anyone please suggest me how could i accomplish this task with winows application.
    Thanks,
    adi2010

    Hi ,
    The solution for the thread is
    <mx:HTML id="pdfHtml" location="test.html" width="100%" height="100%" />
    var pdfFile:File = File.applicationDirectory.resolvePath(pdfHtml.location);
        pdfFile = new File(pdfFile.nativePath);
        var fileURL:String = pdfFile.url;
        pdfHtml.location = fileURL;
    Thanks,
    adi2010.

  • Reader 9.4.6 bug displaying PDFs from Autocad

    I've received several architectural drawings produced from Autocad as PDFs. All of them display correctly in Reader 9.4.6 for Windows, but in Reader 9.4.6 for Unix, some dashed lines are missing from the PDFs when viewed on the screen or printed.
    When I look at the document properties in Adobe Reader, it shows PDF producer as "Acrobat Distiller 7.0.5 (Windows)", and PDF version as "1.4 (Acrobat 5.x).

    - If you about>plug-ins says Adobe Reader, that's what you have (and not Acrobat which unlike Reader is a paid program)
    - Reader X provides certain commenting tools. You should be able to add comments and highlight text using commenting tool
         - Reader 9.4.6 does not have free commenting tools, there can be certain special PDFs where this is allowed but not generically
    - The paid product - Acrobat will let you comment any PDF as long as the author of the PDF has not applied security to the file disabing it
    - Both Reader 9.4.6 and 10 are free products from Adobe. As I note earlier in my reply, only Reader X has free commenting. Both Reader X and Reader 9 will let you view and PDFs and comments.
    - You can develop plug-ins for both Reader and Acrobat products using the free SDK. For Reader, you need to get a special certificate (available at small cost) that needs to be embedded in your plug-in.

  • How to display value from java class with output generated with toplink

    i hava a requirement of displaying (distance ie calculated in java class) with output generated by query.
    ie if output is like
    school name (distance)
    physical address
    here the school name and physical address are retrived from database.

    Hi,
    ValueHolders are used by the JSF internal framework. To work with an object (attributes) in a managed bean you don't need to make it returning a value holder.
    Create a POJO, provide accessor methods and register it as a managed bean. Access it from JSF with EL
    Frank

  • Display PDF from cfhttp

    Hey everyone. I am trying to display a PDF I receive from
    <cfhttp> with the following line of code:
    <cfhttp method="get" getasbinary="yes" url="#theURL#">
    I want to be able to display the PDF within the page as
    opposed to just having a 'save as' box come up. I played with
    <cfcontent> but couldn't get it to do what I want. Any help
    is appreciated.

    Please help me by providing solution........It is Urgent
    Thanks!
    Srinivas

  • Adobe Reader plugin forbids displaying PDFs from outside domains

    One part of web application is local digital signing  using activex component. But I want to display a PDF that gets signed  beforehand and after. Since documents can be quite large I would'n  really want uploading them and then again downloading for displaying.
    Therefore I wanted to embed a PDF using local path (eg. file:///) but Adobe throws "Access denied" error. I tried lowering Reader's security settings to minimum but it didn't help.
    Is there any way to embed a PDF with source ouside of the web application domain?

    Solved it. Problem seemed to have been a crashed Acrobat process. Just kill all Acrobat tasks in the task manager, reload the link in the browser and the Save button now works.

  • Problem displaying PDF in BSP

    Hi All,
    With the help of Craigs Blog
    /people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp
    I coded a BSP to display PDF from a spool number.
    I did everything mentioned in the blog. When i execute, the pdf gets displayed, however the data is some unconverted junk data. Can any one suggest what i am doing wrong here.
    Heres the coding in the Event handler (OnInputProcessing) :
    DATA: radioButtonGroup TYPE REF TO CL_HTMLB_RADIOBUTTONGROUP.
    DATA: fileUpload TYPE REF TO CL_HTMLB_FILEUPLOAD.
    DATA: cached_response TYPE REF TO if_http_response.
    DATA: response TYPE REF TO if_http_response.
    DATA: guid TYPE guid_32.
    fileUpload ?= CL_HTMLB_MANAGER=>GET_DATA(
                           request = request
                           id      = 'myUpload'
                           name    = 'fileUpload' ).
    file_name      = fileUpload->file_name.
    file_mime_type = fileUpload->file_content_type.
    file_length    = fileUpload->file_length.
    file_content   = fileUpload->file_content.
    radioButtonGroup ?= CL_HTMLB_MANAGER=>GET_DATA(
                           request = request
                           id      = 'display_type'
                           name    = 'radioButtonGroup' ).
    display_type = radioButtonGroup->selection.
    IF display_type = 'convertspool'.
      DATA: itab TYPE TLINE,
            witab TYPE TABLE OF TLINE,
            output TYPE STRING,
            outputx TYPE XSTRING.
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID              = 0002344365
          NO_DIALOG                = 'X'
        TABLES
          PDF                      = witab
        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   = 8
          ERR_BTCJOB_SUBMIT_FAILED = 9
          ERR_BTCJOB_CLOSE_FAILED  = 10
          others                   = 11.
      if sy-subrc EQ 0.
        LOOP AT witab INTO itab.
          CONCATENATE
            output
            itab-tdline
          INTO output.
        ENDLOOP.
    ****Convert the Character String to Binary String
        data: r_string  type string.
        data: R_XSTRING type xstring.
        call function 'SCMS_STRING_TO_XSTRING'
          EXPORTING
            text   = output
          IMPORTING
            buffer = outputx.
        CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING
    add_c_msg = 1.
        l_pdf_len = xstrlen( outputx ).
        cached_response->set_data( data   = outputx
                            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.
      RETURN.
    ENDIF.
    Regards
    Sri

    With the help of some other posts and blogs.. am able to display the pdf now.
    However, the default magnification(zoom) is always 44.5%. Any ideas as to how this can be increased or set to a default value.
    Sri

  • How to print specific pages of a pdf from a vb 2013 program using a print dialog

    Hi.  I am using the acrobat sdk to display pdfs from within a vb 2013 program, because the pdfs are large and we have developed indexes on certain columns.  The indexes are stored in SQL tables.  My program has a search window which allows the user to search for a value and displays all the pages on which this value appears in the indexed column in a listbox.  By double-clicking on the desired value in the listbox, the user can go to the selected page and column.  However, the user also needs to be able to highlight one or more of the pages in the listbox and print these pages.  I could do this silently using AcroExchAVDoc.PrintPages, but the user also needs to have a print dialog displayed in order to possibly select a watermark to be printed on the pages.  I also need to default the orientation of the pages depending on the document.
    I have reviewed the sdk documentation and also searched in Google and on this site but have not found a way to do this.  Does anyone have a suggestion?  Thanks for any help you can provide.
    Mary

    Hi.
    I did try using the printParams feature and it worked, but since I need to be able to print sets of non-consecutive pages,  I end up having to bring up the print dialogue multiple times and have the user set watermarks each time. 
    I decided to just create a new pdf in a temp directory containing the selected pages and open this document in a new window.  This works well and allows them to use the print button on the window to print, bringing up the print dialogue just once.  However, since I need to open the document in a way that shows the print button, I am using OpenInWindowEx, with AV_DOC_VIEW, and the option PDUseBookmarks or PDUseThumbs, rather than PDUseNone.  This displays a toolbar which also includes icons for creating a new pdf, deleting pages, etc.  I do not really want to include these icons on the toolbar.  Is there a way to remove unwanted icons from the toolbar, or make them invisible?
    Hope this makes sense.  Thanks for your help.
    Mary

  • How to retreive and display output list from BAPI

    Hello
    I am making an applcation using SUP 2.0, and this application make an user to get leave history using a Mobile System from SUP.
    I've created the MBO as Attributes using the BAPI: BAPI_LEAVE_HISTORY.
    This BAPI has some parameters IN and OUT.
    Input parameters are Employee Id and date.
    The parameter OUT is a List that retreives the employee leave history.
    Anyone has an Idea or example how to retreive the output from BAPI and displaying the output on a screen.
    Any tips or blogs that can help me?
    Thanks all!
    Satish

    Hi David Brandow,
    I have tried your solution where I just created a MBO for my 'operation' and I'm using sync parameters to execute the RFC.
    The problem I'm facing is, for example, if I create a record it gets saved in the MBO table and the record successfully gets created in SAP as well after a sync. But when I create another record and sync, the previously saved record in MBO table also gets executed so I'm getting duplicate entries in SAP.
    Have you or anyone faced this problem?
    Any response is appreciated. Please let me know if I'm not clear, I realized its a complicated scenario.
    Thanks,
    Sandeep

  • Problem with pdf display downloaded from application server

    Hi all,
    I have a problem with displaying pdf downloaded from application server (saved in BINARY MODE).
    I am getting the pdf output of adobe form in FPFORMOUTPUT-PDF as rawstring back to my program and then converting that rawstring into binary form using the function module SCMS_BINARY_TO_STRING.
    Now, when I export the data to presentation server directly using cl_gui_frontend_services=>gui_download, the pdf is downloaded properly.
    However, when I save the data to application server file by looping at the internal table obtained from SCMS_XSTRING_TO_BINARY and using TRANSFER, and subsequently downloading the file in "unconverted format" from AL11 to my desktop, I am getting a "blank" pdf file (with the same number of pages as the one downloaded using gui_download).
    I have tried different encodings during download but in those cases i get corrupted pdf message. only the default option of INTIAL value seems to work.
    I am forced to believe that there is a problem in my code which saves the data to app server but I cant find any solution that is logical. Any solution to this would be greatly appreciated.
    Regards,
    Sasi
    Edited by: Sasi Upadrasta on Sep 29, 2010 7:55 PM

    used a program to read the file from appl server and then downloading it to desktop.

  • Calling output types from BAPI

    Dear All,
    I am creating PO using IDOC.
    A function module is used for creating PO from IDOC.
    The moment PO is created SO should also get created.For that i have used OUTPUT type and connected output type to
    application EF.
    can anybody guide me if routine for SO creation ie output type for SO will get triggered from BAPI/Function module for postiing PO application?
    thanks.

    Hello,
    The PDF Files of the Output are stored onto the spool. To retrieve these documents you will need some custom development both on the Java and ABAP stack.
    ABAP : Refer to this link: http://wiki.sdn.sap.com/wiki/display/ABAP/GettingSpoolRequestNumberfortheOutput+type
    Java:
    1. Put up a link on a JSP where you want to show the download option for the output type.
    2. Develop custom action, bo, backend objects
    3. Call a custom RFC in the SAP system from backend class which retrieves the PDF document based on the above link.
    4. Return PDF doc back to Java as a byte stream.
    5. Provide option to save/open  on the client.
    Hope this helps.
    Pradeep

Maybe you are looking for

  • Why cant I edit a received email?

    I just switched from a PC using Outlook. My Outlook has always been much more than a bunch of sent and received emails. I have lots of folders and file things away for reference, and I frequently edit emails to make them easier to find via a search o

  • Trying to understand context indexes and contains-help

    Hi i am using Achieving functionality of many preferences using one context index to understand context indexes and contains and i get the following Error starting at line 1 in command: begin ctx_ddl.create_preference ('nd_mcds', 'multi_column_datast

  • Imac & xbox 360

    I have been reading about connecting an xbox 360 to the imac via the elgato Eyetv. However it seems as though the eyetv would cause the 360 to lag because of USB. Would the EyeTV 410 still lag even though its connected via firewire? And would there b

  • Problem with alv print

    Hi, I am using alv grid, there is a problem with print, when i look at print preview it shows only 1 row and even the values in that row are incorrect. Please help me solv the problem. Thanks, Sai.

  • What to do when a table name is a reserved word?

    I know the best answer is not to use a reserved word to name a table. But I have no control over that in this situation. I have read that using all Caps and quotations will allow you to use the table name in queries, i.e. "CATEGORY" is suppose to fre