Skip to Content
author's profile photo Former Member
Former Member

How to show pdf

Hi,

I want to show a pdf which is located in the mime repository. I got this error: Access via 'NULL' object reference not possible.

These things I did:

1. I created a context node 'PDF' with attribute 'PDF_SOURCE'. The attribute has the Type XSTRING and as Default Value I deposit test.pdf

2. Then I created an Interactive Form element in the layout and bind the dataSource to the node and the pdfSource to the attribute.

Has anybody an idea what I did wrong?

Regards, Susanne

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 07, 2008 at 05:14 PM

    > created a context node 'PDF' with attribute 'PDF_SOURCE'. The attribute has the Type XSTRING and as Default Value I deposit test.pdf

    What do you mean you deposited test.pdf in the default value? Did you only supply the name of the file or the actual binary content? I have feeling you supplied the name, as it would be difficult to type in the binary content in the default value.

    If that is the case, you misunderstand how this property works. The attribute is type XSTRING because it expects the entire binary content of the PDF document you want to display, not just the name of the file. It doesn't lookup and read the file content for you. Your application logic must do that step.

    Add a comment
    10|10000 characters needed characters exceeded

    • There is a Mime API Class: IF_MR_API. Here is an example:

      data lr_mime_rep type ref to if_mr_api,
                      mv_products_xml type xstring.
        constants lc_custom_path type string
                                 value 'SAP/PUBLIC/BC/NWDEMO_MODEL/Products_custom.xml'.
      
        lr_mime_rep = cl_mime_repository_api=>if_mr_api~get_api( ).
      
        call method lr_mime_rep->get
          exporting
            i_url     = lc_custom_path
          importing
            e_content = mv_products_xml
          exceptions
            not_found = 3.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2008 at 12:45 PM

    Hello,

    Usually people get this error bcoz, somewhere they might had forgot to get the instance of class or path of the context node.

    Like below:

    lo_nd_items = wd_context->path_get_node( path = `ITEMS` ).

    and without putting above piece of code , if u try to access the node then it obviously throws this error "Access via 'NULL' object reference not possible". .. 😊

    Just check your code once!

    Cheers,

    Bharath

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.