Skip to Content
0
Sep 14, 2005 at 10:43 AM

Saving and sending Adobe Form pdf from WebDynpro

43 Views

Hi,

I'm developing an application which receives data from a RFC to a R/3. The datas are displayed on a pdf-Document in a Webdynpro. This works fine.

Now I want to send this form as attachment in an email. Do I have to save it first as pdf or can I send it directly?

On SapHelp I found a tutorial how to save a form as pdf:

http://help.sap.com/saphelp_nw04/helpdata/en/dc/f1783fe3263042e10000000a114084/frameset.htm

I tried out the describtion but without success. I defined an action on the view where the form should be displayed and added the coding in the implementation of the event. In the form I added a button Submit to SAP from the Web Dynpro Library. When I press the button, nothing happens. Do I have to make any changes under Object->Field->Control Type?

Another question about the coding:

public void onActionsubmit(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionsubmit(ServerEvent)

IPrivateResultView.IContextElement contextElement =

wdContext.currentContextElement();

byte[] bytes = contextElement.getPdfSource();

try {

File file = new File("C:
temp
example.pdf");

FileOutputStream os = new FileOutputStream(file);

os.write(bytes);

os.close();

} catch (IOException e) {

// do something

e.printStackTrace();

}

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(

"You have pressed Submit!");

//@@end

}

The path where the pdf shall be saved is "C:
temp
example.pdf", I expected something like "C:\temp\example.pdf" on a windows machine.

Where will the pdf be saved? On the machine i deployed the application (what about rights for saving) to or localy on the machine I start the app?

Does anyone knows how to send the pdf by email when saving the form or knows a helpful tutorial?

Many thanks for your help

Mathias Lange