Pdf error in bsp application

Hi,
I produced PDF File by using BSP Application but I have a problem when I open PDF. I have an Error.
Adobe Reader could not open 'example.pdf' because it is either not a supported file type or because the file has been damaged.
my code is :
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
            EXPORTING
              text           = output
             mimetype       = 'APPLICATION/PDF;charset=UTF-8'
           IMPORTING
             buffer         = l_xstring
        CONCATENATE cl_abap_char_utilities=>byte_order_mark_little
        l_xstring
        INTO l_xstring IN BYTE MODE.
        app_type = 'APPLICATION/PDF;charset=UTF-8'.
        DATA: response TYPE REF TO if_http_response.
       response = runtime->server->response.
       response->delete_header_field(
       name = if_http_header_fields=>cache_control ).
       response->delete_header_field( name = if_http_header_fields=>expires ).
       response->delete_header_field( name = if_http_header_fields=>pragma ).
       response->set_header_field( name = if_http_header_fields=>content_type
                              value = 'APPLICATION/PDF' ).
        DATA:filename TYPE string.
        CONCATENATE 'attachment; filename=' 'leavestatus_' sy-datum
                    '.pdf'
              INTO
              filename.
        response->set_header_field( name = 'content-disposition'
                        value = filename ).
        DATA: l_len TYPE i.
        l_len = STRLEN( output ).
        response->set_cdata( data = output  length = l_len ).
        navigation->response_complete( ).
        CALL METHOD cl_bsp_utility=>download
          EXPORTING
            object_s            = l_xstring
            content_type        = app_type
            content_disposition = 'attachment;filename=example.pdf'
            response            = response
            navigation          = navigation.
Thanks for your help.

Hi,
Check out this blog
/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp
plz search the forum before posting a thread....this issue is discussed before
Regards,
Anubhav

