cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ABAP display pdf

Former Member
0 Kudos

Hello,

I need to display a pdf document, that shall be displayed within a new view either popup or normal view.

I followed the example as given in thread 'How to show pdf' which is that

- I loaded the pdf to be displayed as a mime object into the system

- Then I created a context node pdf with an attribute pdf_1 of type string

- Then I created a view with and added an interactive form element which I stored within a group element.

- I bound the node and the attribute to the properties dataSource and pdfSource

- I read the pdf of the mime object into the context as described in the thread mentioned above by thomas Jung

But when I test the application, I get a NULL pointer exception (see below)

Debugging shows that the mime object binaries are properly read and bound to the context.

The error seems to occur when the adapter tries to set the context.

As I am a newer to the subject of interactive forms I suspect that I might be missing something on this side...

Can anybody help ?

Tx a lot

Ana

NULL pointer exception displayed in browser:

The following error text was processed in the system C20 : Access via 'NULL' object reference not possible.

The error occurred on the application server sapc20ms_C20_31 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LADOBE==================CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LADOBE==================CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP

Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Method: CONV_VIEW_INTO_VE_ADAPTER_TREE of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP

Method: SET_CONTENT_BY_WINDOW of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP

Accepted Solutions (1)

Accepted Solutions (1)

pranav_nagpal2
Contributor
0 Kudos

Hi,

follow these steps from sap doc....

1. In the Web Dynpro Explorer, create a view for your component or select a view to add

the form to.

2. In the view context, create the context attribute that will be bound to the form later,

and select XSTRING.

3. In the view, drag the UI element InteractiveForm from the Adobe Library to

the Layout Designer.

4. Go to the methods for your view and change WDDOINNIT by adding coding to the

method, such as the coding below:

method WDDOINIT .
data:
Elem_Context type ref to If_Wd_Context_Element,
Stru_Context type If_View=>Element_Context ,
Item_STATIC_PDF like Stru_Context-STATIC_PDF.
* get element via lead selection
Elem_Context = wd_Context->get_Element( ).
DATA: mr TYPE REF TO if_mr_api,
lurl TYPE string.
* get name of component
data: l_component type ref to if_wd_component,
l_component_info type ref to if_wd_rr_component,
l_name type string.
l_component = wd_comp_controller->wd_get_api( ).
l_component_info = l_component->get_component_info( ).
l_name = l_component_info->get_name( ).
* get mime object
mr = cl_mime_repository_api=>get_api( ).
call method CL_WD_UTILITIES=>CONSTRUCT_WD_URL( exporting APPLICATION_NAME = l_name
importing OUT_LOCAL_URL = lurl ).
concatenate lurl '/' 'popup.pdf' into lurl.
mr->get( EXPORTING i_url = lurl
IMPORTING e_content = Item_Static_Pdf ).
Elem_Context->set_Attribute(
exporting
Name = `STATIC_PDF`
Value = Item_Static_Pdf ).
endmethod.

5. In the properties table for InteractiveForm, bind the pdfSource to the context attribute

created in step two.

6. After filling the created context structure u2013 for example using a suitable supply

function u2013 and inserting it into the window navigation, you can activate and test an

application.

regards

Pranav

Answers (3)

Answers (3)

naval_bhatt4
Contributor
0 Kudos

which thread by thomos are you talking about .. I ahve to do the same thing ?

Thanks ...

Former Member
0 Kudos

Hi,

thank you!

For anybody having the same problem. What solved it was that the data source shall not be bound to the node, just the pdfSource to the attribute!

Cheers

Ana

former_member188831
Contributor
0 Kudos

Hi Annette,

you want just display the pdf or you need to enter some thing on pdf i mean it should be interactive pdf ?

if you want enter some values in pdf then no need to go to mime object..

just you need to take the interactive form element and provide the template source as your form name which is created in sfp bind the context automatically by saying yes to the popup.

Regards,

Mahesh.Gattu

Former Member
0 Kudos

Hello Mahesh.Gattu,

Thank you for your comment.

But no, i just need to display a pdf document, that is, no form needed and there no templates.

As mentioned above, I seem to have the same problem as Susanne stated in the thread named above, but somehow I still get the null pointer

Cheers

Ana

Former Member
0 Kudos

Hi Ana,

Please note one thing when you try to use Interactive UI element using Webdynpro ABAP.

In the properties of the UI element under Template source, you need to specify the form name created in SFP Transaction code.

In PDF source, or Template source you cannot include your MIME object containing the PDF file in it.

It raises an Exception as you got.

Please create a form layout in SFP and use that form here under Template source of that UI element and see the result.

Instead of loading the PDF in your MIME repository, follow the below process.

Go to SFP.

1) create an interface with out any import or export parameters. ( Let the default parameters stay ).

2) create a a form using the above created interface.

3) go to layout, and In the menu Click Tools-> Import.

4) Select your PDF file.

5) Save the layout and activate the form.

6) go to WDC, and in the Interactive UI element under template source mention the above created Form name.

Hope this solves your problem.

Good day!

Thank you,

Shashikanth. D