Skip to Content
avatar image
Former Member

Generating a PDF in Web Dynpro without using InteractiveForms

Hello All,

I have been following this tutorial http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial%20on%20working%20with%20the%20pdf%20document%20object%20-%2032.htmwww.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial%20on%20working%20with%20the%20pdf%20document%20object%20-%2032.htm">http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial%20on%20working%20with%20the%20pdf%20document%20object%20-%2032.htm> from SDN and is currently stuck.

<u><b>What I'll like to achieve</b></u>

1) User logs on to the system and a table displaying a list of items for approval appears.

2) the user is then able to select a row item from the table and click on 'approve'. In doing so, my application should generate a pdf form in the background and attach it as an email attachment and sent that email to an appointed vendor.

<b><u>Problem</u></b>

As there is no InteractiveForm involved, I do believe I will need to provide the template (.xdp) so that the PDF can be generated. In the tutorial, it suggests doing this (I modified it a little to reflect my own path name):

InputStream templateSourceInputStream = getClass().getClassLoader().getResourceAsStream("d:
usr
sap
pdf
PDF
XBCRPDFPreviewView_InteractiveForm1.xdp");

However, I am given a NullPointerException when I attempt to do that. Does anyone has any idea what may have caused the error ? Thank you.

from

Kwok Wei

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Apr 12, 2006 at 10:34 AM

    Hi Kwok,

    The XDP file is stored on the server right ?

    Simply, access it using -

    File fileXdpTemplate = new File(filePathXdpTemplate);

    FileInputStream xdpTemplateInputStream = new FileInputStream(fileXdpTemplate);

    IOUtil.write(xdpTemplateInputStream,bytArrXdpOutputStream);

    Thanks,

    Sam

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Kwok Wei ,

      According to the convention the any file can be placed in the src/mimes/Components/<component package + component name>/folder of your webdynpro project along with other generated files of your application.

      After this you just need to pass the filename to the getResourcestream() method,it automatically picks up the file from the folder.

      Regards

      Aarthi Mathivanan

      Message was edited by: aarthi mathivanan