Regd PDF Printing from Web Dynpro

Hi,
We are using NW04s SP10 . I need to show the data coming from RFC as PDF in Web Dynpro. The RFC is returning String as output after SAP Script is converted to PDF . Below is the code i have written in WD for opening as PDF. When i try to open it as PDF, I am getting message in acrobat reader  "<i>The file is damaged and could not be repaired</i>" . Did anyone faced the similar problem before?
//Converting the string to binary
b = wdContext.nodeOutput().nodeBinary_File().getBinary_FileElementAt(i).getBin_File().getBytes();
  pdfResource=WDWebResource.getPublicCachedWebResource(b,WDWebResourceType.PDF,WDScopeType.CLIENTSESSION_SCOPE,wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),"Test"+i);
pdfResource.setResourceName("test.pdf");
   wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),"Test"+i,false).open();     
Thanks,
Vasu

Hi all,
I am able to solve myself. The problem is with the generated data. Now i am able to see the PDF but i am facing issue in showing the data in pdf which i have posted in another thread.
Thanks,
Vasu

Similar Messages

  • Saving Offline PDF form from Web-Dynpro with Dynamic File Name

    Hello All,
    We have a offline PDF form.... When we save the form, a default file name appears. We need to change this default name to some value that is already available in the form fields.
    I have gone through some posts in the forum. However not able to figure out the solution.
    Following are the details:
    1. Web-Dynpro used : ABAP Web-Dynpro
    2. Form Type: Native
    3. Offline Editable form
    Regards,
    Kunjal Patel

    Hi Rajesh,
    I have not yet found a solution....
    Also as you have seen no one is replying.....
    All,
    Should we consider that this issue does not have a specific solution?
    Regards,
    Kunjal

  • Barcode not getting printed from web dynpro

    Hi,
    We have a smnart form with bar code. When we test it from GUI, it is diplaying the bar code and also printing the bar code successfully.
    However when we show the same smart form in webd ynpro as PDF,  Bar code is getting displayed but when we print the form, bar code is not getting printed.
    Are there some settings for this?
    Regards,
    Madhu

    https://discussions.apple.com/message/23759716?ac_cid=tw123456#23759716

  • Print a PDF from Web Dynpro

    Hi all gurus.
    I developed a Web Dynpro application to let the users create their own sales orders.
    Now I need to let them print the orders when they need to. Searching on the documentation I have, I've never found anything about crating a pdf print from the WD Application.
    There must be a way, because I managed to do that even with the very old ITS (the one in which you had to write HTML code...) but i cannot find how.
    Can anyone help me please? Even a tutorial would be very appreciated.
    Thank you in advance...

    >
    horatiusx wrote:
    > Hi all gurus.
    >
    > I developed a Web Dynpro application to let the users create their own sales orders.
    >
    > Now I need to let them print the orders when they need to. Searching on the documentation I have, I've never found anything about crating a pdf print from the WD Application.
    >
    > There must be a way, because I managed to do that even with the very old ITS (the one in which you had to write HTML code...) but i cannot find how.
    >
    > Can anyone help me please? Even a tutorial would be very appreciated.
    >
    > Thank you in advance...
    You need a Smartform, SAPScript, or AdobeForm to be defined for your output.  Define an action/method for print, then pass the data to your Form.  SmartForms are not bad, as SmartForms generate a Function Module, and are easy to call.
    Call the SmartForm Function with PDF output = 'X' (parameter within Output Control I think).  Then pass the PDF_DATA[] table (type = TAB_SOLIX) to a new window output .
    Don't have the code in front of me, but have done it several times.  
    Adobe Forms is another good option, but you need Adobe Server, and generally I have found ADOBE to be SLOOOOOWWWWW.  I think Steve Jobs might have been on to something with ADOBE -- just my opinion.
    And of course, it can be done with SAPSCript, but I would need a whole blog on how to do that.....

  • Problems with Adobe PDF forms in Web Dynpro Java

    As of now , I have two major issues in developing Adobe PDF forms in Web Dynpro Java .
    1.Text getting wrapped and repeated from the first line :
    Any text field that flows to the next page gets wrapped at the end of the page and is again printed on the next page beginning from the first line .
    For eg:
    If I have 4 lines in a text field that is at the end of the page
    1111111111111111111111
    2222222222222222222222
    3333333333333333333333
    4444444444444444444444
    and the page holds space for only two lines it prints the lines
    1111111111111111111111
    2222222222222222222222
    in the first page and then proceeds to the next page and prints
    1111111111111111111111
    2222222222222222222222
    rather than printing
    3333333333333333333333
    4444444444444444444444
    2.No way to hide a page at runtime:
    It is not possible to hide a page in a PDF form at runtime . If scripting is used , the page turns into a blank page but not hidden .
    Any pointers on this????????
    Helpful answers will be suitably rewarded with points!!!!

    Yes,I am using the versions that you mentioned.
    I have a node called <b>MasterData</b> which is the root node for my PDF Form.I have a node called <b>GenData</b> inside this node whose <b>ctx_Appraisal_Type_Num</b> attribute is bound to a hidden TextField in my form.In the <b>docReady</b> event of this TextField, I am writing the following FormCalc script to hide my SubForm whose Id is <b>MngrCmptnc</b>
    if(MasterData.GenData.ctx_Appraisal_Type_Num == "2")
    then
    MasterData.MngrCmptnc.presence = "visible"
    MasterData.MngrCmptnc.MngrCmptnc.presence = "visible"
    MasterData.StrImp.presence = "visible"
    else
    MasterData.MngrCmptnc.presence = "hidden"
    MasterData.MngrCmptnc.MngrCmptnc.presence = "hidden"
    MasterData.StrImp.presence = "hidden"
    endif

  • HELP !!! Problem in R/3 trying to get a PDF on to Web Dynpro

    Hi,
    I read a note about <b>How to get PDF on to Web Dynpro iView </b>, it was very helpfull, but the problem is in R/3 because I need that the Print Window do not open and send data direct to Web Dynpro.
    the code is:
      control_parameters-no_dialog  = 'X'.
      control_parameters-preview    = ' '.
      control_parameters-langu      = 'S'.
      control_parameters-getotf     = 'X'.
      output_options-xsfcmode   = 'X'.
      output_options-xsf        = space.
      output_options-xdfcmode   = 'X'.
      output_options-xdf        = space.
      output_options-tdnoprev   = 'X'.
    *  OUTPUT_OPTIONS-TDNOPRINT  = 'X'.
      output_options-xsfoutdev = output_options-tddest = 'ZWIN'.
      output_options-tdimmed    = 'X'.
      output_options-tddelete   = 'X'.
    call function 'SSF_FUNCTION_MODULE_NAME'
        exporting
          formname              = 'Z_REP_TRANS_PRES'
    *   VARIANT                 = ' '
    *   DIRECT_CALL             = ' '
       importing
         fm_name                  = formato
    * EXCEPTIONS
    *   NO_FORM                 = 1
    *   NO_FUNCTION_MODULE      = 2
    *   OTHERS                  = 3
    call function '/1BCDWB/SF00000022'
    exporting
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
       control_parameters         = control_parameters
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
       output_options             = output_options
    *   USER_SETTINGS              = 'X'
    *   USUARIO                    =
    *   FECHA_INI                  =
    *   FECHA_FIN                  =
       tipo_rep                   = tipo_rep
    *   TIPO                       =
    *   LOGO                       = 'ZHR_CANTV_LOGO'
    importing
    *   DOCUMENT_OUTPUT_INFO       =
       job_output_info            = output_job
    *   JOB_OUTPUT_OPTIONS         =
      tables
        transf_pres                = transf_pres
    * EXCEPTIONS
    *   FORMATTING_ERROR           = 1
    *   INTERNAL_ERROR             = 2
    *   SEND_ERROR                 = 3
    *   USER_CANCELED              = 4
    *   OTHERS                     = 5
      call function 'CONVERT_OTF'
        exporting
          format                = 'PDF'
    */      MAX_LINEWIDTH         = 132
        importing
          bin_filesize          = numbytes
          bin_file              = bin_file
        tables
          otf                   = zoftdata
          lines                 = zpdf
        exceptions
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 4
          others                = 0.
    Thanks in advance!!!
    tgfch

    Hi Claus,
    Try use this web dynpro code to open the XSTRING that coming from abap side:
    IWDCachedWebResource resource = WDWebResource.getWebResource(
    wdContext.currentZReport_OutputElement().getPdf(), WDWebResourceType.getWebResourceTypeForFileExtensio("pdf"));
    resource.setResourceName(this.getDescriptionReport());
    // Create a External Window with the URL destination
    IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(resource.getURL(), this.getDescriptionReport(), true);
    // Eliminate some features of the window
    window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
    window.removeWindowFeature(WDWindowFeature.MENU_BAR);
    window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
    window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
    window.setWindowSize(780,430);
    window.setWindowPosition(20,140);
    window.open();
    This code will open its PDF report!!!
    Regards,
    Luciano Leite

  • How to get the Response Code when a URL is launched from Web Dynpro

    Hello Experts,
    I have a Web Dynpro Application in which in one of its views i have an IFrame UI element in which i will show a resource stored somewhere ..
    But before showing it i want to check if the resource actually exists. For this i have to check the HTTP Response code from Web Dynpro Application without setting it in the Iframe..
    I am using the following code to get the Response Code:
    try{
    URL url = new URL("Some Url");
    HttpURLConnection.setFollowRedirects(false);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.connect();
    wdComponentAPI.getMessageManager().reportSuccess("Response code ="+connection.getResponseCode());
    }catch(Exception e){
    wdComponentAPI.getMessageManager().reportSuccess("Exception");
    Now the Problem is whatever response Code occurs 403 (for No Proper Authorization), 404 (for Resource not found) etc..
    i always get Response Code=  500 (which is for Internal Server Error) shown in the messgae i have printed.
    Please let me know the correct way of getting the Response Code from Web Dynpro.
    Also my resource is lying on a SAP Portal 6.4
    Best Regards
    Sundeep
    Edited by: Sundeep Sethi on Feb 18, 2008 9:07 AM
    Edited by: Sundeep Sethi on Feb 18, 2008 10:23 AM

    Hi,
      Check this code from /thread/5242768 [original link is broken] if it works.
    try{
    URL myurl = new URL("http://calendar.google.com");
    URLConnection connection = myurl.openConnection();
    if(connection instanceof HttpURLConnection) {
    HttpURLConnection httpConnection = (HttpURLConnection) connection;
    HttpURLConnection.setFollowRedirects(true);
    httpConnection.setRequestMethod("HEAD");
    httpConnection.connect();
    System.out.println("Response = "+httpConnection.getResponseCode());
    catch(Exception e) {
    // print exception
    Regards,
    Harini S

  • How to call PDF file in Web Dynpro Appl?

    How to call PDF file in Web Dynpro Appl?

    Hi Gobinath,
    1. Create a value attribute of type byte called pdfSource.
    2. Insert an UI element called Interactive Form in your layout
    3. Set the source property of this Interactive From UI element to the context pdfSource.
    4. Insert a button which would open your pdf file.
    public void onActionsubmit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionsubmit(ServerEvent)
       IPrivate<viewname>.IContextElement contextElement = wdContext.currentContextElement();
             byte[] bytes = contextElement.getPdfSource();
             try
                   File file = new File("C:
    temp
    example.pdf");
                   FileOutputStream os = new FileOutputStream(file);
                   os.write(bytes);
                   os.close();
                catch (IOException e)
                   // do something
                   e.printStackTrace();
        //@@end
    Warm Regards,
    Murtuza

  • I want to have a unique reference appear on the footer of each printed version of a pdf printed from my website - is this possible?

    I want to have a unique reference appear on the footer of each printed version of a pdf printed from my website - is this possible? If so which version of Adobe do i need?

    If you want it to maybe happen some of the time, if people use the right browser and software and system, you can use JavaScript.
    If you want it to happen reliably, you need server software to add the stamp before the file is served, integrated into your web site's CGI/ASP/PHP or whatever. Probably not an option with shared hosting.

  • Strange problem of Pdf downloading  with Web Dynpro

    Hi, experts, I have to setup a project to realize pdf downloading with web dynpro. But unluckily, I have tried all the methods in this froum ,there's really strange problem .Because when I click the link of Download UI link, there's no reaction at all, I really don't know why.Below is the codes I used , can anyone help me ? thank you very much!
    public void wdDoInit()
        //@@begin wdDoInit()
              IWDAttributeInfo attInfo =
                   wdContext
                        .currentContextElement()
                        .node()
                        .getNodeInfo()
                        .getAttribute(
                        "Pdfsource");
              ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
              IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) type;
              binaryType.setFileName("test.pdf");
              binaryType.setMimeType(WDWebResourceType.PDF);
              try {
                   int length =
                        (int) wdContext.currentPdfdownloadElement().getBin_Filesize();
                   byte b[] = new byte[length];
                   b = wdContext.currentPdfdownloadElement().getBin_File();
                   wdContext.currentContextElement().setPdfsource(b);
              } catch (Exception ex) {
    "Pdfsource" is the context value attribute of type binary.And Bin_File is the xstring type parameter from my RFC contains pdf content.
    I used two views and one customer-controller . I put some value in the first view to set search condition.and the second then appears and have the download UI element. Are there any additional codes I should use? pls help!

    Hi Hao,
    Try this out
    Suppose the file name is test.doc in c drive in server
    create a context attribute filedata of binary type
    bind it to data property
    write the following code
    try
       File input = new File("C:
    test.doc");
       int length =(int)input.length();
       //Create a byte array b to hold the file
       byte b[] = new byte[length];
       FileInputStream in = new FileInputStream(input);
       //Reading the file to a byte array b
       in.read(b);            
       in.close();
       //Setting the data from the byte array to the context element.
       wdContext.currentContextElement().setfiledata(b);
    catch(Exception ex)
      wdComponentAPI.getMessageManager().reportSuccess("Error in File 
      IO"+ex.toString());
    // Structure information of the context attribute
    IWDAttributeInfo attinfo = wdContext.getNodeInfo().getAttribute("filedata");
    IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attinfo.getModifiableSimpleType();
    // Default File name which appears when opened on client machine
    binaryType.setFileName("testing.doc");
    //Explicitly setting the file type
    binaryType.setMimeType(WDWebResourceType.DOC);

  • My wireless HP Deskjet 3050 printer will not print from web sites.

    My HP Deskjet 3050 J610 printer will not print from web sites - it prints ok from WORD, etc. I keep getting the error message: "An unknown error occurred while printing." This problem only arises with Firefox browser.
    The printer is connected wirelessly to a network and this occurs when I use a laptop on the network. It is also connected via cable to a desktop computer but there is no problem in printing from the desktop.
    Any assistance would be appreciated.

    That sounds as if you need to investigate to see if you were able to clear all of the paper that was causing the jam. 
    Best regards,
    erico
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • When I try to print from web page I get "printer not activated - error code 30", printer works on Internet Explorer

    When I try to print from web page I get a dialogue box "Printer not activated - error code 30" followed by a dialogue box "An unknown error occurred while printing". The printer works on websites when I use Internet Explorer. Also, if I copy the web page and paste it into a Word document, I can print a copy. This issue just started this week; I have not encountered this problem prior to this week. Please advise.

    What does that error message say?
    See this: http://kb.mozillazine.org/Problems_printing_web_pages

  • Print to Adobe PDF printer from IE 7 crashes computer

    I apologize if this has already been answered somewhere in this forum, but I could not find mention of it....I have several users inside my company and out that are having issue with printing to the Adobe PDF printer from a webpage viewed in IE 7...the computer inevitably locks up and requires a restart. It seems to vary based on the version of Acrobat or Reader they have installed, but am wondering if anyone knows of the cause and resolution? It would seem to be a battle of Microsoft Operating System versus Adobe. Most users are on Windows XP Professional, using Adobe Acrobat and Reader 8 or better. Those with 6 do not appear to have issue.
    Have been circling around this problem for a month now....any help much appreciated!

    I think it's time to upgrade. 64-bit systems weren't much in use at the time of Acrobat 8.0.

  • Regarding how to pass the data from web dynpro to workflow

    hi gurus,
    how to pass the data from web dynpro to workflow.
    Regards
    vijay

    Check this [thread|SAP_WAPI_START_WORKFLOW;

  • How to pass the data from web dynpro to workflow.

    hi gurus,
    how to pass the data from web dynpro to workflow.
    Regards
    vijay

    Hi
    you can use function module
    data   ls_input_container  TYPE swr_cont.
    data   lt_input_container  TYPE TABLE OF  swr_cont.
    CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
        EXPORTING
          task            = ptask
        IMPORTING
          return_code     = lv_return_code
          new_status      = lv_new_status
        TABLES
          input_container = pinput_container
          message_lines   = lt_message_lines
          message_struct  = lt_message_struct.
    where you pass the data in imnternal table "pinput_container" as
      ls_input_container-element = 'KUNNR'.
      ls_input_container-value = ls_skna1-kunnr ."wd_this->lv_kunnr.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'CLUSER'.
      ls_input_container-value = lv_cluser.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'BUKRS'.
      ls_input_container-value = lv_bukrs. " youe value as per requirement.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'VKORG'.
      ls_input_container-value = ls_sknvv-vkorg. " youe value as per requirement
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'VTWEG'.
      ls_input_container-value = ls_sknvv-vtweg. "youe value as per requirement.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'SPART'.
      ls_input_container-value = ls_sknvv-spart. "youe value as per requirement.
      APPEND ls_input_container TO lt_input_container .
    *Also Forgot to mention where ptask is your workflow ID *
    Regards,
    Arvind
    Edited by: Arvind Patel on May 14, 2010 7:38 AM

Maybe you are looking for

  • Best way to work with interlaced and progressive clips in the same timeline

    I´m shooting with Sony MC-50E camera in 1920x1080, 50i. When importing with Log & Transfer I can work with ProRes 422 files in interlaced mode. I have to mix the footage with video screencapture which is progressive (ProRes 422). The final videos are

  • BT mistake for losing bank details but state they ...

    I changed my account to Santander. Contacted BT with new bank account details. Have a letter confirming those details. They promptly tried to take money from my old account! Now they have cancelled the direct debit, they have lost my bank details, sa

  • Fcoe for ethernet AND san

    I'm having a bit of a brain fart.... I see that you can create an "unified" uplink from the 6248s to an upstream Nexus 5k.  Can I use this single uplink for both VSAN and VLAN traffic, or si the best practice to separare them into an Ethernet uplink

  • Can't find most iTunes songs?

    I am running iTunes 10.1.2 on a Mac, and most of my files are invalid. When I click on a song, a window pops up that says "the song X could not be used because the original file could not be found. Would you like to locate it?" This happens for songs

  • Moving iphoto albums from one computer to another

    When I travel, I take my MacBook Air with me to store and edit my photos in iPhoto 8. When I return home, I'd like to put the completed Albums on my desktop computer (Intel iMac). I don't just want to just import the photos via a CD, I want the title


HashFlare