Similar Messages

  • PDF download from BSP application

    hi all,
    With the bellow code i am able to download to PDF from BSP application
    Issue is when i click on the download button waiting popup window is not disappearing even after PDF displayed.
    Please help me to resolve how to stop this waiting popup window.
    response->delete_header_field( name = 'Cache-Control' ).  "#EC NOTEXT
      response->delete_header_field( name = 'Expires' ).        "#EC NOTEXT
      response->delete_header_field( name = 'Pragma' ).         "#EC NOTEXT
    Deactivated because of Note 904314 and Kompression in Kernel
      response->set_compression( options = '4' ).
      response->set_header_field( name  = 'content-type'
                                  value = 'application/pdf' ).
      response->set_header_field(
                         name  = 'cache-control'
                         value = 'max-age=0' ).
        response->set_header_field(
                           name  = 'content-disposition'
                           value = 'attachment; filename=candidate.pdf' ).
      l_pdf_len = XSTRLEN( l_pdf_xstring ).
      response->set_data( data   = l_pdf_xstring
                          length = l_pdf_len ).
      navigation->response_complete( ).
    Any help on this is highly appreciated.
    Thanks,
    Ravi

    May be you can navigate to another page AFTER the response_complete() method and show the message that 'PDF is downloaded successfully'
    or something meanful message. so that it will get a response back from server and 'wait...Processing' message might disappear.
    I'm not sure and didnt try..may be you can give it a try and let us know..
    navigation->response_complete( ).
    navigation->goto_page(....)

  • Internet explorer script error in BSP application

    Hi,
    I am receiving Internet Explorer script error when I try to navigate between different pages in a BSP application/navigate between diff page fragemnts within the sqame page.
    Error - "An error occurred in the script on this page."
    Line - 480, char - 33
    error - Object expected
    code - 0
    URL - <Page URL>
    Whether I click Yes or No to continue running the scripts, I still face the same issue.
    The strange part is that this application runs fine in Prod system , but is giving error in Test and Dev systems. There is no difference in the code. There are no Java scripts used in this page. In the whole application as such, there are a few scripts being used.
    The only difference is the Web dispatchers connected to these systems.
    Please let me know in case of any pointers to this error.
    TIA,
    Regards
    Deepthi

    Sachin,
    Thanks for the reply.
    The following is the URL in the error -
    https://<server>/sap(bD1lbiZjPTEwMA==)/bc/bsp/sap/<BSP appn name>/<page>.htm?edit_mode=I
    The page in this URL does not have any JS being used.
    Also, the target pages for this page also do not have any JS.
    How come the application is working fine in Prod system and giving errors in Test system when no changes have been done to the application since atleast a month?
    What are the factors which can create this diff behaviour?
    Also, how can I check if a Java script has any error? Does Web Dispatcher have any role to play in this whole scenario?
    Thanks once again,
    Deepthi

  • Permission denied error in BSP application

    i am using activax object "Microsoft.XMLHTTP" in my BSP application
    and calling following url
    req.open("POST","https://test.authorize.net/gateway/transact.dll",false);
    but it give me the error permission denied
    Thanks
    Ganesh

    i can open this URL from browser, but when i call any URL from my javascript codes in BSP application it gives error "Permission denied" or url is forbidden. this happens with other url also. I have seen some thread on it and tried to put this url in my browser trusted site even after it shows same error.
    Edited by: Ganesh Modhave on Sep 10, 2008 3:44 PM

  • Create a PDF from a BSP Application

    Hi All
    How can I create a PDF from a BSP and/or an XML + XSLT(FO) with SAP webAS ?
    Best regards
    Jerome

    Hi Raja,
    Could you please provide some details on the solution you mentioned?
    I am in need of solution for converting DocX to PDF using XSLT(XSL-FO) and some how the XSLT is not generating a well formatted xsl-fo so the final output is not rendered by FOP in PDF and raising exceptions.
    I am trying to do conversion in ABAP only ( without using third party webservices ) or using FOP ( as it is already configured )
    Any pointers?

  • Internal error in BSP application

    Hi All,
      I am new to BSP and we are working on ROS implemetation. We need to enchace the standard BSP applicaiton (ROS_PRESCREEN) by adding three more tabs in the tabStrip. After adding tabs we are getting following  dump ,
    Internal error occured during runtime generation
    of Class CL_O2AVT7XLSMGG5XVHPK1UPQMV4ZG (Dump ID:
    GEN_BRANCHOFFSET_LIMIT_REACHED)
    Please guid me in solving this issue.
    Thanks and regards
    Uma

    Hi Uma,
                  You are getting a GEN_BRANCHOFFSET_LIMIT_REACHED error. You can find many links on this error.
    Here's a WIKI on how to troubleshoot this error :
    https://wiki.sdn.sap.com/wiki/display/BSP/GEN_BRANCHOFFSET_LIMIT_REACHED
    You can also find many threads in SCN discussing this error.
    abap error GEN_BRANCHOFFSET_LIMIT_REACHED
    GEN_BRANCHOFFSET_LIMIT_REACHED

  • Cannot open PDF link in CRM BSP application

    Hi There,
    I am using CRM BSP application. While I am on the CRM Webpage and I choose a tab like ‘Processing Sale’. I go to ‘attachments’ and there is a link to open the PDF file. On the Development environment if I click the link, the PDF file opens but in the Production environment if I click the PDF link, the file does not open.
    What sort of settings do I need to change in the config i.e. in the transaction SICF to be able to open the PDF file. The difference that I found in the environments was that in TCode SICF, default_host->sap->bc->contentserver. There was no user setup in the Production environment but in Development there was one. But I created a similar user but still the problem not solved. Any suggestion would be appreciated.
    Thanks in advance !

    Hello,
    We are facing the same problem actually and oss ask us to check the following :
    635049 CRM Content Management:Word integration in People-C
    606745 CRM Content Mgmt.: Document does not open
    646177 CRM Content Management: Error/no response in the to
    Also check if the logon data is maintained for the service
    /default_host/sap/bc/contentserver in the transaction sicf.
    Maybe it can help you.
    Regards,
    Frédéric

  • Error message in bsp application

    hi
    Im tamil selvan .....this is my first bsp application i created .. but i cant view the output..the default html code itself not executing... i copied the same code in text and saved in html its executing there... i dont know what is the issue..is any system files are missing...plz guide me im new to bsp....first what should i learn ...  the below is the error i pasted...
    Business Server Page (BSP) error
    What happened?
    Calling the BSP page was terminated due to an error.
    SAP Note
    The following error text was processed in the system:
    Die URL enthält keine vollständige Domainangabe (isys-ecc statt isys-ecc.).
    Exception Class CX_FQDN
    Error Name 
    Program CX_FQDN=======================CP
    Include CX_FQDN=======================CM002
    ABAP Class CX_FQDN
    Method CHECK
    Line 10 
    Long text -
    Error type: Exception
    Your SAP Business Server Pages Team

    Hi Tamil,
    welcome to the SAP Community Network. You will find lots of great resources, tips, and examples here.
    Of course to find them you have to look for them. You will find most people more than happy to help you with problems if you first try and help yourself by searching for the solution yourself.
    So please, search the forums for the solution to your problem before you post.
    Cheers
    Graham Robbo

  • Javascript error calling a bi 7.0 webapplication from a bsp application

    Hi everyone,
    This is the scenario we're facing a javascript error :
    Enterprise Portal is calling a custom bsp application ( via an iview in the enterprise portal ) in the bi system with a parameter "template_id" and a value, which is the technical name of a bi web application.
    The bsp application is evaluating the parameter by some custom code and creating a html page with a redirect or a maintenance message to the bi web application passed with the parameter "template_id".
    The html link to the bi web application is created according to this documentation :
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/46/03d4ac801467e6e10000000a1553f6/content.htm
    Purpose of the bsp application :
    in the bi system there is a database table to maintain a flag for each webtemplate and infocube, which should not be called via the enterprise portal for a certain time ( some kind of maintenance switch ). The bsp application then decides to show a maintenance page for the called webtemplate or to send the redirect page to the client.
    The process described above is :
    working with the bi 7.01 sp7 in the bi ( enterprise portal sp22 ) in the productive system.
    working in the Q&A system bi 7.01 sp8 with bi 3.5 web applications.
    not working in the Q&A system bi 7.01 sp8 with bi 7.0 web applications.
    The javascript error calling bi 7.0 web applications is :
    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET4.0C; .NET4.0E)
    Timestamp: Mon, 6 Jun 2011 09:11:04 UTC
    Message: Object doesn't support this property or method
    Line: 96
    Char: 11
    Code: 0
    URI: https://mlptb1.mlp-ag.com:58001/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?TEMPLATE=B_221_002_KUNDEN_POSTEN_AD
    We've opened a message. Support center is saying that this method isn't supported by sap. We should ommit the bsp application and the used functionality.
    Is there any way to find out, what is causing this object is missing ?
    Is there another way than a bsp application to use this custom maintenance function in the described system setup ?
    system components :
    production system
    SAP NetWeaver 7.0 Portal SP22
    SAP BI 7.01 SP 7
    q&a system
    SAP NetWeaver 7.0 Portal SP22
    SAP BI 7.01 SP 8
    Kind regards.
    Dirk

    Hello everyone,
    we did some further analysis on this problem und we think we found the problem.
    The error occurs while trying to execute the standard url for web templates inside a Enterprise Portal Frame, for example
    https://XXX:XXX/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?TEMPLATE=XXX
    While executing the URL a HTML-Page with some embeded Javascript-code is sent back to the browser.
    In this Javascrip-Code, the method-call "dsmObj.registerAll" leads to a script error in Internet Explorer.
    dsmObj.registerAll("pcd:portal_content/com.sap.pct/platform_add_ons/com.sap.ip.bi/iViews/com.sap.ip.bi.bex", "GUSID:6FC9SuhGDPIMMLwOdeHEIg--_7WQud13yeLJDz2kYoQFSg--", "1307605928212");
    In SP7, the method "dsmObj.registerFullKey" is called instead of "dsmObj.registerAll". This has changed in SP8.
    dsmObj.registerFullKey("GUSID:iBPvyska9*xE_JBalkQG2g--YyKv2C3NToP0I79Mw7EO8w--", "1307606479963");
    The object "dsmObj" seems to reference the parent frame of the Enterprise Portal.
    Has anyone seen this before? Any ideas how we can fix this?
    Kind regards,
    Matthias
    Edited by: Matthias Keller on Jun 9, 2011 2:07 PM

  • How to create downloadable pdf report as hyperlink within BSP application

    Hi,
    I'm developing a BSP application using MVC and htmlb extensions on a WAS 6.40. One of the requirements of my webapplication is:
    - the ability to generate a report in pdf format at runtime, using data retrieved from a backend SAP CRM 3.0 system
    and
    - make this report available/downloadable via a hyperlink in the application.
    I am aware of tools like Smartforms and Adobe interactive forms but need some help to get started and choose the right tool.
    regards, Roelof Jan

    Hi,
    we've done that by firstly building a RFC which prints the report to sap-spool:
    call function 'GET_PRINT_PARAMETERS'
          exporting
            expiration     = 1
            immediately    = ' '
            new_list_id    = 'X'
            line_count     = 65
            line_size      = 132
            report         = sy-repid
            no_dialog      = 'X'
          importing
            out_parameters = wf_params
            valid          = valid_flag.
        if sy-subrc ne 0 or valid_flag eq false.
        endif.
        new-page no-heading no-title print on parameters wf_params
                          no dialog .
    ... list processing ...
    new-page print off.
      concatenate programname sy-uname+0(3) into lc_rq2name separated by '_'.
      select * from tsp01 into tsp01_wa
                          where rq2name = lc_rq2name
                          and rqowner   = sy-uname
                          order by rqcretime descending.
        wf_spono = tsp01_wa-rqident.
        exit.
      endselect.
      if sy-subrc ne 0.
        clear wf_spono.
      endif.
    Then convert the spooljob:
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
        exporting
          src_spoolid              = wf_spono
          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 ne 0.
        return.
      endif.
    Delete Spooljob and generate cached response:
      data del_spono type  tsp01_sp0r-rqid_char.
      del_spono = wf_spono.
      call function 'RSPO_R_RDELETE_SPOOLREQ'
        exporting
          spoolid = del_spono.
      if witab is not initial.
        loop at witab into itab .
          translate itab using ' ~'.
          concatenate output itab into output in character mode.
        endloop.
        translate output using '~ ' .
        create object cached_response
               type cl_http_response
               exporting add_c_msg = 1.
        l_pdf_len = strlen( output ).
        cached_response->set_cdata( data   = output
                                    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 ).
        data: guid type guid_32,
              display_url type string.
        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 ).
        app ?= application.
        app->print_url = display_url.
      endif .
    The display_url has to be used in the normal response-view:
    <script type="text/javascript">
    var param = 'width=700'
          + ',height=550'
          + ',left=0'
          + ',top=0'
          + ',menubar=no'
          + ',location=no'
          + ',resizable=yes'
          + ',status=no';
      window.open('<%= application->print_url%>', 'DRUCK', param ).focus();
    </script>

  • How to generate the output of a BSP application in PDF format?

    Hi,
    I need to modify one BSP application, which generates its output in the form of PDF. I have checked all the methods in the bsp pages and its corresponding controller class's. I couldn't find any relevant method, which deals with generating the output in PDF.
    Could you please share your valuable thoughts on this?
    Again it would be helpful, If anyone of you share some knowledge on Interactive Adobe Forms.
    Thanks,
    John

    >
    I am using oracle version 11.2.0.1, I have set a cronjob which will run on every 15 minutes and give us a log file mentioning the execution time taken for that SQL query:-
    The above query will return the output as well as the time taken for execution of the query. I want to suppress the output of the query and only want the time taken to be printed. Is it possible by set commands. I have marked the output as bold and made it Italic.
    >
    How would that even be useful?
    A query from a tool such as sql*plus is STILL going to send the output to the client and the client. You can keep sql*plus from actually displaying the data by setting autotrace to trace only.
    But that TIME TAKEN is still going to include the network time it takes to send ALL rows that the query returns across the network.
    That time is NOT the same as the actual execution time of the query. So unless you are trying to determine how long it takes to send the data over the network your 'timing' method is rather flawed.
    Why don't you tell us WHAT PROBLEM you are trying to solve so we can help you solve it?

  • Error while creating a BSP application

    Hello Experts-
    I am trying to create a BSP application. This is the error what I am seeing, can any one let me know on what settings i have to make it work.
    Could not create the associated SICF node automatically.
    Add a node manually using "HTTP Service Maintenance"
    (Transaction SICF)
    Steps which I followed to create BSP app are
    Se80> BSP application > name of app> enter> create local object.
    Thanks,
    Raj

    hi,
    Please check the thread before you post it, becoz its already posted and answered too
    after getting the message
    "Could not create the associated SICF node automatically.
    Add a node manually using "HTTP Service Maintenance"
    in the same window in the common box type "/nsu53" and hit enter.
    system will give details about the missing authorization .
    or
    when you generate the web interface it automatically creates the SICF entry. Just make a litte change to the web interface and activate it again.
    You can also regenerate an entire BSP application by calling the O2_GENERATE_BSPAPPL function module in the test environment of
    transaction SE37 .
    cheers,
    Bhavana

  • Error while running BSP application

    Hi all,
    the following errors are comming while running the BSP Application on browser, so please help me to sort it out.
    errors comming on browser are:
    1)The following error text was processed in the system  NWS : An exception that could not be caught occurred.
    2)The error occurred on the application server nwserver_NWS_00 and in the work process 0 .
    3)The termination type was: RABAX_STATE
    4)The ABAP call stack was:
    Form: ON_CHECK_BSP of program CL_BSP_RUNTIME================CP
    Form: ON_REQUEST of program CL_BSP_RUNTIME================CP
    Form: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_HTTP_EXT_BSP===============CP
    Form: EXECUTE_REQUEST of program CL_HTTP_SERVER================CP
    Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
    Module: %_HTTP_START of program SAPMHTTP
    thank you
    kamaljeet

    Hi Kamaljeet
    Are you calling some function module from the BSP page?
    If yes, it seems that it is not getting called properly.
    Function module has to be remote enabled and called from BSP page as: call <FM> DESTINATION '<destination>'. If destination server is same, use 'NONE' as destination
    Or, the problem may be because of mismatch of a data/table type in Function module when called from BSP. In such a case, put a breakpoint at function module and debug to see - at what point, your application fails.
    Hope, it will be of some help.
    Regards
    Ashish Jain
    [email protected]

  • Run Time Error  while executing BSP application in Safari browser

    Hi Frens,
      I am new to BSP application. I have made changes for an existing BSP application which has to be executed on both IE and Safari browsers. I made changes in the View for IE browser and it is executing correctly. I have done the same changes in the Safari view also but when executed in Safari, the browser hangs up and in the backend in SAP it goes to dump. The dump message is as below:                                                                           
    " An exception occurred. This exception is dealt with in more detail below         
    . The exception, which is assinged to the class 'CX_BSP_ELEMENT_EXCEPTION', was  
    not caught,                                                                     
    which led to a runtime error.                                                    
    The reason for this exception is:                                                
    <htmlb:gridLayoutCell>: Class <htmlb:gridLayout> (CL_HTMLB_GRIDLAYOUT) was not   
    found as BSP parent element.           "
    Can anyone help me in understanding this?                                          
    Regards,
    Priya.

    Hi Priya,
    I don't think, you need to change in code for Safari. Please check the following thread.
    Re: BSP's with htmlb - Tags on Browsers for Apple Computers
    Regards,
    Sagar

  • Download the PDF Form as a attachment when button click in BSP application

    Hi All,
    I have scenario, when button click in the BSP application PDF Form want to download in the IE (like one window open with Open,Save and cancel button).
    I have written this code:
    data: pdf type fpformoutput-pdf.
    < Logic for populate value to pdf field ....
    .>
    response->set_header_field(
                         name  = 'cache-control'
                         value = 'max-age=0' ).
      response->set_header_field(
                         name  = 'content-disposition'
                         value = 'attachment; filename=webforms.pdf' ).
      response->set_data( data   = pdf ).
    Once button is clicked pop up is opened and closed automatically because of browser or adobe reader issue.
    How can I resolve this problem ?
    In the IE i need to change any settings ?
    IE version = 7.0
    Adobe reader = 9.0
    I have tried in the same code with IE = 6.0 and adobe reader 8.1.2 its getting download the pdf form working fine.
    The same think i want in IE 7.0 and adobe reader 9.0, what needs to be done ?
    Regards,
    Boopathi M

    Hello Ravi,
    Best would be to bind the dataSource of the InteractiveForm ui element to the parent node containing the table's data. Then specify a name of a template to be created in the templateSource and hit <enter>. Some popups later, the system will have created a template from the structure of the context. All you need to do now is to drag&drop the data structure inside the template designer to the template itself. This will result in a table. Save, activate and return the Web Dynpro view. Don't forget to unbind the pdfSource and enjoy.
    Best regards,
    Thomas

