Displaying a Smart form as PDF in Enterprise portal using WebDynpro for Java

...Previous

In NWDS (Net Weaver Developer Studio) create an Adaptive RFC model which points to the FM created in R/3. 

 

Give model name 

 

 

 

Now create an application to display the PDF

 

Insert a frame inside the view 

 

 

Internal is a value node and url is value attribute of type string. 

Place the following code in Init method 

  public void wdDoInit()

  {

    //@@begin wdDoInit()    

    Ynag_Test_Pdf_1_Input input = new Ynag_Test_Pdf_Input();

    wdContext.nodeYnag_Test_Pdf_Input().bind(input);      

    try {                       

            wdContext.currentYnag_Test_Pdf_InputElement().modelObject().execute();

            } catch (WDDynamicRFCExecuteException e) {

                        e.printStackTrace();

                        wdContext.currentContextElement().setSdfgdsfsd(e.getMessage());

            }            wdContext.currentInternalElement().setUrl(convertXStringToUrl(wdContext.currentOutputElement().getBin_File()));          

    //@@end

  } 

  //@@begin others

  public String convertXStringToUrl(byte[] doc_content){

            String url = "";

            WDWebResourceType webResType = WDWebResourceType.PDF;

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

            try {

                        url = webResource.getURL();

            } catch (WDURLException e) {

                        e.printStackTrace();

            }          

            return url;

  }

  //@@end 

 

If you are using single sign on make sure to enable User authentication in the application parameters.

User details are required for this as it is using Single sign on to connect to R/3. 

In this case we have hard coded the Smart form to be used.

If you want it in dynamic way FM interfaces need to be changed accordingly.

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image