on 10-07-2008 12:50 PM
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
> 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I think this is the problem. I need the binary content. But how can I read the pdf in the mime repository to get the content binary? I looked on help.sap.com > Mime repository but I couldn't find something. Do you have a sample? Sorry I am not so close to ABAP and web dynpro.
Thanks, Susanne
Edited by: Susanne Steib on Oct 9, 2008 10:49 AM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.