Maybe you are looking for

  • Error while initiating Wily agent on SMD node of cardinality

    Hi I am not sure if I have to put this question here but anyways: I have deployed wily agent thru JSPM and when tried to initiate it on SMD i get this error: 500   Internal Server Error The initial exception that caused the request to fail, was: com.

  • In sales order item level problem of sales unit.

    Hi All, When I create the sales order at that time at item level when I enter the sales unit to order quantity, it then replaced by base unit of that material. Also I have checked the unit conversion in material master, but no conversion is maitained

  • Number of attachments not showing up in Sent mail list

    Since I migrated mail from my MacBook Pro running Leopard to my shiny new MacBook Pro running Lion (I used Migration Assistant), when I look at my Sent Mail box I don't see the number of attachments listed (I'm using the Classic mail format).  I can

  • Spark Image can't scale embedded SWF symbols?

    Can anyone help me make sense of this? Using Flex 4.5.1 (Spark only compile) I've found that the new Spark Image control works inconsistently when loading SWF at runtime and embedding SWF symbols. See these two situations: 1) OK - Spark image loads a

  • HELP: VO Bind variable gets lost, VO passivation checked!

    JDEv 10.1.3.0.4 + Struts/ADF I have a VO with one bind variable "accountId", this VO is the "root master" of the hierarchy => not a detail of a link. I added a method in the VO (that is part of one AM only) to set the bind variable:   WHERE CLAUSE: (