cancel
Showing results for 
Search instead for 
Did you mean: 

how to display smartform as PDF in web dynpro java

Former Member
0 Kudos

Hi,

Where can I find sample program to display smartform as PDF in web dynpro java.

Thanks.

Regards,

Henry

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

1. Create a smart form in the R/3 side

2. Now create a function module with the corresponding export parameter:

3. Make sure that the function module is marked remote enabled.

4. In NWDS create an Adaptive RFC model which points to the FM created in R/3 under the webdynpro application

5. Now create an application and view inside it to display the PDF and Insert a frame inside the view

6. Create a value node and an attribute say url of type string inside that node and bind it to the source

7. In the doInit() method place the following code

> ZTest_Pdf_1_Input input = new ZTest_Pdf_Input();

> wdContext.nodeZTest_Pdf_Input().bind(input);

> try {

> wdContext.currentZTest_Pdf_InputElement().modelObject().execute();

> }

> catch (Exception e) {

> e.printStackTrace();

> }

> wdContext.currentInternalElement().setUrl(convert(wdContext.currentOutputElement().getBin_File()));

Inside that view create a method to convert the string to url so that it can be passed as a string to the setUrl method of the currentContextElement() , say convet(byte[] doc_content) which return a string.

Inside that methos write the following code,

> String url = "";

> WDWebResourceType webResType = WDWebResourceType.PDF;

> IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType);

> try {

> url = webResource.getURL();

> }

> catch (Exception e) {

> e.printStackTrace();

> }

> return url;

Hope It will be helpful

Regards,

Sam Charles J.

Former Member
0 Kudos

Please look at the below thread

former_member192434
Active Contributor
0 Kudos

Use this wiki

https://www.sdn.sap.com/irj/scn/wiki?path=/display/wdjava/tutorialWebDynproJavadisplayingasmartforminWDJ+applications&focusedCommentId=77005362

check www.saptechnical.com. with this name "

Displaying a Smart form as PDF in Enterprise portal using WebDynpro for Java" you will get complete blog...