%pdf error in downloading pdf from Function module

Hi,
I am trying to download pdf from a LinkToaction UI element.
I recieve %pdf" error when trying to download using below code. from backend perspective ABAPer said they are able to download PDF from ABAP program. Lokks like I am doing some mistake somewhere in below code.
From the backend, pdf is coming in  a table in the form of SOLI-Text Line (TLine - SO_TEXT255)
In webdynpro I am tried to take each line from that table and attched to a IWDResource as below.
Please correct me if anything wrong here to get out of %pdf" error.
IModel_Pdf_FileNode Model = wdContext.nodeModel_Pdf_File();
IPDFElement pdf = wdContext.nodePDF().currentPDFElement();
if (Model != null && Model.size() > 0)
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
try {
   for (int i = 0; i < Model.size(); i++){
      IModel_Pdf_FileElement Element =
                                             Model.getModel_Pdf_FileElementAt(i);
     baos.write(Element.getLine().getBytes());
    IWDResource resource =WDResourceFactory.createCachedResource(
          baos.toByteArray(),
          "Test",
          WDWebResourceType.PDF);
    pdf.setBinaryResource(resource);
Thanks
Praveen

Thanks for the sample. I use version NWDS7.0 and I don't find IContent type in my NWDS after re-organizing import statements.
currently I use below code to get the PDF on click of LinkToaction UI element (After I set the pdf from backend above part of the code).
{code
IWDResource pdfResource = wdContext.nodePDF().currentPDFElement().getBinaryResource();
               String pdfURL = pdfResource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal());
          IWDWindow window =
          wdComponentAPI.getWindowManager()
          .createNonModalExternalWindow(pdfURL , "Test");
          window.show();
{code}
Currently above code giving %pdf" error when clicking LTU UI elemnt.
Please suggest How I need to adjust your sample in my case.
Thanks
Praveen

Similar Messages

  • Error when workflow created from Function Module

    Hi All,
    I am trying to implement leave module workflow for one of my requirement.
    when i create a leave from PTARQ transaction workflow it is being triggered, but when i tried to do the same from a custom function Module using the same FMs used in PTARQ, workflow initiated but stopped at initial stage( at switch branch )
    i went to SWI1 transaction and executed it manually, it end up with error saying ' Error when starting a SWITCH branch'
    what should i do to move it forward.
    Thanks,
    Krish.

    Hi Kishore,
    For leave workflow, SAP has the separate frame work. They called the FM SAP_WAPI_START_WORKFLOW and pass all necessary data's to Process the leave workflow.
    Its not advisable to overwrite the standard behavior. Please check your 'REQ' workflow container in the log. There will be a no data or Some data's might be Missed.
    Before Call the FM, make sure that all data's are passed to the Table parameter, SImple_Container.
    The reason for the Error in your workflow is, there is no data stored in REQ.STATUS container.
    please check the Workflow log.
    Thanks.

  • Error while creating webservice from function module in ECC

    Hi
    while creating a web service out of a function module in ECC, in the configure service section we get a message saying ' Remember that the service does not have any runtime configuration and therefore cannot be used. Create the Web service configuration in the NetWeaver Admninistrator (transaction WSADMIN2).'
    instead of check box 'release for runtime'.
    Our ECC at release 7 patch level 22.
    Checked in SCICM, SICF teh service and the folder are active.
    Please suggest if we are missing on anything
    Regards
    Kumar

    In new version on ECC, the runtime configurations needs to be performed in transaction SOAMANGER.
    On executing the transaction, it opens a browser. The important configurations to be performed are:
    1. Configure J2EE server and host. You can choose to provide the ECC server and host
    2. Administration of the service in "Single Service Administration". The navigation path may differ depending of the ECC versions. But it is related to administration of the services.
    Once done, check the WSDL generated.
    Use this WSDL in the NWDS.
    Regards,
    Sharath

  • Just installed Outlook 365. Now getting an error message downloading pdf's from outlook re: licensing on my acrobat 9 standard

    Just installed Outlook 365. Now getting an error message downloading pdf's from outlook re: licensing on my acrobat 9 standard. 148:3

    OFFICE 365 is a cloud version of OFFICE 2013. Full compatibility with Acrobat requires an updated Acrobat XI. You will likely have to store the file and then open in AA 9. To create a PDF you will have to print to the Adobe PDF printer or use the MS plugin that has several issues.

  • Sending pdf via email: pdf is not returned from function module

    Hi all.
    I am having trouble sending a pdf form as an attachment to an email.
    After calling the funtion module that is creating the PDF, field pdf of the return parameter /1bcdwb/formoutput should be used to create the attachment.
    But the field PDF is empty after calling the function module - only the field xml is given back.
    What did I miss?
    Thank you for your help and best regards, Kathrin!

    Hi Kathrin,
    See below for the example:
    ls_outputparams-getpdf = 'X'.
    CALL FUNCTION 'FP_JOB_OPEN'
         CHANGING
           ie_outputparams = ls_outputparams
         EXCEPTIONS
           cancel          = 1
           usage_error     = 2
           system_error    = 3
           internal_error  = 4
           OTHERS          = 5.
    If you setup the job like this then the pdf parameter will be filled with the XSTRING data for the generated PDF.
    Regards,
    Ryan Crosby

  • I am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    i am trying to generate purchase order and i create a BAPI also which is active.
    But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)".

    Hi,
    Yeah i tried my Z_BAPI in R3 and then giving some ERROR.
    This is my CODE-
    FUNCTION ZBAPIPOTV2.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(POHD) TYPE  ZPOHD OPTIONAL
    *"     VALUE(POITEM) TYPE  ZPOITEM OPTIONAL
    *"  TABLES
    *"      RETURN STRUCTURE  BAPIRET1 OPTIONAL
    data: ls_pohd type bapimepoheader,
             ls_pohdx TYPE bapimepoheaderx,
             lt_poit TYPE TABLE OF bapimepoitem,
             lt_poitx TYPE TABLE OF bapimepoitemx,
             ls_poit TYPE bapimepoitem,
             ls_poitx TYPE bapimepoitemx.
       MOVE-CORRESPONDING pohd to ls_pohd.
       MOVE-CORRESPONDING poitem to ls_poit.
       ls_pohdx-comp_code = 'x'.
       ls_pohdx-doc_type = 'x'.
       ls_pohdx-vendor = 'x'.
       ls_pohdx-purch_org = 'x'.
       ls_pohdx-pur_group = 'x'.
       ls_poit-po_item = '00010'.
       APPEND ls_poit to lt_poit.
       ls_poitx-po_item = '00010'.
       ls_poitx-po_itemx = 'x'.
       ls_poitx-material = 'x'.
       ls_poitx-plant = 'x'.
       ls_poitx-quantity = 'x'.
       APPEND ls_poitx to lt_poitx.
    CALL FUNCTION 'BAPI_PO_CREATE1'
       EXPORTING
         POHEADER                     = ls_pohd
        POHEADERX                    =  ls_pohdx
    *   POADDRVENDOR                 =
    *   TESTRUN                      =
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   POEXPIMPHEADER               =
    *   POEXPIMPHEADERX              =
    *   VERSIONS                     =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
    *   NO_PRICE_FROM_PO             =
    *   PARK_COMPLETE                =
    *   PARK_UNCOMPLETE              =
    * IMPORTING
    *   EXPPURCHASEORDER             =
    *   EXPHEADER                    =
    *   EXPPOEXPIMPHEADER            =
      TABLES
        RETURN                       = return
        POITEM                       = lt_poit
        POITEMX                      = lt_poitx
    *   POADDRDELIVERY               =
    *   POSCHEDULE                   =
    *   POSCHEDULEX                  =
    *   POACCOUNT                    =
    *   POACCOUNTPROFITSEGMENT       =
    *   POACCOUNTX                   =
    *   POCONDHEADER                 =
    *   POCONDHEADERX                =
    *   POCOND                       =
    *   POCONDX                      =
    *   POLIMITS                     =
    *   POCONTRACTLIMITS             =
    *   POSERVICES                   =
    *   POSRVACCESSVALUES            =
    *   POSERVICESTEXT               =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   POEXPIMPITEM                 =
    *   POEXPIMPITEMX                =
    *   POTEXTHEADER                 =
    *   POTEXTITEM                   =
    *   ALLVERSIONS                  =
    *   POPARTNER                    =
    *   POCOMPONENTS                 =
    *   POCOMPONENTSX                =
    *   POSHIPPING                   =
    *   POSHIPPINGX                  =
    *   POSHIPPINGEXP                =
    *   SERIALNUMBER                 =
    *   SERIALNUMBERX                =
    *   INVPLANHEADER                =
    *   INVPLANHEADERX               =
    *   INVPLANITEM                  =
    *   INVPLANITEMX                 =
    ENDFUNCTION.
    i am trying to generate purchase order and i create a BAPI also which is active. But when i call the BAPI from SYbase Mobile Object RFC then after calling it gives an Error "Conflict when calling a Function Module (Field Length)". 

  • How to display error message in case of function module ?

    In the report i was using  " message-id "   to display error message....
    how to use in function module ?

    Hi,
    Messages in Function Modules and Methods
    Messages have two different functions in function modules and methods:
    Normal Messages
    If you use messages in function modules and methods without the RAISING addition in the MESSAGE statement, and the caller does not catch the message, the message is handled
    normally according to the context in which it is called within the function module or method.
    Triggering Exceptions with Messages
    If you use messages in function modules and methods with the addition
    ... RAISING <exc>
    the way in which the message is handled depends on whether the calling program handles the exception <exc> or not.
      If the calling program does not handle the exception, the message is displayed and handled according to the context in which it occurs in the function module or method from which it
    was called.
      If the calling program handles the exception, the message is not displayed. Instead, the procedure is interrupted in accordance with the message type, and processing returns to the calling program. The contents of the message are placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
    Catching Message in the Calling Program
    You can catch messages from function modules that are not sent using the RAISING addition in the MESSAGE statement by including the implicit exception ERROR_MESSAGE in the
    EXCEPTIONS list of the CALL FUNCTION statement. The following conditions apply:
      Type S, I, and W messages are ignored (but logged during background processing)
      Type E and A messages trigger the exception ERROR_MESSAGE
      Type X messages trigger the usual runtime error and short dump.
    Catching messages is not currently supported for methods.
    Regards,
    Bhaskar

  • Errors occurred during call of function module BUPR_EMPLO_DELETE

    when distributing employee data from (HCM) to (CRM) there is an error that appears in relation with the settings for the Business Parner:
    "Errors occurred during call of function module BUPR_EMPLO_DELETE
    Message no. R11335
    Diagnosis
    The business partner BAPIs were called up incorrectly. The indicator IV_X_SAVE was given differing settings when the modules were called.
    Within a LUW, the indicator must be consistently set or not set.
    System Response
    The indicator IV_X_SAVE should be set or not set once off. Up to COMMIT WORK the content of the field may not be changed, as problems will otherwise occur with the internal memory, thus leading to runtime errors."
    This prevents CRM to be updated with the changes. Kindly help me on the same.

    Hi Sai,
    This is too late to reply this post, but to let everyone know about the issue I am posting here.
    Start new UI session and put breakpoint at BUPR_EMPLO_DELETE and check parameter IV_X_SAVE everytime, till you get the error message. The parameter IV_X_SAVE should be same/consistent (either ' ' or 'X') in whole Logical Unit of Work. It should not change in between.
    I faced the same kind of problem and found that standard was passing IV_X_SAVE = ' ' and in our custom code we were passing IV_X_SAVE = 'X'. I changed it to IV_X_SAVE = ' ' and my problem got resolved.
    You can try the same. Please post the alternate solution if you find it.
    Best Regards,
    Rahul Koshti

  • I generated web service from function module.Where can I find .wsdl file ?

    Hi,
    I generated web service from function module.
    Where can I find .wsdl file ?
    I want to use .wsdl file in .Net application.
    Thanks.

    Hii Cemil Bozlagan,
      All Remote enabled Function Modules in Web AS 6.20 and Above are available as Webservices and the WSDL documents are available in the web service repository at
    [http://<host>:<port>/sap/bc/bsp/sap/webservicebrowser/search.html]
    Find the respective BAPI.
    Click on the WSDL link in the browser and download the WSDL document and use it as per the requirement
    Regards,
    Varun

  • How to create webservice from function module

    Hello,
    I'm trying to create webservice from function module from. I choose Utilities/More Utilities/Create Webservice/..From function Module. What data should I enter in section "Enter Package/Request" ?
    When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign namespaces"
    Is there any doc about this procedure (web service creation) with description of all sections ?
    thanks for any reply,
    Lukasz Ferenc

    Hi,
    Which SAP product of wich release of which SP are you using ?
    The procedure is documented in help.sap.com and in blogs and SDN forum messages.
    It means that the use of the SEARCH button should give plenty of answers...
    >When I check "Local object" checkbox I get a message "Test objects cannot be created in foreign >namespaces"
    As usual, begin your choosen name with an "Z".
    Regards,
    Olivier

  • Calling a report from function module

    Hi Friends,
    I have requirement for Function Module i.e. we will add the button to the standard T-code and ( Function added in config ) then
    Function to be called from Customizing
    Program A called from customizing function
    CalculationPDFFunction  is called from program A.
    So can any one help me the logic for "calling a report from function module  ".
    Thanks in Advance.
    Regards,
    OSReddy.
    Edited by: OSReddy on Sep 23, 2011 7:31 AM

    Hi Jaya,
    Yes. It is possible to call ur custom program using SUBMIT statement.
    1. If u have data to pass then build table type RSPARAMS and use below statement.
    data:
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
    SUBMIT report1 WITH SELECTION-TABLE rspar_tab
                   AND RETURN.
    1. If u want to create variant to the program and use that. use the below statement .
    SUBMIT report1 USING SELECTION-SET 'VAR1' "variant
                   AND RETURN.
    Regards,
    Venkat.O

  • Error while determining the form function module

    Hi everyone,
    We are experiencing problems while displaying one adobe form in ESS. It’s the Travel Expense form (PTRV_EXPENSE_FORM). When pressing the button to “Display/Print” the form we get an error message: "Error while determining the form function module", and no form I shown. The ADS server is configured correctly and there are other forms that are actually working, for example the Travel Request form. We are running WAS 7.0 with SP12.
    Anyone has an idea what can cause the problem? Any help is greatly appreciated.
    Thanks in advance!
    Regards,
    Sophie

    Viktor,
    Thank you for your answer, it solved our problem!
    Regards,
    Sophie

  • How to create a generic datasource from function module?

    Dear experts,
    I have created a generic datasource from function module. For this extrator, I created a function module and a structure.
    I have now some difficulties to continue:
    In this function module, i get data from different transparent tables. Then i put these data into an internal table.
    I just don't know what is the relatioin between the structure i defined and this internal table.
    I should make "iTab structure AA" in the source code?
    Thanks

    Hi..
    check this
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    1. Create s structure with the fields that you need from the 4 tables . Activate.
    2. Goto SE 80 Select The Function Group , Copy , Select the Function module
    " RSAX_BIW_GET_DATA_SIMPLE " and Give a New name starting With
    Y or Z .
    3. SE37 ->Your Function module name -> Change , In table tab give your structure
    name by deleting the associated type given in " XXXX " .
    4. Now select source code and Do the coding . Give Data source name in Coding .
    In your case you have to take data from more that 1 table .
    5. Activate the Function Group .
    6. In RSO2 Create the Data source , Give the Function Module Name , And Save.
    7. RSA3 -> Give data source name and Check for the Records .
    Creation of custom datasource. (Using function module)
    .Create a function group .
    . Structure ZTXXXX
    Create function module (i.e. ZTESTXXX) .
    . Create the data source using transaction (RSO2).
    . If structure exists for the table parameter of your function module then ok else create a structure for the table parameter ‘        ’.
    Test the datasource in R/3 using transaction RSA3.
    Transfer the data source to BW –System and replicate it in the BW-System.
    Message was edited by:
            shiv

  • Formal error: Invalid calling sequence for function modules

    Hi All,
    I have developed a function module for FQEVENT 620 Payment: Transfer Line Items for Clearing.
    The clearing works fine.
    After clearing the open items i need to post an FI-CA Document(BAPI : BAPI_CTRACDOCUMENT_CREATE) for each open item(cleared item)
    I have used the bapi : BAPI_CTRACDOCUMENT_CREATE in the same function module that i have developed for FQEVENT 620 Payment: Transfer Line Items for Clearing.Here i am getting an error "Formal error: Invalid calling sequence for function modules".
    So please let me know where i can use this bapi to post fi-ca document.Is there a BAdi or Enhancement Spot where i can use this BAPI or tell me what should i do to overcome this error.
    Regards
    Venkat

    Venkat:
    While I am confused about your business process - creating an open item when clearing one seems strange.  Look into event 0020 which is called after documents are posted - it may present the opportunity to post process additional documents.
    regards,
    bill.

  • How can I get rid of a 1202 error when downloading products from itunes

    How can I get rid of an 1202 error when downloading products from itunes?

    You have probably downloaded the Norton program which is one of the least desirable helpmates you can invite in.
    Read this thread and follow the suggestions by Thomas R, one of our gurus in this field.
    https://discussions.apple.com/message/20005609#20005609

Maybe you are looking for

  • F11 Recovery don`t work - error Windows failed to start

    After downloading MS updates don`t work administrator password. I try F11 Recovery and see black screen: windows failed to start. A recent hardware or software change might be the cause ... File: \windows\system32\winload.efi status: 0x0000001 Info:

  • Regarding workflow  organization structure

    hi Gurs. How to create Organization Structure, Create Workflow with Multiple Approval based on Organization Structure. this is my requirement i dont no how to create  organization  structure in which tcode  i have to build and what all steps. pl help

  • How to add notes in iPod Touch?

    Hi, I have a big text file that I want as a note in my iPod. I cant really type them all as it is a huge text note. Is there anyway that I can electronically copy it as a note in my iPod ?? Any tips, ideas ?

  • Should I avoid Safari for HOtel reservations?

    I just had to fill out this long draining form, and it would go out. then tried Firefox and worked like a charm? Why does so much stuff like this still not work in Safari years after it's been out?

  • Dynamic client authentication

    Hi all, I was wondering if there is a way to enable client authentication on an ssl socket based on the http get string? e.g. Someone goes to https://127.0.0.1:443/nonauth and will be operating over a standard ssl connection, however if they go to ht