cancel
Showing results for 
Search instead for 
Did you mean: 

Context remains empty

Former Member
0 Kudos

Hi,

  • I've uploaded a pdf using UI upload element - works fine

  • I'm viewing that uploaded (interactive) pdf in interactiveform ui element - works fine: the fields are filled in

Problem: the context attributes (from node bound to pdf) remain empty... (although they are bound to the textfields in the pdf)

Thanks,

Jeroen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I guess this must be a bug (WDP - for Java - RE SP15).

Now I'm manually parsing the XFA extracted from the binary object using the PDFObject API & XPath.

There is a WDP tutorial on this.

(credits for my temporary collegues who pointed me in the right direction)

krishanu_biswas
Active Participant
0 Kudos

Hello Jeroen Verdrengh,

For the UsePdf mode, the datasource is not populated automatically as it is done for other modes. The idea behind the usage of this mode is to make it work as a pdf viewer. For example, you have some reports in pdf format and in one of your workflows/applications you would like to show them on the screen that does not involve any ADS interaction, no data update, no form update. A plian pdf viewer in webdynpro. From this perspective, the way this UsePdf mode is working in your application is expected and not a bug.

Now there are two ways you can approach your problem. First one is fairly simple, offcourse if your application permists you to do so. After the pdf has been uploaded you must be submitting the pdf to the server, isn't it ? This submission will take care of context popultion from the pdf data. The other way is to use the following interface to force populate the datasource as follows:

/**

  • Method transferPDFDataIntoContext extracts data from a PDF document and copies

  • the values into the Web Dynpro Context. The xml structure of the document data

  • is applied starting from the specified target node. Usually, this node should be the

  • same context node to which <code>InteractiveForm</code>-UIELement property <code>dataSource</code>

  • is bound during PDF generation.

  • @param pdfSource PDF document as <code>byte[]</code>

  • @param targetNode target <code>IWDNode</code>

*/

<b>WDInteractiveFormHelper.transferPDFDataIntoContext(byte[] pdfSource, IWDNode targetNode);</b>

Please follow the javadoc above. Call the method in your upload action handler as soon as you have the pdf document in hand as byte array. Target node is the datasource node that is bound to the context. Make sure that you have your datasorce mapped to a context node along with any other attributes that you might have for your app.

One more suggestion, please do not use PDFObject API (you must be talking about IWDPDFObject interface, right). This has been deprecated starting with NW04s SP06. A new set of more comprehensive APIs are available for the same. Hence, moving forward to NW04s, you will have problem in maintaining your application code.

Cheers,

Krish

Former Member
0 Kudos

Hello Krishanu,

Thanks for your extensive reply.

This is exactly what I need!

Probably I've missed something, I don't know what made me think it worked in my test project (I don't have it anymore).

Many thanks!

Jeroen

Answers (2)

Answers (2)

Sigiswald
Contributor
0 Kudos

Hi Jeroen,

In your InteractiveForm UI element, did you set the "mode" property to "usePDF"? That will indeed display a PDF (that you just uploaded) without recreating it (based on the XDP template and the dataSource), but because of this it will also ignore the dataSource and do no attempt to populate the context.

Kind regards,

/Sigiswald

Former Member
0 Kudos

Hi,

Yes I've set the mode to 'usePdf'.

> but because of this it will also ignore the dataSource

> and do no attempt to populate the context.

I've already tested an application in which the context is populated correctly after loading a pdf file in usePdf mode. Imo it would be inconsistent if WDP didn't populate the context with the found values.

Former Member
0 Kudos

Maybe it is due to a bug for which a workaround has been described in <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bfbcd790-0201-0010-679d-e36a3c6b89fa">this tutorial</a> (step 25)? I'm not able to test it now...

Former Member
0 Kudos

Tested, but without success